Add simple test that checks all pages are functioning (tableview & detailview)

This commit is contained in:
arttu
2024-06-06 12:34:23 +03:00
parent bc13c36f7f
commit 968e0452f6
2 changed files with 59 additions and 5 deletions
+58 -4
View File
@@ -1,5 +1,59 @@
describe('template spec', () => {
it('passes', () => {
cy.visit('https://example.cypress.io')
const baseUrl = 'http://localhost:5173/'
describe('Open each page: tableview and detailview', () => {
beforeEach(() => {
cy.visit(baseUrl)
})
})
it('Frontpage contains text', () => {
cy.contains('construction')
})
it('Can open locality table and it shows data', () => {
cy.contains('Locality').click()
cy.contains('Dmanisi')
cy.get('[data-cy="detailview-button"]').first().click()
cy.contains('Dating method')
cy.contains('bahean')
})
it('Can open species table and it shows data', () => {
cy.contains('Species').click()
cy.contains('Rodentia')
cy.get('[data-cy="detailview-button"]').first().click()
cy.contains('Class')
cy.contains('Simplomys')
})
it('Can open reference table and it shows data', () => {
cy.contains('Reference').click()
cy.contains('A Concise Geologic Time')
cy.get('[data-cy="detailview-button"]').first().click()
cy.contains('Reference type')
cy.contains('A new geomagnetic polarity time scale for the Late Cretaceous and Cenozoic')
})
it('Can open time unit table and it shows data', () => {
cy.contains('Time Unit').click()
cy.contains('Langhian')
cy.get('[data-cy="detailview-button"]').first().click()
cy.contains('Sequence')
cy.contains('chlma')
})
it('Can open region table and it shows data', () => {
cy.contains('Region').click()
cy.contains('region 4452477e')
cy.get('[data-cy="detailview-button"]').first().click()
cy.contains('Regional Coordinators')
cy.contains('prs')
})
it('Can open project table and it shows data', () => {
cy.contains('Project').click()
cy.contains('Workgroup on Insectivores')
cy.get('[data-cy="detailview-button"]').first().click()
cy.contains('Coordinator')
cy.contains('NOW Database')
})
it('Can open time bound table and it shows data', () => {
cy.contains('Time Bound').click()
cy.contains('C2N-y')
cy.get('[data-cy="detailview-button"]').first().click()
cy.contains('Bound')
cy.contains('1.778')
})
})
@@ -34,7 +34,7 @@ export const ActionComponent = <T extends MRT_RowData>({
return (
<Box display="flex" gap="0.2em" alignItems="center" width="3.6em">
<Button variant="text" style={{ width: '2em' }} onClick={onClick}>
{getIconToShow()}
<div data-cy={`detailview-button`}>{getIconToShow()}</div>
</Button>
{checkRowRestriction && checkRowRestriction(row.original) && (
<Tooltip placement="top" title="This item has restricted visibility">