Skip to content

tests: add tests for api-sirene connector #566

tests: add tests for api-sirene connector

tests: add tests for api-sirene connector #566

Workflow file for this run

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_official_contact_domain
- join_collectivite_territoriale_official_contact_email
- join_org_with_verified_domain
- signup_entreprise_unipersonnelle
- join_with_sponsorship
- join_with_code_sent_to_official_contact_email
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 -- cypress/fixtures/${{ matrix.e2e_test }}.sql
- run: npm run update-organization-info -- 2000
- name: Dotenv Action
uses: falti/[email protected]
with:
path: cypress/env/${{ matrix.e2e_test }}.conf
export-variables: true
keys-case: bypass
- 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
- 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