Skip to content

Commit

Permalink
Merge branch 'e2e-tests'
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbuks committed Jul 3, 2024
2 parents 5ab5853 + 070596c commit 23d7796
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ variables:
NOTIFY_CHANNEL: ${KCHAT_WHOOK_URL}/986f3435-6c53-4648-a86c-33c64fc14daf

# REFERENCES
# Triggered on every commit
# Ref. https://stackoverflow.com/a/70940590
.rule-commit: &rule-commit
# Stop the execution when a new branch is created
- if: $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"
when: never
# Trigger when a commit happens on branch
- if: $CI_PIPELINE_SOURCE == "push"

# Preprod deployments when there is a tag ending with "-rc.[...]"
.rule-preprod: &rule-preprod
- if: &if-preprod "$CI_COMMIT_TAG =~ /\\-rc.*/"
Expand Down Expand Up @@ -223,6 +232,25 @@ build:image:
--dockerfile ${CI_PROJECT_DIR}/Dockerfile
--destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}

# Triggers e2e tests
# Parse staging base URL and store in dotenv artifact
build:e2e:
stage: build
extends:
- .tests
image: ruby:${RUBY_VERSION}
rules:
- if: *if-merge-request
when: manual
- when: never
script:
- echo "STAGING_BASE_URL=$(ruby .gitlab/get_staging_baseurl.rb)" >> test.env
# Pass env variables to Playwright/Cypress
# https://docs.gitlab.com/ee/ci/variables/index.html#pass-an-environment-variable-to-another-job
artifacts:
reports:
dotenv: test.env

# Execute tsc
# test:tsc:
# stage: test
Expand All @@ -237,6 +265,9 @@ test:unit:
stage: test
extends:
- .tests-node
rules:
- *rule-commit
- when: never
script:
- yarn test:webapp
# Save coverage report
Expand All @@ -255,33 +286,14 @@ test:unit:
- *cache-jest
# - *cache-yarn

# Triggers e2e tests
# Parse staging base URL and store in dotenv artifact
test:e2e:
stage: test
extends:
- .tests
image: ruby:${RUBY_VERSION}
rules:
- if: *if-merge-request
when: manual
- when: never
script:
- echo "STAGING_BASE_URL=$(ruby .gitlab/get_staging_baseurl.rb)" >> test.env
# Pass env variables to Playwright/Cypress
# https://docs.gitlab.com/ee/ci/variables/index.html#pass-an-environment-variable-to-another-job
artifacts:
reports:
dotenv: test.env

# Execute playwright tests
test:e2e:pw:
stage: test
extends:
- .tests-node
image: mcr.microsoft.com/playwright:${PLAYWRIGHT_VERSION}
allow_failure: true
needs: ["test:e2e"]
needs: ["build:e2e"]
variables:
PW_BASE_URL: ${STAGING_BASE_URL} # From test:e2e - dotenv
PW_ADMIN_EMAIL: ${E2E_ADMIN_EMAIL}
Expand Down

0 comments on commit 23d7796

Please sign in to comment.