|
|
|
@ -5,16 +5,18 @@ const chargeInputSelector =
|
|
|
|
|
const fr = Cypress.env('language') === 'fr'
|
|
|
|
|
|
|
|
|
|
export const runSimulateurTest = (simulateur) => {
|
|
|
|
|
if (!fr) return
|
|
|
|
|
|
|
|
|
|
describe(`Simulateur ${simulateur}`, () => {
|
|
|
|
|
before(() => cy.visit(encodeURI(`/simulateurs/${simulateur}`)))
|
|
|
|
|
before(() =>
|
|
|
|
|
cy.visit(
|
|
|
|
|
encodeURI(`/${fr ? 'simulateurs' : 'calculators'}/${simulateur}`)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
it('should not crash', function () {
|
|
|
|
|
cy.get(inputSelector)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('should display a result when entering a value in any of the currency input', () => {
|
|
|
|
|
cy.contains('Annuel').click()
|
|
|
|
|
cy.contains(fr ? 'Annuel' : 'Yearly').click()
|
|
|
|
|
if (['indépendant', 'profession-liberale'].includes(simulateur)) {
|
|
|
|
|
cy.get(chargeInputSelector).type(1000)
|
|
|
|
|
}
|
|
|
|
@ -32,31 +34,31 @@ export const runSimulateurTest = (simulateur) => {
|
|
|
|
|
expect(val).to.match(/[1-9][\d]{3,6}$/)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
cy.contains('Cotisations')
|
|
|
|
|
cy.contains(fr ? 'Cotisations' : 'contributions')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('should allow to change period', function () {
|
|
|
|
|
cy.contains('Annuel').click()
|
|
|
|
|
cy.contains(fr ? 'Annuel' : 'Yearly').click()
|
|
|
|
|
cy.get(inputSelector).first().type('{selectall}12000')
|
|
|
|
|
if (['indépendant', 'profession-liberale'].includes(simulateur)) {
|
|
|
|
|
cy.get(chargeInputSelector).type('{selectall}6000')
|
|
|
|
|
}
|
|
|
|
|
cy.get(inputSelector).eq(1).invoke('val').should('not.be.empty')
|
|
|
|
|
cy.contains('Mensuel').click()
|
|
|
|
|
cy.contains(fr ? 'Mensuel' : 'Monthly').click()
|
|
|
|
|
cy.get(inputSelector)
|
|
|
|
|
.first()
|
|
|
|
|
.invoke('val')
|
|
|
|
|
.should('match', /1[\s]000/)
|
|
|
|
|
.should('match', /1[\s,]000/)
|
|
|
|
|
if (['indépendant', 'profession-liberale'].includes(simulateur)) {
|
|
|
|
|
cy.get(chargeInputSelector).first().invoke('val').should('match', /500/)
|
|
|
|
|
}
|
|
|
|
|
cy.contains('Annuel').click()
|
|
|
|
|
cy.contains(fr ? 'Annuel' : 'Yearly').click()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('should allow to navigate to a documentation page', function () {
|
|
|
|
|
cy.get(inputSelector).first().type('{selectall}2000')
|
|
|
|
|
cy.contains('Cotisations').click()
|
|
|
|
|
cy.contains(fr ? 'Cotisations' : /(c|C)ontributions/).click()
|
|
|
|
|
cy.location().should((loc) => {
|
|
|
|
|
expect(loc.pathname).to.match(/\/documentation\/.*\/cotisations/)
|
|
|
|
|
})
|
|
|
|
|