-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extract common json, split edit and manage edit tests
- Loading branch information
Showing
8 changed files
with
175 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"userId": 2, | ||
"displayName": "Admin", | ||
"institution": { | ||
"id": 150, | ||
"name": "The Broad Institute of MIT and Harvard" | ||
}, | ||
"roles": [ | ||
{ | ||
"userId": 2, | ||
"roleId": 4, | ||
"name": "Admin" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"userId": 1, | ||
"displayName": "Chairperson", | ||
"institution": { | ||
"id": 150, | ||
"name": "The Broad Institute of MIT and Harvard" | ||
}, | ||
"roles": [ | ||
{ | ||
"userId": 1, | ||
"roleId": 2, | ||
"name": "Chairperson", | ||
"dacId": 1 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"dacId": 1, | ||
"name": "Test DAC", | ||
"description": "Test DAC", | ||
"createDate": "Oct 6, 2020", | ||
"updateDate": "Jun 27, 2024", | ||
"chairpersons": [ | ||
{ | ||
"userId": 1, | ||
"email": "[email protected]", | ||
"displayName": "Chairperson", | ||
"createDate": 1704827256598, | ||
"roles": [ | ||
{ | ||
"userId": 1, | ||
"roleId": 2, | ||
"name": "Chairperson", | ||
"dacId": 1 | ||
} | ||
], | ||
"emailPreference": true, | ||
"institutionId": 150, | ||
"eraCommonsId": "test" | ||
} | ||
], | ||
"members": [ | ||
{ | ||
"userId": 2, | ||
"email": "[email protected]", | ||
"displayName": "Member", | ||
"createDate": 1704827256598, | ||
"roles": [ | ||
{ | ||
"userId": 2, | ||
"roleId": 1, | ||
"name": "Member", | ||
"dacId": 1 | ||
} | ||
], | ||
"emailPreference": true, | ||
"institutionId": 150, | ||
"eraCommonsId": "test" | ||
} | ||
], | ||
"electionIds": [], | ||
"datasetIds": [], | ||
"email": "[email protected]", | ||
"associatedDaa": { | ||
"daaId": 1, | ||
"createUserId": 5146, | ||
"createDate": 1713386755554, | ||
"updateUserId": 5146, | ||
"updateDate": 1713386755554, | ||
"initialDacId": 8, | ||
"file": { | ||
"fileStorageObjectId": 216, | ||
"entityId": 1, | ||
"fileName": "test_daa.txt", | ||
"category": "dataAccessAgreement", | ||
"mediaType": "application/octet-stream", | ||
"createUserId": 5146, | ||
"createDate": 1713386755554, | ||
"deleted": false | ||
}, | ||
"broadDaa": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* eslint-disable no-undef */ | ||
|
||
import React from 'react'; | ||
import {mount} from 'cypress/react'; | ||
import {DAC} from '../../../src/libs/ajax/DAC'; | ||
import {Storage} from '../../../src/libs/storage'; | ||
import EditDac from '../../../src/pages/manage_dac/EditDac'; | ||
import {BrowserRouter} from 'react-router-dom'; | ||
import admin from './admin.json'; | ||
import chair from './chair.json'; | ||
import dac from './dac.json'; | ||
|
||
// It's necessary to wrap components that contain `Link` components | ||
const WrappedEditDac = (props) => { | ||
return <BrowserRouter><EditDac {...props}/></BrowserRouter>; | ||
}; | ||
|
||
describe('EditDAC Tests', () => { | ||
|
||
Cypress._.each([admin, chair], (user) => { | ||
it('Should Load for ' + user.displayName, () => { | ||
cy.viewport(600, 600); | ||
cy.stub(Storage, 'getCurrentUser').returns(user); | ||
cy.stub(DAC, 'get').returns(dac); | ||
const props = {match: {params: {dacId: 1}}}; | ||
mount(WrappedEditDac(props)); | ||
cy.contains(dac.name).should('exist'); | ||
cy.get('[data-cy="dac_name"]').should('not.be.disabled'); | ||
cy.get('[data-cy="dac_description"]').should('not.be.disabled'); | ||
cy.get('[data-cy="dac_email"]').should('not.be.disabled'); | ||
cy.get('[data-cy="btn_save"]').should('not.be.disabled'); | ||
cy.get('[data-cy="btn_cancel"]').should('not.be.disabled'); | ||
}); | ||
}); | ||
|
||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* eslint-disable no-undef */ | ||
|
||
import React from 'react'; | ||
import {mount} from 'cypress/react'; | ||
import {DAC} from '../../../src/libs/ajax/DAC'; | ||
import {Storage} from '../../../src/libs/storage'; | ||
import ManageEditDac from '../../../src/pages/manage_dac/ManageEditDac'; | ||
import {BrowserRouter} from 'react-router-dom'; | ||
import admin from './admin.json'; | ||
import chair from './chair.json'; | ||
import dac from './dac.json'; | ||
|
||
// It's necessary to wrap components that contain `Link` components | ||
const WrappedManageEditDac = (props) => { | ||
return <BrowserRouter><ManageEditDac {...props}/></BrowserRouter>; | ||
}; | ||
|
||
describe('ManageEditDAC Tests', () => { | ||
|
||
Cypress._.each([admin, chair], (user) => { | ||
it('Should Load for ' + user.displayName, () => { | ||
cy.viewport(600, 600); | ||
cy.stub(Storage, 'getCurrentUser').returns(user); | ||
cy.stub(DAC, 'get').returns(dac); | ||
const props = {match: {params: {dacId: 1}}}; | ||
mount(WrappedManageEditDac(props)); | ||
cy.contains(dac.name).should('exist'); | ||
cy.get('[data-cy="dac_name"]').should('not.be.disabled'); | ||
cy.get('[data-cy="dac_description"]').should('not.be.disabled'); | ||
cy.get('[data-cy="dac_email"]').should('not.be.disabled'); | ||
cy.get('[data-cy="btn_save"]').should('not.be.disabled'); | ||
cy.get('[data-cy="btn_cancel"]').should('not.be.disabled'); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters