tests: add e2e test for sponsorship #534
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: End-to-end tests | |
on: | |
push: | |
branches: | |
- "**" | |
- "!master" | |
env: | |
ACCESS_LOG_PATH: | |
PGUSER: api-auth | |
PGPASSWORD: api-auth | |
PGDATABASE: api-auth-test | |
PGHOST: 127.0.0.1 | |
PGPORT: 5432 | |
DATABASE_URL: postgres://api-auth:[email protected]:5432/api-auth-test | |
SENDINBLUE_API_KEY: ${{ secrets.SENDINBLUE_API_KEY }} | |
MONCOMPTEPRO_HOST: http://localhost:3000 | |
CYPRESS_MONCOMPTEPRO_HOST: http://localhost:3000 | |
DO_NOT_SEND_MAIL: "False" | |
DO_NOT_VALIDATE_MAIL: "True" | |
DO_NOT_RATE_LIMIT: "True" | |
DO_NOT_USE_ANNUAIRE_EMAILS: "True" | |
SESSION_COOKIE_SECRET: secret | |
DEBOUNCE_API_KEY: | |
SENTRY_DSN: | |
INSEE_CONSUMER_KEY: ${{ secrets.INSEE_CONSUMER_KEY }} | |
INSEE_CONSUMER_SECRET: ${{ secrets.INSEE_CONSUMER_SECRET }} | |
CYPRESS_MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }} | |
SECURE_COOKIES: "false" | |
SUPPORT_EMAIL_ADDRESS: "[email protected]" | |
jobs: | |
test: | |
strategy: | |
matrix: | |
e2e_test: | |
- join_collectivite_territoriale | |
- join_org_with_verified_domain | |
- signup_entreprise_unipersonnelle | |
- join_with_sponsorship | |
runs-on: ubuntu-20.04 | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
postgres: | |
image: postgres:12.12 | |
env: | |
POSTGRES_USER: ${{ env.PGUSER }} | |
POSTGRES_PASSWORD: ${{ env.PGPASSWORD }} | |
POSTGRES_DB: ${{ env.PGDATABASE }} | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- run: npm ci | |
- run: npm install cypress@12 | |
- run: npm run migrate up | |
- run: npm run load-ci-fixtures -- scripts/fixtures/${{ matrix.e2e_test }}.sql | |
- run: npm run update-organization-info -- 2000 | |
- name: Cypress run | |
uses: cypress-io/github-action@v5 | |
with: | |
wait-on: ${{ env.MONCOMPTEPRO_HOST }}/users/start-sign-in | |
build: npm run build | |
start: npm start | |
install: false | |
spec: cypress/e2e/${{ matrix.e2e_test }}.cy.js | |
env: | |
NODE_ENV: production | |
# TODO set only for join_collectivite_territoriale | |
TEST_CONTACT_EMAIL: "[email protected]" | |
# TODO for join_with_sponsorship only | |
BETA_TESTING_ORGANISATIONS_FOR_SPONSORSHIP: "13002526500013" | |
- run: npm run delete-database | |
# Store tests runs in case of failure | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-videos | |
path: cypress/videos |