implemented test db reset for e2e tests

This commit is contained in:
Aaro Koivukangas
2024-09-27 12:22:48 +03:00
committed by Eero Antikainen
parent ca58d2000e
commit 31d5ca8add
6 changed files with 24 additions and 2 deletions
+4 -1
View File
@@ -2,11 +2,14 @@ const { defineConfig } = require("cypress");
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
setupNodeEvents(_on, _config) {
// implement node event listeners here
},
baseUrl: 'http://localhost:5173/',
},
env: {
backendUrl: "http://backend:4000/test/reset-test-database"
},
viewportHeight: 900,
viewportWidth: 1200,
});
+3
View File
@@ -1,3 +1,6 @@
before('Reset database', () => {
cy.request(Cypress.env("backendUrl"));
});
describe('Open each page, table view and detail view, and check at least some correct text appears', () => {
beforeEach('Login as admin', () => {
+5
View File
@@ -21,7 +21,12 @@ const doesNotHaveStagingMode = (viewUrl) => {
cy.contains('Edit')
}
before('Reset database', () => {
cy.request(Cypress.env("backendUrl"));
});
describe('Test individual features across the app', () => {
it('Locality update tab opens, detailed modal works, view-link works', () => {
cy.visit(`/locality/24750?tab=10`)
cy.contains('2006-10-16')
+5 -1
View File
@@ -3,6 +3,10 @@
Mostly to prove some user stories are complete
*/
before('Reset database', () => {
cy.request(Cypress.env("backendUrl"));
});
describe('Button Tests', () => {
it('Buttons for Localities, Species, References, Cross-Search, Map & Time Units are visible', () => {
cy.visit('/')
@@ -89,4 +93,4 @@ describe('Button Tests', () => {
cy.contains('Locality Species').should('be.visible')
cy.contains('Updates').should('be.visible')
})
})
})
+3
View File
@@ -1,3 +1,6 @@
before('Reset database', () => {
cy.request(Cypress.env("backendUrl"));
});
describe('Broadly test what different user rights see', () => {
describe('Admin visibility', () => {
+4
View File
@@ -38,3 +38,7 @@ Cypress.Commands.add('pageForbidden', (url) => {
cy.visit(url)
cy.contains('Your user is not authorized to view this page.')
})
Cypress.Commands.add("resetDatabase", () => {
cy.task("resetDatabase")
})