Skip to content

Commit

Permalink
re-seed db by running the originial init script; in the container add…
Browse files Browse the repository at this point in the history
…ed as a volume for now
  • Loading branch information
schiwaa committed Dec 4, 2024
1 parent b8736de commit 6823bde
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ services:
- .env.test
volumes:
- ./frontend-e2e/:/app
- ./bin/init-data/stemmarest/:/app/cypress/stemmarest
entrypoint: >
/bin/bash -c "sleep 120 && # Waiting for other services to be ready
npm install -g npm@latest &&
Expand Down
30 changes: 20 additions & 10 deletions frontend-e2e/cypress/e2e/experimental.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('delete all traditions and users in the api, re-seed the db', () => {
})
})
})
// DON'T cy.reload() > Cannot read properties of undefined (reading 'name')
// DON'T cy.reload() ==> Cannot read properties of undefined (reading 'name'). TO DO: check why
cy.log('All traditions deleted.')

cy.log('Delete all users:')
Expand All @@ -139,15 +139,25 @@ describe('delete all traditions and users in the api, re-seed the db', () => {
cy.log('All users deleted.')

// re-seed the db
cy.exec('./../bin/init-data/stemmarest/init_test_data.sh',
// cy.exec('./cypress/support/init_test_data.sh',
{ env: { STEMMAREST_ENDPOINT: Cypress.env('CY_STEMMAREST_ENDPOINT') } }
).then(function(result) {
cy.log(result.code)
cy.log(result.stdout)
cy.log(result.stderr)
})
cy.reload()
if (Cypress.env('CY_MODE') === 'headed') { // skip when in headless mode
cy.exec('./../bin/init-data/stemmarest/init_test_data.sh',
{ env: { STEMMAREST_ENDPOINT: Cypress.env('CY_STEMMAREST_ENDPOINT') } }
).then(function(result) {
cy.log(result.code)
cy.log(result.stdout)
cy.log(result.stderr)
})
} else {
cy.exec('./cypress/stemmarest/init_test_data.sh', // currently from a volume, cf. docker-compose.test.yml
{ env: { STEMMAREST_ENDPOINT: Cypress.env('CY_STEMMAREST_ENDPOINT') } }
).then(function(result) {
cy.log(result.code)
cy.log(result.stdout)
cy.log(result.stderr)
})
}

cy.reload() // TO DO: assert adding a tradition in the gui leads to automatic update of listed traditions
cy.log('db re-seeded')

})
Expand Down

0 comments on commit 6823bde

Please sign in to comment.