Merge pull request #12285 from overleaf/jpa-parallel-cypress-tests

[web] run core and module cypress tests in parallel

GitOrigin-RevId: d71fb94d05a8c554623e401bec8fffca5417177b
This commit is contained in:
Jakob Ackermann 2023-03-20 10:14:49 +00:00 committed by Copybot
parent ccb0841a50
commit 3a071c247a
3 changed files with 26 additions and 2 deletions

View file

@ -146,6 +146,26 @@ test_frontend_ct:
COMPOSE_PROJECT_NAME=frontend_test_ct_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) run --rm test_frontend_ct
COMPOSE_PROJECT_NAME=frontend_test_ct_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
# Note: The below cypress targets are for CI only
build_test_frontend_ct:
COMPOSE_PROJECT_NAME=frontend_test_ct_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) build test_frontend_ct
# Note: The 2nd build should use the cache from the 1st build.
COMPOSE_PROJECT_NAME=frontend_test_ct_modules_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) build test_frontend_ct
test_frontend_ct_core: export CYPRESS_RESULTS=./cypress/results/core
test_frontend_ct_core: export CYPRESS_SPEC_PATTERN=./test/frontend/**/*.spec.{js,ts,tsx}
test_frontend_ct_core:
COMPOSE_PROJECT_NAME=frontend_test_ct_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
COMPOSE_PROJECT_NAME=frontend_test_ct_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) run --rm test_frontend_ct
COMPOSE_PROJECT_NAME=frontend_test_ct_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
test_frontend_ct_modules: export CYPRESS_RESULTS=./cypress/results/modules
test_frontend_ct_modules: export CYPRESS_SPEC_PATTERN=./modules/**/test/frontend/**/*.spec.{js,ts,tsx}
test_frontend_ct_modules:
COMPOSE_PROJECT_NAME=frontend_test_ct_modules_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
COMPOSE_PROJECT_NAME=frontend_test_ct_modules_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) run --rm test_frontend_ct
COMPOSE_PROJECT_NAME=frontend_test_ct_modules_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
#
# Acceptance tests
#

View file

@ -18,7 +18,9 @@ export default defineConfig({
setupNodeEvents(on, config) {
//
},
specPattern: './{test,modules/**/test}/frontend/**/*.spec.{js,ts,tsx}',
specPattern:
process.env.CYPRESS_SPEC_PATTERN ||
'./{test,modules/**/test}/frontend/**/*.spec.{js,ts,tsx}',
},
retries: {
runMode: 3,

View file

@ -74,8 +74,10 @@ services:
CYPRESS_IMAGE: $CYPRESS_IMAGE
working_dir: /overleaf/services/web
entrypoint: bash
environment:
CYPRESS_SPEC_PATTERN: ${CYPRESS_SPEC_PATTERN:-}
volumes:
- ./cypress/results:/overleaf/services/web/cypress/results/
- ${CYPRESS_RESULTS:-./cypress/results}:/overleaf/services/web/cypress/results/
command:
- "-c"
- "if npm run cypress:run-ct; then exit 0; else mkdir -p ./cypress/results && touch ./cypress/results/.cypress_fail; fi;"