Changeset View
Changeset View
Standalone View
Standalone View
jobs/templates/includes/stage-cypress-tests.groovy.j2
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | script { | ||||
export CYPRESS_PARALLEL_BUILD_ID={{ n }} | export CYPRESS_PARALLEL_BUILD_ID={{ n }} | ||||
# force use of manually created X11 server | # force use of manually created X11 server | ||||
export DISPLAY=:99 | export DISPLAY=:99 | ||||
# copy database file to the one that will be used by django for that test runner | # copy database file to the one that will be used by django for that test runner | ||||
cp swh-web-test.sqlite3 swh-web-test{{ n }}.sqlite3 | cp swh-web-test.sqlite3 swh-web-test{{ n }}.sqlite3 | ||||
# prevent a race condition when multiple cypress processes load the same support file in parallel | |||||
# as copy operations are performed | |||||
cp cypress/support/e2e.js cypress/support/e2e{{ n }}.js | |||||
sed -i "s/supportFile: 'cypress\\/support\\/e2e.js'/supportFile: 'cypress\\/support\\/e2e{{ n }}.js'/" cypress.config.js | |||||
# run django server on a dedicated port for that test runner and wait for it to be up | # run django server on a dedicated port for that test runner and wait for it to be up | ||||
python3 swh/web/manage.py runserver --nostatic --settings=swh.web.settings.tests 0.0.0.0:500{{ n }}& | python3 swh/web/manage.py runserver --nostatic --settings=swh.web.settings.tests 0.0.0.0:500{{ n }}& | ||||
wait-for-it -t 90 localhost:500{{ n }} | wait-for-it -t 90 localhost:500{{ n }} | ||||
# execute cypress tests | # execute cypress tests | ||||
yarn run cypress run --record --key swh-web --parallel --config baseUrl=http://localhost:500{{ n }} --ci-build-id $SORRY_CYPRESS_BUILD_ID | yarn run cypress run --record --key swh-web --parallel --config baseUrl=http://localhost:500{{ n }} --ci-build-id $SORRY_CYPRESS_BUILD_ID | ||||
# copy nyc coverage outputs to dedicated merge folders for later processing | # copy nyc coverage outputs to dedicated merge folders for later processing | ||||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |