From ecd53e3a5dd48016c88b49dfc373fd518183039a Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Fri, 16 Feb 2024 16:19:07 +0100 Subject: [PATCH] test: add test for #2863 --- .../mon-entreprise/simulateur-independant.ts | 25 +++++++++++++++++++ site/cypress/support/utils.ts | 9 +------ .../components/EngineValue/WhenApplicable.tsx | 9 ++++--- .../components/conversation/RuleInput.tsx | 1 - 4 files changed, 31 insertions(+), 13 deletions(-) create mode 100755 site/cypress/integration/mon-entreprise/simulateur-independant.ts diff --git a/site/cypress/integration/mon-entreprise/simulateur-independant.ts b/site/cypress/integration/mon-entreprise/simulateur-independant.ts new file mode 100755 index 000000000..9c8f07713 --- /dev/null +++ b/site/cypress/integration/mon-entreprise/simulateur-independant.ts @@ -0,0 +1,25 @@ +import { checkA11Y, fr } from '../../support/utils' + +describe('Simulateur indépendant', { testIsolation: false }, function () { + if (!fr) { + return + } + + const inputSelector = 'div[id="simulator-legend"] input[inputmode="numeric"]' + + before(function () { + return cy.visit('/simulateurs/indépendant') + }) + + it('should not display info about cotisations forfaitaires début activité by default', function () { + cy.get(inputSelector).first().type('{selectall}50000') + cy.contains( + 'Comment fonctionne la régularisation des cotisations provisionnelles' + ) + cy.contains('Montant des cotisations forfaitaires').should('not.exist') + }) + + it('should be RGAA compliant', function () { + checkA11Y() + }) +}) diff --git a/site/cypress/support/utils.ts b/site/cypress/support/utils.ts index 0f1107479..707546f2f 100644 --- a/site/cypress/support/utils.ts +++ b/site/cypress/support/utils.ts @@ -7,14 +7,7 @@ type ViolationType = { export const checkA11Y = () => { cy.injectAxe() - cy.configureAxe({ - rules: [ - { - id: 'color-contrast', - enabled: false, - }, - ], - }) + cy.configureAxe({}) cy.checkA11y( null, null, diff --git a/site/source/components/EngineValue/WhenApplicable.tsx b/site/source/components/EngineValue/WhenApplicable.tsx index 83b5f86bd..2ec0f9558 100644 --- a/site/source/components/EngineValue/WhenApplicable.tsx +++ b/site/source/components/EngineValue/WhenApplicable.tsx @@ -16,10 +16,11 @@ export function WhenApplicable({ const defaultEngine = useEngine() const engineValue = engine ?? defaultEngine - - if ( - engineValue.evaluate({ 'est applicable': dottedName }).nodeValue !== true - ) { + const applicable = engineValue.evaluate({ + 'est applicable': dottedName, + }).nodeValue + console.log(dottedName, applicable) + if (applicable !== true) { return null } diff --git a/site/source/components/conversation/RuleInput.tsx b/site/source/components/conversation/RuleInput.tsx index efae2a308..58ba301e7 100644 --- a/site/source/components/conversation/RuleInput.tsx +++ b/site/source/components/conversation/RuleInput.tsx @@ -131,7 +131,6 @@ export default function RuleInput({ ['radio', 'card', 'toggle', 'select'].includes(meta.affichage) ? (meta.affichage as 'radio' | 'card' | 'toggle' | 'select') : 'radio') - console.log(value, missing, dottedName) return ( <>