From 603a13a7a008691c363e44b3ee3fbb520415dbac Mon Sep 17 00:00:00 2001 From: Alice Dahan Date: Tue, 4 Feb 2025 14:18:35 +0100 Subject: [PATCH] tests(AE): correction du test AE --- .../integration/mon-entreprise/lodeom.ts | 8 +++--- .../mon-entreprise/reduction-generale.ts | 8 +++--- .../mon-entreprise/simulateur-ae.ts | 25 ++++++++++++++++--- .../mon-entreprise/simulateur-salarie.ts | 10 ++++---- .../components/conversation/AnswerList.tsx | 2 +- 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/site/cypress/integration/mon-entreprise/lodeom.ts b/site/cypress/integration/mon-entreprise/lodeom.ts index e9bd81c13..7789d6636 100755 --- a/site/cypress/integration/mon-entreprise/lodeom.ts +++ b/site/cypress/integration/mon-entreprise/lodeom.ts @@ -64,11 +64,11 @@ describe('Simulateur lodeom', { testIsolation: false }, function () { cy.contains('Plus de 50 salariés').click() cy.contains('Modifier mes réponses').click() cy.get('div[data-cy="modal"]') - .eq(0) + .first() .contains('Effectif') .next() .contains('100') - cy.get('div[data-cy="modal"]').eq(0).contains('Fermer').click() + cy.get('div[data-cy="modal"]').first().contains('Fermer').click() cy.get( 'p[id="salarié___cotisations___exonérations___lodeom___montant-value"]' @@ -77,11 +77,11 @@ describe('Simulateur lodeom', { testIsolation: false }, function () { cy.contains('Moins de 50 salariés').click() cy.contains('Modifier mes réponses').click() cy.get('div[data-cy="modal"]') - .eq(0) + .first() .contains('Effectif') .next() .contains('10') - cy.get('div[data-cy="modal"]').eq(0).contains('Fermer').click() + cy.get('div[data-cy="modal"]').first().contains('Fermer').click() }) it('should allow to select a scale', function () { diff --git a/site/cypress/integration/mon-entreprise/reduction-generale.ts b/site/cypress/integration/mon-entreprise/reduction-generale.ts index 8bdef2a67..19df4d0e9 100755 --- a/site/cypress/integration/mon-entreprise/reduction-generale.ts +++ b/site/cypress/integration/mon-entreprise/reduction-generale.ts @@ -46,11 +46,11 @@ describe( cy.contains('Plus de 50 salariés').click() cy.contains('Modifier mes réponses').click() cy.get('div[data-cy="modal"]') - .eq(0) + .first() .contains('Effectif') .next() .contains('100') - cy.get('div[data-cy="modal"]').eq(0).contains('Fermer').click() + cy.get('div[data-cy="modal"]').first().contains('Fermer').click() cy.get( 'p[id="salarié___cotisations___exonérations___réduction_générale-value"]' @@ -59,11 +59,11 @@ describe( cy.contains('Moins de 50 salariés').click() cy.contains('Modifier mes réponses').click() cy.get('div[data-cy="modal"]') - .eq(0) + .first() .contains('Effectif') .next() .contains('10') - cy.get('div[data-cy="modal"]').eq(0).contains('Fermer').click() + cy.get('div[data-cy="modal"]').first().contains('Fermer').click() }) it('should allow to select an option for caisse de congés payés', function () { diff --git a/site/cypress/integration/mon-entreprise/simulateur-ae.ts b/site/cypress/integration/mon-entreprise/simulateur-ae.ts index 74944a114..b55a2596d 100755 --- a/site/cypress/integration/mon-entreprise/simulateur-ae.ts +++ b/site/cypress/integration/mon-entreprise/simulateur-ae.ts @@ -1,21 +1,27 @@ import { checkA11Y, fr } from '../../support/utils' -describe('Simulateur auto-entrepreneur', { testIsolation: false }, function () { +describe('Simulateur auto-entrepreneur', function () { if (!fr) { return } const inputSelector = 'div[id="simulator-legend"] input[inputmode="numeric"]' - before(function () { + beforeEach(function () { return cy.visit('/simulateurs/auto-entrepreneur') }) it('should allow to enter the date of creation', function () { cy.get(inputSelector).first().type('{selectall}50000') - cy.contains('button', 'Passer').click() - cy.contains('button', 'Passer').click() + cy.contains('Modifier mes réponses').click() + cy.get('div[data-cy="modal"]') + .first() + .contains('Date de création') + .next() + .click() cy.contains("Début d'année").click() + cy.get('div[data-cy="modal"]').contains('Fermer').click() + cy.contains('ACRE') }) @@ -44,6 +50,8 @@ describe('Simulateur auto-entrepreneur', { testIsolation: false }, function () { }) it('should display the correct CA when changing the second "Activité mixte"', function () { + cy.get(inputSelector).first().type('{selectall}5000') + cy.contains('Activité mixte').click() cy.get(inputSelector).eq(2).type('{selectall}5000') cy.get(inputSelector).first().should('have.value', '10 000 €') @@ -55,6 +63,12 @@ describe('Simulateur auto-entrepreneur', { testIsolation: false }, function () { .map((elem) => parseInt(elem.value.replace(/[\s,.€]/g, ''))) it('should display the correct results of "Activité mixte" when changing CA', function () { + cy.contains('Activité mixte').click() + cy.get(inputSelector).eq(1).type('{selectall}2500') + cy.get(inputSelector).eq(2).type('{selectall}5000') + cy.get(inputSelector).eq(3).type('{selectall}2500') + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(500) cy.get(inputSelector).first().type('{selectall}5000') cy.get(inputSelector).should(($elem) => { @@ -65,6 +79,9 @@ describe('Simulateur auto-entrepreneur', { testIsolation: false }, function () { }) it('should display the correct results of "Activité mixte" when changing "Revenu net Après impôt"', function () { + cy.get(inputSelector).first().type('{selectall}2500') + cy.contains('Activité mixte').click() + cy.get(inputSelector).eq(2).type('{selectall}2500') cy.get(inputSelector).last().type('{selectall}2500') cy.get(inputSelector).should(($elem) => { diff --git a/site/cypress/integration/mon-entreprise/simulateur-salarie.ts b/site/cypress/integration/mon-entreprise/simulateur-salarie.ts index bf26865fd..7517b5e5b 100644 --- a/site/cypress/integration/mon-entreprise/simulateur-salarie.ts +++ b/site/cypress/integration/mon-entreprise/simulateur-salarie.ts @@ -11,16 +11,16 @@ describe.skip('Simulateur salarié : part time contract', function () { cy.get('button').contains('SMIC').click() cy.contains('Modifier mes réponses').click() cy.get('div[data-cy="modal"]') - .eq(0) + .first() .contains('Temps partiel') .next() .find('button') .click() - cy.get('div[data-cy="modal"]').eq(1).contains('Fermer') - cy.get('div[data-cy="modal"]').eq(1).contains('Oui').click() - cy.get('div[data-cy="modal"]').eq(1).contains('Continuer').click() - cy.get('div[data-cy="modal"]').eq(0).contains('Fermer').click() + cy.get('div[data-cy="modal"]').last().contains('Fermer') + cy.get('div[data-cy="modal"]').last().contains('Oui').click() + cy.get('div[data-cy="modal"]').last().contains('Continuer').click() + cy.get('div[data-cy="modal"]').first().contains('Fermer').click() }) it('should permit selecting the smic before part-time contrat', function () { diff --git a/site/source/components/conversation/AnswerList.tsx b/site/source/components/conversation/AnswerList.tsx index 4c95531df..4c0359d95 100644 --- a/site/source/components/conversation/AnswerList.tsx +++ b/site/source/components/conversation/AnswerList.tsx @@ -318,7 +318,7 @@ function AnswerElement(rule: RuleNode) { dottedName={questionDottedName} onChange={handleChange} autoFocus - showSuggestions={false} + // showSuggestions={false} onSubmit={onClose} />