Ajoute des tests E2E pour les simulateurs PAM
parent
a56237c2ae
commit
3ace9da67d
|
@ -5,98 +5,107 @@ describe('Simulateurs', function() {
|
|||
if (!fr) {
|
||||
return
|
||||
}
|
||||
;['indépendant', 'assimilé-salarié', 'auto-entrepreneur', 'salarié'].forEach(
|
||||
simulateur =>
|
||||
describe(simulateur, () => {
|
||||
before(() => cy.visit(`/simulateurs/${simulateur}`))
|
||||
it('should not crash', function() {
|
||||
cy.get(inputSelector)
|
||||
})
|
||||
;[
|
||||
'indépendant',
|
||||
'dirigeant-sasu',
|
||||
'auto-entrepreneur',
|
||||
'salarié',
|
||||
'profession-liberale',
|
||||
'profession-liberale/medecin',
|
||||
'profession-liberale/sage-femme',
|
||||
'profession-liberale/auxiliaire-médical',
|
||||
'profession-liberale/chirurgien-dentiste'
|
||||
].forEach(simulateur =>
|
||||
describe(simulateur, () => {
|
||||
before(() => cy.visit(`/simulateurs/${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('€/an').click()
|
||||
if (['indépendant', 'assimilé-salarié'].includes(simulateur)) {
|
||||
cy.get(chargeInputSelector).type(1000)
|
||||
}
|
||||
cy.get(inputSelector).each((testedInput, i) => {
|
||||
cy.wrap(testedInput).type('{selectall}60000')
|
||||
cy.wait(1500)
|
||||
cy.contains('Cotisations')
|
||||
cy.get(inputSelector).each(($input, j) => {
|
||||
const val = $input.val().replace(/[\s,.]/g, '')
|
||||
if (i != j) {
|
||||
expect(val).not.to.be.eq('60000')
|
||||
}
|
||||
expect(val).to.match(/[1-9][\d]{3,6}$/)
|
||||
})
|
||||
it('should display a result when entering a value in any of the currency input', () => {
|
||||
cy.contains('€/an').click()
|
||||
if (['indépendant', 'assimilé-salarié'].includes(simulateur)) {
|
||||
cy.get(chargeInputSelector).type(1000)
|
||||
}
|
||||
cy.get(inputSelector).each((testedInput, i) => {
|
||||
cy.wrap(testedInput).type('{selectall}60003')
|
||||
cy.wait(1500)
|
||||
cy.contains('Cotisations')
|
||||
cy.get(inputSelector).each(($input, j) => {
|
||||
const val = $input.val().replace(/[\s,.]/g, '')
|
||||
if (i != j) {
|
||||
expect(val).not.to.be.eq('60003')
|
||||
}
|
||||
expect(val).to.match(/[1-9][\d]{3,6}$/)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('should allow to change period', function() {
|
||||
cy.contains('€/an').click()
|
||||
cy.wait(200)
|
||||
it('should allow to change period', function() {
|
||||
cy.contains('€/an').click()
|
||||
cy.wait(200)
|
||||
cy.get(inputSelector)
|
||||
.first()
|
||||
.type('{selectall}12000')
|
||||
if (['indépendant', 'assimilé-salarié'].includes(simulateur)) {
|
||||
cy.get(chargeInputSelector).type('{selectall}6000')
|
||||
}
|
||||
cy.wait(800)
|
||||
cy.contains('€/mois').click()
|
||||
cy.get(inputSelector)
|
||||
.first()
|
||||
.invoke('val')
|
||||
.should('match', /1[\s]000/)
|
||||
if (['indépendant', 'assimilé-salarié'].includes(simulateur)) {
|
||||
cy.get(chargeInputSelector)
|
||||
.first()
|
||||
.invoke('val')
|
||||
.should('be', '500')
|
||||
}
|
||||
})
|
||||
|
||||
it('should allow to navigate to a documentation page', function() {
|
||||
cy.get(inputSelector)
|
||||
.first()
|
||||
.type('{selectall}2000')
|
||||
cy.wait(700)
|
||||
cy.contains('Cotisations').click()
|
||||
cy.location().should(loc => {
|
||||
expect(loc.pathname).to.match(/\/documentation\/.*\/cotisations/)
|
||||
})
|
||||
})
|
||||
|
||||
it('should allow to go back to the simulation', function() {
|
||||
cy.contains('← ').click()
|
||||
cy.get(inputSelector)
|
||||
.first()
|
||||
.invoke('val')
|
||||
.should('be', '2 000')
|
||||
})
|
||||
|
||||
if (simulateur === 'auto-entrepreneur') {
|
||||
it('should allow to enter the date of creation', () => {
|
||||
cy.get(inputSelector)
|
||||
.first()
|
||||
.type('{selectall}12000')
|
||||
if (['indépendant', 'assimilé-salarié'].includes(simulateur)) {
|
||||
cy.get(chargeInputSelector).type('{selectall}6000')
|
||||
}
|
||||
cy.wait(800)
|
||||
.type('{selectall}50000')
|
||||
cy.contains('Passer').click()
|
||||
cy.contains('Passer').click()
|
||||
cy.contains('Début 2020').click()
|
||||
cy.contains('ACRE')
|
||||
})
|
||||
it('should not have negative value', () => {
|
||||
cy.contains('€/mois').click()
|
||||
cy.get(inputSelector)
|
||||
.first()
|
||||
.invoke('val')
|
||||
.should('match', /1[\s]000/)
|
||||
if (['indépendant', 'assimilé-salarié'].includes(simulateur)) {
|
||||
cy.get(chargeInputSelector)
|
||||
.first()
|
||||
.invoke('val')
|
||||
.should('be', '500')
|
||||
}
|
||||
})
|
||||
|
||||
it('should allow to navigate to a documentation page', function() {
|
||||
cy.get(inputSelector)
|
||||
.first()
|
||||
.type('{selectall}2000')
|
||||
cy.wait(700)
|
||||
cy.contains('Cotisations').click()
|
||||
cy.location().should(loc => {
|
||||
expect(loc.pathname).to.match(/\/documentation\/.*\/cotisations/)
|
||||
.type('{selectall}5000')
|
||||
cy.wait(800)
|
||||
cy.get(inputSelector).each($input => {
|
||||
const val = +$input.val().replace(/[\s,.]/g, '')
|
||||
expect(val).not.to.be.below(4000)
|
||||
})
|
||||
})
|
||||
|
||||
it('should allow to go back to the simulation', function() {
|
||||
cy.contains('← ').click()
|
||||
cy.get(inputSelector)
|
||||
.first()
|
||||
.invoke('val')
|
||||
.should('be', '2 000')
|
||||
})
|
||||
|
||||
if (simulateur === 'auto-entrepreneur') {
|
||||
it('should allow to enter the date of creation', () => {
|
||||
cy.get(inputSelector)
|
||||
.first()
|
||||
.type('{selectall}50000')
|
||||
cy.contains('Passer').click()
|
||||
cy.contains('Passer').click()
|
||||
cy.contains('Début 2020').click()
|
||||
cy.contains('ACRE')
|
||||
})
|
||||
it('should not have negative value', () => {
|
||||
cy.contains('€/mois').click()
|
||||
cy.get(inputSelector)
|
||||
.first()
|
||||
.type('{selectall}5000')
|
||||
cy.wait(800)
|
||||
cy.get(inputSelector).each($input => {
|
||||
const val = +$input.val().replace(/[\s,.]/g, '')
|
||||
expect(val).not.to.be.below(4000)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
|
|
|
@ -126,6 +126,11 @@ async function fetchSimulators(dt) {
|
|||
'/dirigeant-sasu',
|
||||
'/aide-declaration-independants',
|
||||
'/demande-mobilité',
|
||||
'/profession-liberale',
|
||||
'/profession-liberale/medecin',
|
||||
'/profession-liberale/auxiliaire-médical',
|
||||
'/profession-liberale/sage-femme',
|
||||
'/profession-liberale/chirugien-dentiste',
|
||||
'/économie-collaborative'
|
||||
].includes(label)
|
||||
)
|
||||
|
@ -161,7 +166,11 @@ async function fetchSimulators(dt) {
|
|||
'/simulateur-assimilesalarie',
|
||||
'/simulateur-artiste-auteur',
|
||||
'/simulateur-independant',
|
||||
'/demande-mobilite'
|
||||
'/demande-mobilite',
|
||||
'/profession-liberale',
|
||||
'/chirugien-dentiste',
|
||||
'/auxiliaire-médical',
|
||||
'/sage-femme'
|
||||
].some(path => x.label.startsWith(path))
|
||||
)
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ export default function Landing() {
|
|||
<header>
|
||||
<h1>
|
||||
<Trans i18nKey="landing.title">
|
||||
L'assistant officiel du créateur d'entreprise
|
||||
L'assistant officiel de l'entrepreneur
|
||||
</Trans>
|
||||
</h1>
|
||||
<p className="ui__ lead">
|
||||
|
|
Loading…
Reference in New Issue