mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
Add tests to check if staging mode exists only where it should
This commit is contained in:
Binary file not shown.
@@ -3,6 +3,24 @@
|
||||
visiting specific url's directly.
|
||||
*/
|
||||
|
||||
const hasStagingMode = (viewUrl) => {
|
||||
cy.visit(viewUrl)
|
||||
cy.contains('Edit').click()
|
||||
cy.contains('Finalize entry').click()
|
||||
cy.contains('Complete and save')
|
||||
cy.contains('Reference for the new data')
|
||||
}
|
||||
|
||||
|
||||
const doesNotHaveStagingMode = (viewUrl) => {
|
||||
cy.visit(viewUrl)
|
||||
cy.contains('Edit').click()
|
||||
cy.contains('Finalize entry').should('not.exist')
|
||||
cy.contains('Reference for the new data').should('not.exist')
|
||||
cy.contains('Save changes').click()
|
||||
cy.contains('Edit')
|
||||
}
|
||||
|
||||
describe('Test individual features across the app', () => {
|
||||
it('Locality update tab opens, detailed modal works, view-link works', () => {
|
||||
cy.visit(`/locality/24750?tab=10`)
|
||||
@@ -17,5 +35,50 @@ describe('Test individual features across the app', () => {
|
||||
cy.contains('View').click()
|
||||
cy.contains('Reference type')
|
||||
})
|
||||
describe('Staging mode works for the data types that require it', () => {
|
||||
before('Login as admin', () => {
|
||||
cy.login('testSu')
|
||||
})
|
||||
it('Staging mode works on locality', () => {
|
||||
cy.login('testSu')
|
||||
hasStagingMode('locality/24750')
|
||||
})
|
||||
|
||||
it('Staging mode works on species', () => {
|
||||
cy.login('testSu')
|
||||
hasStagingMode('species/21052')
|
||||
})
|
||||
it('Staging mode works on locality', () => {
|
||||
cy.login('testSu')
|
||||
hasStagingMode('time-unit/bahean')
|
||||
})
|
||||
it('Staging mode works on locality', () => {
|
||||
cy.login('testSu')
|
||||
hasStagingMode('time-bound/11')
|
||||
})
|
||||
})
|
||||
// TODO remove the skips once onWrite's has been added to all
|
||||
describe('Staging mode does not appear for the data types that dont require it', () => {
|
||||
before('Login as admin', () => {
|
||||
cy.login('testSu')
|
||||
})
|
||||
it('Staging mode does not appear on reference', () => {
|
||||
cy.login('testSu')
|
||||
doesNotHaveStagingMode('reference/10039')
|
||||
})
|
||||
|
||||
it.skip('Staging mode does not appear on regions', () => {
|
||||
cy.login('testSu')
|
||||
doesNotHaveStagingMode('region/1')
|
||||
})
|
||||
it.skip('Staging mode does not appear on projects', () => {
|
||||
cy.login('testSu')
|
||||
doesNotHaveStagingMode('project/3')
|
||||
})
|
||||
it.skip('Staging mode does not appear on person page', () => {
|
||||
cy.login('testSu')
|
||||
doesNotHaveStagingMode('person/AD')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ describe('Broadly test what different user rights see', () => {
|
||||
cy.contains('Time Bound').should('not.exist')
|
||||
})
|
||||
it('Direct routes to protected views do not work', () => {
|
||||
cy.pageForbidden('person')
|
||||
cy.pageForbidden('region')
|
||||
cy.pageForbidden('time-bound')
|
||||
cy.pageForbidden('project')
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
Reference in New Issue
Block a user