mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
implemented test db reset for e2e tests
This commit is contained in:
committed by
Eero Antikainen
parent
ca58d2000e
commit
31d5ca8add
+4
-1
@@ -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,
|
||||
});
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
before('Reset database', () => {
|
||||
cy.request(Cypress.env("backendUrl"));
|
||||
});
|
||||
|
||||
describe('Broadly test what different user rights see', () => {
|
||||
describe('Admin visibility', () => {
|
||||
|
||||
@@ -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")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user