fix: disable service workers in cypress
continuous-integration/drone/pr Build is passing Details

this way we can run tests in prod mode
This commit is contained in:
Dominik Pschenitschni 2021-10-07 16:25:59 +02:00
parent faa2daa876
commit 0c3e0f03f0
Signed by: dpschen
GPG Key ID: B257AC0149F43A77
2 changed files with 11 additions and 16 deletions

View File

@ -79,25 +79,13 @@ steps:
depends_on:
- dependencies
# Building in dev mode to avoid the service worker for testing
- name: build-dev
image: node:16
pull: true
environment:
YARN_CACHE_FOLDER: .cache/yarn/
CYPRESS_CACHE_FOLDER: .cache/cypress/
commands:
- yarn build:dev
depends_on:
- dependencies
- name: build-prod
image: node:16
pull: true
environment:
YARN_CACHE_FOLDER: .cache/yarn/
commands:
- yarn build --dest dist-prod
- yarn build
depends_on:
- dependencies
@ -119,12 +107,12 @@ steps:
CYPRESS_CACHE_FOLDER: .cache/cypress/
CYPRESS_DEFAULT_COMMAND_TIMEOUT: 60000
commands:
- sed -i 's/localhost/api/g' dist-dev/index.html
- yarn serve:dist-dev & npx wait-on http://localhost:5000
- sed -i 's/localhost/api/g' dist/index.html
- yarn serve:dist & npx wait-on http://localhost:5000
- yarn test:frontend --browser chrome
depends_on:
- dependencies
- build-dev
- build-prod
- name: upload-test-results
image: plugins/s3

View File

@ -2,3 +2,10 @@
import './commands'
import 'cypress-file-upload'
import '@4tw/cypress-drag-drop'
// see https://github.com/cypress-io/cypress/issues/702#issuecomment-587127275
Cypress.on('window:before:load', (win) => {
// disable service workers
// @ts-ignore
delete win.navigator.__proto__.ServiceWorker
})