From 4075b90bf0a1bcf1dc1324d89b53e8775223f479 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Girardot?= <cgi@atolcd.com>
Date: Wed, 2 Sep 2020 10:39:40 +0200
Subject: [PATCH] =?UTF-8?q?Refactor=20:=20D=C3=A9place=20"preserve=20cooki?=
 =?UTF-8?q?e"=20dans=20support/index.js?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Change-Id: Ie5620b4200a5b5b04907d8bd61af885784b0311d
---
 .../tests/E2E/cypress/integration/EmptyDB/1-login.spec.js  | 6 ------
 .../tests/E2E/cypress/integration/EmptyDB/2-params.spec.js | 7 -------
 .../cypress/integration/EmptyDB/3-search-empty-db.spec.js  | 7 -------
 .../tests/E2E/cypress/integration/FullDB/4-search.spec.js  | 7 -------
 .../E2E/cypress/integration/FullDB/5-create-users.spec.js  | 7 -------
 .../integration/FullDB/6-create-instructors.spec.js        | 7 -------
 .../tests/E2E/cypress/integration/FullDB/7-stats.spec.js   | 7 -------
 .../E2E/cypress/integration/FullDB/8-death-alert.spec.js   | 7 -------
 appli_sf/tests/E2E/cypress/support/index.js                | 5 +++++
 9 files changed, 5 insertions(+), 55 deletions(-)

diff --git a/appli_sf/tests/E2E/cypress/integration/EmptyDB/1-login.spec.js b/appli_sf/tests/E2E/cypress/integration/EmptyDB/1-login.spec.js
index 24f7808b..1b0647ac 100644
--- a/appli_sf/tests/E2E/cypress/integration/EmptyDB/1-login.spec.js
+++ b/appli_sf/tests/E2E/cypress/integration/EmptyDB/1-login.spec.js
@@ -1,9 +1,3 @@
-Cypress.on('uncaught:exception', (err, runnable) => {
-    // returning false here prevents Cypress from
-    // failing the test
-    return false
-})
-
 describe('Connexion avec CSRF', () => {
     const inAdministration = () => {
         cy.location('href').should('match', /admin\/?$/)
diff --git a/appli_sf/tests/E2E/cypress/integration/EmptyDB/2-params.spec.js b/appli_sf/tests/E2E/cypress/integration/EmptyDB/2-params.spec.js
index 5f1d1509..d64a6ad2 100644
--- a/appli_sf/tests/E2E/cypress/integration/EmptyDB/2-params.spec.js
+++ b/appli_sf/tests/E2E/cypress/integration/EmptyDB/2-params.spec.js
@@ -1,9 +1,3 @@
-Cypress.on('uncaught:exception', (err, runnable) => {
-    // returning false here prevents Cypress from
-    // failing the test
-    return false
-})
-
 describe('Paramètres de l\'application', () => {
     if (Cypress.env('ENVIRONMENT') === 'dev') {
         before(() => {
@@ -17,7 +11,6 @@ describe('Paramètres de l\'application', () => {
             .then((user) => {
                 this.userAdmin = user
             })
-        Cypress.Cookies.preserveOnce('PHPSESSID')
     })
 
     it('Login', function () {
diff --git a/appli_sf/tests/E2E/cypress/integration/EmptyDB/3-search-empty-db.spec.js b/appli_sf/tests/E2E/cypress/integration/EmptyDB/3-search-empty-db.spec.js
index e6723e51..4cb80ef7 100644
--- a/appli_sf/tests/E2E/cypress/integration/EmptyDB/3-search-empty-db.spec.js
+++ b/appli_sf/tests/E2E/cypress/integration/EmptyDB/3-search-empty-db.spec.js
@@ -1,9 +1,3 @@
-Cypress.on('uncaught:exception', (err, runnable) => {
-    // returning false here prevents Cypress from
-    // failing the test
-    return false
-})
-
 describe('Recherche avec table individu vide', () => {
     if (Cypress.env('ENVIRONMENT') === 'dev') {
         before(() => {
@@ -17,7 +11,6 @@ describe('Recherche avec table individu vide', () => {
             .then((user) => {
                 this.userAdmin = user
             })
-        Cypress.Cookies.preserveOnce('PHPSESSID')
     })
 
     it('Login', function () {
diff --git a/appli_sf/tests/E2E/cypress/integration/FullDB/4-search.spec.js b/appli_sf/tests/E2E/cypress/integration/FullDB/4-search.spec.js
index 9466322f..c549d78c 100644
--- a/appli_sf/tests/E2E/cypress/integration/FullDB/4-search.spec.js
+++ b/appli_sf/tests/E2E/cypress/integration/FullDB/4-search.spec.js
@@ -1,9 +1,3 @@
-Cypress.on('uncaught:exception', (err, runnable) => {
-    // returning false here prevents Cypress from
-    // failing the test
-    return false
-})
-
 describe('Recherche', () => {
     if (Cypress.env('ENVIRONMENT') === 'dev') {
         before(() => {
@@ -17,7 +11,6 @@ describe('Recherche', () => {
             .then((user) => {
                 this.userAdmin = user
             })
-        Cypress.Cookies.preserveOnce('PHPSESSID')
         cy.deleteAllMails()
     })
 
diff --git a/appli_sf/tests/E2E/cypress/integration/FullDB/5-create-users.spec.js b/appli_sf/tests/E2E/cypress/integration/FullDB/5-create-users.spec.js
index 8c0514c4..b2c8dcd7 100644
--- a/appli_sf/tests/E2E/cypress/integration/FullDB/5-create-users.spec.js
+++ b/appli_sf/tests/E2E/cypress/integration/FullDB/5-create-users.spec.js
@@ -1,9 +1,3 @@
-Cypress.on('uncaught:exception', (err, runnable) => {
-    // returning false here prevents Cypress from
-    // failing the test
-    return false
-})
-
 describe('Création d\'utilisateurs', () => {
     if (Cypress.env('ENVIRONMENT') === 'dev') {
         before(() => {
@@ -17,7 +11,6 @@ describe('Création d\'utilisateurs', () => {
             .then((user) => {
                 this.userAdmin = user
             })
-        Cypress.Cookies.preserveOnce('PHPSESSID')
     })
 
     it('Login', function () {
diff --git a/appli_sf/tests/E2E/cypress/integration/FullDB/6-create-instructors.spec.js b/appli_sf/tests/E2E/cypress/integration/FullDB/6-create-instructors.spec.js
index 11a4a786..6da620fd 100644
--- a/appli_sf/tests/E2E/cypress/integration/FullDB/6-create-instructors.spec.js
+++ b/appli_sf/tests/E2E/cypress/integration/FullDB/6-create-instructors.spec.js
@@ -1,9 +1,3 @@
-Cypress.on('uncaught:exception', (err, runnable) => {
-    // returning false here prevents Cypress from
-    // failing the test
-    return false
-})
-
 describe('Création d\'instructeurs', () => {
     if (Cypress.env('ENVIRONMENT') === 'dev') {
         before(() => {
@@ -17,7 +11,6 @@ describe('Création d\'instructeurs', () => {
             .then((user) => {
                 this.userAdmin = user
             })
-        Cypress.Cookies.preserveOnce('PHPSESSID')
         cy.deleteAllMails()
     })
 
diff --git a/appli_sf/tests/E2E/cypress/integration/FullDB/7-stats.spec.js b/appli_sf/tests/E2E/cypress/integration/FullDB/7-stats.spec.js
index c0c16061..32510de4 100644
--- a/appli_sf/tests/E2E/cypress/integration/FullDB/7-stats.spec.js
+++ b/appli_sf/tests/E2E/cypress/integration/FullDB/7-stats.spec.js
@@ -1,9 +1,3 @@
-Cypress.on('uncaught:exception', (err, runnable) => {
-    // returning false here prevents Cypress from
-    // failing the test
-    return false
-})
-
 describe('Page des stats', () => {
     if (Cypress.env('ENVIRONMENT') === 'dev') {
         before(() => {
@@ -17,7 +11,6 @@ describe('Page des stats', () => {
             .then((user) => {
                 this.userAdmin = user
             })
-        Cypress.Cookies.preserveOnce('PHPSESSID')
     })
 
     it('Login', function () {
diff --git a/appli_sf/tests/E2E/cypress/integration/FullDB/8-death-alert.spec.js b/appli_sf/tests/E2E/cypress/integration/FullDB/8-death-alert.spec.js
index 1d54d79e..a13c1875 100644
--- a/appli_sf/tests/E2E/cypress/integration/FullDB/8-death-alert.spec.js
+++ b/appli_sf/tests/E2E/cypress/integration/FullDB/8-death-alert.spec.js
@@ -1,9 +1,3 @@
-Cypress.on('uncaught:exception', (err, runnable) => {
-    // returning false here prevents Cypress from
-    // failing the test
-    return false
-})
-
 describe('Alerte décès', () => {
     let deatAlertMail = 'alerte-deces@notaire.fr'
 
@@ -19,7 +13,6 @@ describe('Alerte décès', () => {
             .then((user) => {
                 this.userAdmin = user
             })
-        Cypress.Cookies.preserveOnce('PHPSESSID')
         cy.deleteAllMails()
     })
 
diff --git a/appli_sf/tests/E2E/cypress/support/index.js b/appli_sf/tests/E2E/cypress/support/index.js
index 0cff9543..2bce0126 100644
--- a/appli_sf/tests/E2E/cypress/support/index.js
+++ b/appli_sf/tests/E2E/cypress/support/index.js
@@ -19,3 +19,8 @@ import './commands'
 
 // Alternatively you can use CommonJS syntax:
 // require('./commands')
+
+Cypress.Cookies.defaults({
+    preserve: 'PHPSESSID'
+})
+
-- 
GitLab