From 56903fcfece73ef2b3cb887c0edafa00bde0654d Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Wed, 17 Oct 2018 13:33:22 +0200 Subject: [PATCH] :white_check_mark: Ajoute un test end to end pour la sauvegarde de la simulation --- cypress/integration/embauche/embauche.js | 15 +++++++++++++++ index.html | 5 +---- source/reducers/rootReducer.js | 3 ++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/cypress/integration/embauche/embauche.js b/cypress/integration/embauche/embauche.js index 38c855da4..767981748 100644 --- a/cypress/integration/embauche/embauche.js +++ b/cypress/integration/embauche/embauche.js @@ -28,6 +28,21 @@ describe('Landing basic test', function() { }) }) +describe('Simulation saving test', function() { + it('should save the current simulation', function() { + cy.visit('/') + salaryInput('Salaire net').type('5471') + cy.contains('Autres').click() + cy.contains('passer').click() + cy.contains('passer').click() + // Wanted to use cypress.clock(), but can't because of piwik changing Date prototype (!) + cy.wait(1100) + cy.visit('/') + cy.contains('Retrouver ma simulation').click() + salaryInput('Salaire net').should('have.value', '5471') + }) +}) + describe('Iframe integration test', function() { it('should display an iframe of the simulateur', function() { cy.visit('/integration-test') diff --git a/index.html b/index.html index fcdf8c847..cf2a28d24 100644 --- a/index.html +++ b/index.html @@ -160,15 +160,12 @@ - + diff --git a/source/reducers/rootReducer.js b/source/reducers/rootReducer.js index ee1724a28..f8bd01831 100644 --- a/source/reducers/rootReducer.js +++ b/source/reducers/rootReducer.js @@ -19,8 +19,8 @@ import computeThemeColours from 'Ui/themeColours' import { simulationTargetNames } from '../config.js' import defaultLang from '../i18n' import inFranceAppReducer from './inFranceAppReducer' +import storageReducer from './storageReducer' import type { Action } from 'Types/ActionsTypes' - // TODO : use context API instead function themeColours(state = computeThemeColours(), { type, colour }) { if (type == 'CHANGE_THEME_COLOUR') return computeThemeColours(colour) @@ -160,6 +160,7 @@ const existingCompanyReducer = (state, action) => { } export default reduceReducers( existingCompanyReducer, + storageReducer, combineReducers({ sessionId: defaultTo(Math.floor(Math.random() * 1000000000000) + ''), // this is handled by redux-form, pas touche !