mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
fix incorrect tab numbers in tests, and update tests that navigate from locality to occurrence/species details
This commit is contained in:
@@ -4,7 +4,6 @@ before('Reset database', () => {
|
|||||||
|
|
||||||
const buildLocalityName = (base = 'Bugat') => `${base} ${Date.now()}-${Math.floor(Math.random() * 1e6)}`
|
const buildLocalityName = (base = 'Bugat') => `${base} ${Date.now()}-${Math.floor(Math.random() * 1e6)}`
|
||||||
|
|
||||||
|
|
||||||
// TODO: these tests are obsolete now that the Species tab has been removed from Locality details.
|
// TODO: these tests are obsolete now that the Species tab has been removed from Locality details.
|
||||||
// I'm leaving the code here in case it has to be re-enabled in the future.
|
// I'm leaving the code here in case it has to be re-enabled in the future.
|
||||||
// Some of these tests should also probably be modified and copied over to the Occurrence tab testing.
|
// Some of these tests should also probably be modified and copied over to the Occurrence tab testing.
|
||||||
@@ -607,6 +606,64 @@ describe('Editing a locality', () => {
|
|||||||
cy.contains(speciesName)
|
cy.contains(speciesName)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('does not create a species already used by another, saved occurrence', () => {
|
||||||
|
const speciesName = `saveddoublespecies`
|
||||||
|
|
||||||
|
cy.visit(`/locality/20920?tab=2`)
|
||||||
|
cy.contains('Lantian-Shuijiazui')
|
||||||
|
cy.get('[id=edit-button]').click()
|
||||||
|
cy.get('[data-cy=new-occurrence-button]').click()
|
||||||
|
cy.contains('Add new Species').click()
|
||||||
|
cy.get('[name=order_name]').type('Neworder')
|
||||||
|
cy.get('[name=family_name]').type('Newfamily')
|
||||||
|
cy.get('[name=genus_name]').type('Newgenus')
|
||||||
|
cy.get('[name=species_name]').type(speciesName)
|
||||||
|
cy.get('[id=editing-modal-save-button]').click()
|
||||||
|
cy.contains('Save occurrence').should('not.be.disabled').click()
|
||||||
|
cy.addReferenceAndSave()
|
||||||
|
|
||||||
|
cy.visit(`/locality/20920?tab=2`)
|
||||||
|
cy.contains('Lantian-Shuijiazui')
|
||||||
|
cy.get('[id=edit-button]').click()
|
||||||
|
cy.contains(speciesName)
|
||||||
|
cy.get('[data-cy=new-occurrence-button]').click()
|
||||||
|
cy.contains('Add new Species').click()
|
||||||
|
cy.get('[name=order_name]').type('Neworder')
|
||||||
|
cy.get('[name=family_name]').type('Newfamily')
|
||||||
|
cy.get('[name=genus_name]').type('Newgenus')
|
||||||
|
cy.get('[name=species_name]').type(speciesName)
|
||||||
|
cy.get('[id=editing-modal-save-button]').click()
|
||||||
|
cy.contains('The taxon already exists in the database.').should('be.visible')
|
||||||
|
cy.contains('Save occurrence').should('be.disabled')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('does not create a species already used by another, unsaved occurrence', () => {
|
||||||
|
const speciesName = `unsaveddoublespecies`
|
||||||
|
|
||||||
|
cy.visit(`/locality/20920?tab=2`)
|
||||||
|
cy.contains('Lantian-Shuijiazui')
|
||||||
|
cy.get('[id=edit-button]').click()
|
||||||
|
cy.get('[data-cy=new-occurrence-button]').click()
|
||||||
|
cy.contains('Add new Species').click()
|
||||||
|
cy.get('[name=order_name]').type('Neworder')
|
||||||
|
cy.get('[name=family_name]').type('Newfamily')
|
||||||
|
cy.get('[name=genus_name]').type('Newgenus')
|
||||||
|
cy.get('[name=species_name]').type(speciesName)
|
||||||
|
cy.get('[id=editing-modal-save-button]').click()
|
||||||
|
cy.contains('Save occurrence').should('not.be.disabled').click()
|
||||||
|
cy.contains(speciesName)
|
||||||
|
|
||||||
|
cy.get('[data-cy=new-occurrence-button]').click()
|
||||||
|
cy.contains('Add new Species').click()
|
||||||
|
cy.get('[name=order_name]').type('Neworder')
|
||||||
|
cy.get('[name=family_name]').type('Newfamily')
|
||||||
|
cy.get('[name=genus_name]').type('Newgenus')
|
||||||
|
cy.get('[name=species_name]').type(speciesName)
|
||||||
|
cy.get('[id=editing-modal-save-button]').click()
|
||||||
|
cy.contains('The taxon already exists in the database.').should('be.visible')
|
||||||
|
cy.contains('Save occurrence').should('be.disabled')
|
||||||
|
})
|
||||||
|
|
||||||
it('shows taxonomy check error when copied taxonomy is unchanged', () => {
|
it('shows taxonomy check error when copied taxonomy is unchanged', () => {
|
||||||
cy.visit(`/locality/20920?tab=2`)
|
cy.visit(`/locality/20920?tab=2`)
|
||||||
cy.contains('Lantian-Shuijiazui')
|
cy.contains('Lantian-Shuijiazui')
|
||||||
@@ -748,7 +805,7 @@ describe('Linking projects to an existing locality', () => {
|
|||||||
|
|
||||||
beforeEach('Login as admin and open projects tab', () => {
|
beforeEach('Login as admin and open projects tab', () => {
|
||||||
cy.loginWithSession('testSu')
|
cy.loginWithSession('testSu')
|
||||||
cy.visit(`/locality/${localityId}?tab=10`)
|
cy.visit(`/locality/${localityId}?tab=9`)
|
||||||
cy.contains('Dmanisi')
|
cy.contains('Dmanisi')
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -763,7 +820,7 @@ describe('Linking projects to an existing locality', () => {
|
|||||||
|
|
||||||
cy.addReferenceAndSave()
|
cy.addReferenceAndSave()
|
||||||
cy.contains('Edited item successfully.')
|
cy.contains('Edited item successfully.')
|
||||||
cy.visit(`/locality/${localityId}?tab=10`)
|
cy.visit(`/locality/${localityId}?tab=9`)
|
||||||
cy.contains(newProjectCode)
|
cy.contains(newProjectCode)
|
||||||
|
|
||||||
cy.get('[id=edit-button]').click()
|
cy.get('[id=edit-button]').click()
|
||||||
@@ -771,7 +828,7 @@ describe('Linking projects to an existing locality', () => {
|
|||||||
|
|
||||||
cy.addReferenceAndSave()
|
cy.addReferenceAndSave()
|
||||||
cy.contains('Edited item successfully.')
|
cy.contains('Edited item successfully.')
|
||||||
cy.visit(`/locality/${localityId}?tab=10`)
|
cy.visit(`/locality/${localityId}?tab=9`)
|
||||||
cy.contains(newProjectCode).should('not.exist')
|
cy.contains(newProjectCode).should('not.exist')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ before('Reset database', () => {
|
|||||||
|
|
||||||
describe('Test individual features across the app', () => {
|
describe('Test individual features across the app', () => {
|
||||||
it('Locality update tab opens, detailed modal works, view-link works', () => {
|
it('Locality update tab opens, detailed modal works, view-link works', () => {
|
||||||
cy.visit(`/locality/24750?tab=11`)
|
cy.visit(`/locality/24750?tab=10`)
|
||||||
cy.contains('2006-10-16')
|
cy.contains('2006-10-16')
|
||||||
cy.contains(
|
cy.contains(
|
||||||
'Cande (1992). A new geomagnetic polarity time scale for the Late Cretaceous and Cenozoic. Geology 97: 13917-13951.'
|
'Cande (1992). A new geomagnetic polarity time scale for the Late Cretaceous and Cenozoic. Geology 97: 13917-13951.'
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ describe('Museum e2e flows', () => {
|
|||||||
it('links an existing museum to a locality and saves the locality', () => {
|
it('links an existing museum to a locality and saves the locality', () => {
|
||||||
cy.intercept('PUT', '**/locality').as('saveLocality')
|
cy.intercept('PUT', '**/locality').as('saveLocality')
|
||||||
|
|
||||||
cy.visit('/locality/20920?tab=9')
|
cy.visit('/locality/20920?tab=8')
|
||||||
cy.get('[id=edit-button]').click()
|
cy.get('[id=edit-button]').click()
|
||||||
|
|
||||||
cy.contains('Select Museum').click()
|
cy.contains('Select Museum').click()
|
||||||
@@ -157,7 +157,7 @@ describe('Museum e2e flows', () => {
|
|||||||
cy.addReferenceAndSave()
|
cy.addReferenceAndSave()
|
||||||
cy.wait('@saveLocality').its('response.statusCode').should('eq', 200)
|
cy.wait('@saveLocality').its('response.statusCode').should('eq', 200)
|
||||||
|
|
||||||
cy.visit('/locality/20920?tab=9')
|
cy.visit('/locality/20920?tab=8')
|
||||||
cy.contains(seedMuseum.institution).should('be.visible')
|
cy.contains(seedMuseum.institution).should('be.visible')
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ describe('Museum e2e flows', () => {
|
|||||||
cy.intercept('PUT', '**/museum').as('saveMuseum')
|
cy.intercept('PUT', '**/museum').as('saveMuseum')
|
||||||
cy.intercept('PUT', '**/locality').as('saveLocality')
|
cy.intercept('PUT', '**/locality').as('saveLocality')
|
||||||
|
|
||||||
cy.visit('/locality/20920?tab=9')
|
cy.visit('/locality/20920?tab=8')
|
||||||
cy.get('[id=edit-button]').click()
|
cy.get('[id=edit-button]').click()
|
||||||
|
|
||||||
cy.contains('Create Museum').click()
|
cy.contains('Create Museum').click()
|
||||||
@@ -185,7 +185,7 @@ describe('Museum e2e flows', () => {
|
|||||||
cy.addReferenceAndSave()
|
cy.addReferenceAndSave()
|
||||||
cy.wait('@saveLocality').its('response.statusCode').should('eq', 200)
|
cy.wait('@saveLocality').its('response.statusCode').should('eq', 200)
|
||||||
|
|
||||||
cy.visit('/locality/20920?tab=9')
|
cy.visit('/locality/20920?tab=8')
|
||||||
cy.contains(institution).should('be.visible')
|
cy.contains(institution).should('be.visible')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
+17
-7
@@ -70,19 +70,29 @@ describe('Button Tests', () => {
|
|||||||
cy.contains('Updates').should('be.visible')
|
cy.contains('Updates').should('be.visible')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Links between localities and species work', () => {
|
it('Links between localities and occurrences work', () => {
|
||||||
cy.visit('/locality/21050')
|
cy.visit('/locality/21050')
|
||||||
cy.get('[role=tablist]').contains('Species').click()
|
cy.get('[role=tablist]').contains('Occurrences').click()
|
||||||
cy.get('[data-cy="table-row-21426"]', { timeout: 10000 }).click()
|
cy.get('[data-cy="table-row-21426"]').click()
|
||||||
|
cy.url().should('contain', '/occurrence/21050/21426')
|
||||||
|
cy.contains('Amblycoptus indet.')
|
||||||
|
|
||||||
|
cy.contains('a', 'Dmanisi').click()
|
||||||
|
cy.url.should('contain', '/locality/21050')
|
||||||
|
cy.contains('Dmanisi')
|
||||||
|
})
|
||||||
|
|
||||||
|
it.todo('Links between localities and species work', () => {
|
||||||
|
cy.visit('/locality/21050')
|
||||||
|
cy.get('[role=tablist]').contains('Occurrences').click()
|
||||||
|
cy.get('[id=go-to-species-21426]').click()
|
||||||
cy.url().should('contain', '/species/21426')
|
cy.url().should('contain', '/species/21426')
|
||||||
cy.contains('Amblycoptus indet.')
|
cy.contains('Amblycoptus indet.')
|
||||||
cy.contains('Mammalia')
|
cy.contains('Mammalia')
|
||||||
cy.contains('Diet')
|
|
||||||
cy.get('[role=tablist]').contains('Localities').click()
|
cy.get('[role=tablist]').contains('Localities').click()
|
||||||
cy.get('[data-cy="table-row-21050"]', { timeout: 10000 }).click()
|
cy.get('[data-cy="table-row-21050"]').click()
|
||||||
cy.url().should('contain', '/locality/21050')
|
cy.url().should('contain', '/locality/21050')
|
||||||
cy.contains('Dmanisi')
|
cy.contains('Dmanisi')
|
||||||
cy.contains('Dating method')
|
|
||||||
cy.contains('Lithology')
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user