Commit 20d59bb5 authored by Cédric Girardot's avatar Cédric Girardot

Tests : Ajoute le chargement des fixtures depuis les tests Cypress

Change-Id: I2bcc367af7a0403051ce5c0c0a305d214a699c00
parent 6f32586a
# Environment (dev, prod, etc...)
ENVIRONMENT=prod
COMPOSE_PROJECT_NAME=depnot
PHP_VERSION=7.3
COMPOSER_VERSION=1.10
NODE_VERSION=12
......@@ -29,3 +31,6 @@ SENDER_NAME=Test application notaires
# Timezone
TIMEZONE=Europe/Paris
# Docker socket
DOCKER_SOCK=/var/run/docker.sock
......@@ -128,9 +128,9 @@ e2e-test:
symfony server:start -d
cd tests/E2E
yarn
cypress run --spec "cypress/integration/1-login.spec.js,cypress/integration/2-params.spec.js,cypress/integration/3-search-empty-db.spec.js"
cypress run --spec "cypress/integration/EmptyDB/*"
../../bin/console import:individus imports/individus.csv --no-interaction --quiet
cypress run --spec "cypress/integration/4-search.spec.js,cypress/integration/5-create-users.spec.js,cypress/integration/6-create-instructors.spec.js,cypress/integration/7-stats.spec.js"
cypress run --spec "cypress/integration/FullDB/*"
build-app:
stage: build
......
......@@ -106,11 +106,11 @@ pipeline {
sh 'bin/console user:add --username=admin --password=P@ssword12345 --email=admin@notaires.test --name=Administrateur --role=ROLE_ADMIN --no-interaction'
dir('tests/E2E') {
sh 'yarn'
sh 'cypress run --spec "cypress/integration/1-login.spec.js,cypress/integration/2-params.spec.js,cypress/integration/3-search-empty-db.spec.js"'
sh 'cypress run --spec "cypress/integration/EmptyDB/*"'
}
sh 'bin/console import:individus imports/individus.csv --no-interaction --quiet'
dir('tests/E2E') {
sh "CYPRESS_mailhogUrl=\"http://${hostIp(mail)}:8025\" cypress run --spec \"cypress/integration/4-search.spec.js,cypress/integration/5-create-users.spec.js,cypress/integration/6-create-instructors.spec.js,cypress/integration/7-stats.spec.js\""
sh "CYPRESS_mailhogUrl=\"http://${hostIp(mail)}:8025\" cypress run --spec \"cypress/integration/FullDB/*\""
}
}
}
......
......@@ -15,6 +15,13 @@ describe('Connexion avec CSRF', () => {
inAdministration()
}
if (Cypress.env('ENVIRONMENT') === 'dev') {
before(() => {
// On rempli la base de données (sans individu)
cy.exec("cd /srv && docker-compose exec -T php /entrypoint ./bin/console doctrine:fixture:load --no-interaction --group=without_persons")
})
}
beforeEach(function () {
cy.fixture('user-admin')
.then((user) => {
......
......@@ -5,6 +5,13 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})
describe('Paramètres de l\'application', () => {
if (Cypress.env('ENVIRONMENT') === 'dev') {
before(() => {
// On rempli la base de données (sans individu)
cy.exec("cd /srv && docker-compose exec -T php /entrypoint ./bin/console doctrine:fixture:load --no-interaction --group=without_persons")
})
}
beforeEach(function () {
cy.fixture('user-admin')
.then((user) => {
......
......@@ -5,6 +5,13 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})
describe('Recherche avec table individu vide', () => {
if (Cypress.env('ENVIRONMENT') === 'dev') {
before(() => {
// On rempli la base de données (sans individu)
cy.exec("cd /srv && docker-compose exec -T php /entrypoint ./bin/console doctrine:fixture:load --no-interaction --group=without_persons")
})
}
beforeEach(function () {
cy.fixture('user-admin')
.then((user) => {
......
......@@ -5,6 +5,13 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})
describe('Recherche', () => {
if (Cypress.env('ENVIRONMENT') === 'dev') {
before(() => {
// On rempli la base de données
cy.exec("cd /srv && docker-compose exec -T php /entrypoint ./bin/console doctrine:fixture:load --no-interaction --group=use_name")
})
}
beforeEach(function () {
cy.fixture('user-admin')
.then((user) => {
......
......@@ -5,6 +5,13 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})
describe('Création d\'utilisateurs', () => {
if (Cypress.env('ENVIRONMENT') === 'dev') {
before(() => {
// On rempli la base de données
cy.exec("cd /srv && docker-compose exec -T php /entrypoint ./bin/console doctrine:fixture:load --no-interaction --group=use_name")
})
}
beforeEach(function () {
cy.fixture('user-admin')
.then((user) => {
......
......@@ -5,6 +5,13 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})
describe('Création d\'instructeurs', () => {
if (Cypress.env('ENVIRONMENT') === 'dev') {
before(() => {
// On rempli la base de données
cy.exec("cd /srv && docker-compose exec -T php /entrypoint ./bin/console doctrine:fixture:load --no-interaction --group=use_name")
})
}
beforeEach(function () {
cy.fixture('user-admin')
.then((user) => {
......
......@@ -5,6 +5,13 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})
describe('Page des stats', () => {
if (Cypress.env('ENVIRONMENT') === 'dev') {
before(() => {
// On rempli la base de données
cy.exec("cd /srv && docker-compose exec -T php /entrypoint ./bin/console doctrine:fixture:load --no-interaction --group=use_name")
})
}
beforeEach(function () {
cy.fixture('user-admin')
.then((user) => {
......
......@@ -7,6 +7,13 @@ Cypress.on('uncaught:exception', (err, runnable) => {
describe('Alerte décès', () => {
let deatAlertMail = 'alerte-deces@notaire.fr'
if (Cypress.env('ENVIRONMENT') === 'dev') {
before(() => {
// On rempli la base de données
cy.exec("cd /srv && docker-compose exec -T php /entrypoint ./bin/console doctrine:fixture:load --no-interaction --group=use_name")
})
}
beforeEach(function () {
cy.fixture('user-admin')
.then((user) => {
......
......@@ -2,8 +2,5 @@
set -e
xhost +
bin/console doctrine:fixture:load --group=without_persons --no-interaction
docker-compose run --rm --entrypoint "cypress run --project /e2e --spec \"/e2e/cypress/integration/1-login.spec.js,/e2e/cypress/integration/2-params.spec.js,/e2e/cypress/integration/3-search-empty-db.spec.js\"" e2e
bin/console doctrine:fixture:load --group=use_name --no-interaction
docker-compose run --rm --no-deps --entrypoint "cypress run --project /e2e --spec \"/e2e/cypress/integration/4-search.spec.js,/e2e/cypress/integration/5-create-users.spec.js,/e2e/cypress/integration/6-create-instructors.spec.js,/e2e/cypress/integration/7-stats.spec.js,/e2e/cypress/integration/8-death-alert.spec.js\"" e2e
docker-compose run --rm --entrypoint "cypress run --project /srv/appli_sf/tests/E2E --env ENVIRONMENT=dev" e2e
xhost -
......@@ -2,6 +2,5 @@
set -e
xhost +
bin/console doctrine:fixture:load --group=use_name --no-interaction
docker-compose run --rm --entrypoint "cypress open --project /e2e" e2e
docker-compose run --rm --entrypoint "cypress open --project /srv/appli_sf/tests/E2E --env ENVIRONMENT=dev" e2e
xhost -
......@@ -77,7 +77,8 @@ services:
- ./appli_sf/:/srv/
e2e:
image: cypress/included:4.11.0
build:
context: ./docker/cypress
depends_on:
- http
- database
......@@ -88,10 +89,10 @@ services:
DISPLAY: unix$DISPLAY
CYPRESS_baseUrl: http://${HTTP_HOSTNAME}
CYPRESS_mailhogUrl: http://mail:${MAILER_CLIENT_PORT:-8025}
working_dir: /e2e
volumes:
- ./appli_sf/tests/E2E/:/e2e
- ./:/srv/
- /tmp/.X11-unix:/tmp/.X11-unix
- ${DOCKER_SOCK}:/var/run/docker.sock
volumes:
database: ~
FROM cypress/included:4.11.0
RUN apt-get update && \
apt-get install --no-install-recommends -y \
docker.io docker-compose
......@@ -43,6 +43,8 @@ RUN set -eux; \
libxtst6 \
xauth \
xvfb \
docker.io \
docker-compose \
jq; \
echo "ServerName localhost" >> /etc/apache2/apache2.conf;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment