Fix tests

pull/2787/head
Jérémy Rialland 2023-08-01 17:31:24 +02:00 committed by Jérémy Rialland
parent afdc4636c6
commit c063122184
5 changed files with 28 additions and 7 deletions

View File

@ -67,7 +67,7 @@ describe(
cy.contains('Non').click()
cy.focused().tab().type('Pouts')
cy.wait('@communes')
cy.focused().contains('65100').type('{enter}')
cy.contains('65100', { timeout: 10000 }).type('{enter}')
cy.focused().tab().type('{downarrow}')
cy.focused().tab().type('Brest')

View File

@ -80,7 +80,15 @@ describe(`Navigation to income simulator using company name (${
.parentsUntil('li')
.find('button')
.click()
cy.location().should((loc) => {
expect(loc.pathname).to.match(/834364291$/)
})
cy.contains(fr ? 'Lancer le simulateur' : 'Launch the simulator')
cy.contains('SAS(U)').siblings('a').click()
cy.location().should((loc) => {
expect(loc.pathname).to.match(/sasu$/)
})
@ -105,6 +113,16 @@ describe(`Navigation to income simulator using company name (${
.parentsUntil('li')
.find('button')
.click()
cy.location().should((loc) => {
expect(loc.pathname).to.match(/493096580$/)
})
cy.contains(
fr
? 'Simulateurs pour votre entreprise'
: 'Simulateurs pour votre entreprise'
)
// ask if auto-entrepreneur
cy.contains(fr ? 'auto-entrepreneur' : 'auto-entrepreneur')
cy.contains(fr ? 'Oui' : 'Yes').click()

View File

@ -5,7 +5,9 @@ describe.skip('Status guide', function () {
beforeEach(function () {
cy.visit(fr ? encodeURI('/créer') : '/create')
cy.contains(fr ? 'Trouver le bon statut' : 'Find the right status').click()
cy.contains(fr ? 'Trouver le bon statut' : 'Find the right status').click({
waitForAnimations: true,
})
})
it('should allow to go back clicking on the previous answers', function () {

View File

@ -41,8 +41,7 @@ describe('Landing page', function () {
cy.get(searchInputPath).should('have.attr', 'placeholder')
cy.get(searchInputPath).invoke('attr', 'type').should('equal', 'search')
cy.get(searchInputPath).focus()
cy.type('noima')
cy.get(searchInputPath).first().type('noima')
cy.intercept(
{

View File

@ -19,19 +19,21 @@ export const runSimulateurTest = (simulateur) => {
it('should display a result when entering a value in any of the currency input', function () {
cy.contains(fr ? 'Montant annuel' : 'Annual amount').click()
if (['indépendant', 'profession-liberale'].includes(simulateur)) {
cy.get(chargeInputSelector).type(1000)
cy.get(chargeInputSelector).type('1000')
}
cy.get(inputSelector).each(($testedInput) => {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.wrap($testedInput)
.type('{selectall}60111')
.and(($i) =>
expect($i.val().replace(/[\s,.€]/g, '')).to.match(/[1-9][\d]{3,6}$/)
expect(($i.val() as string).replace(/[\s,.€]/g, '')).to.match(
/[1-9][\d]{3,6}$/
)
)
cy.get(inputSelector).each(($input) => {
if ($testedInput.get(0) === $input.get(0)) return
cy.wrap($input).and(($i) => {
const val = $i.val().replace(/[\s,.€]/g, '')
const val = ($i.val() as string).replace(/[\s,.€]/g, '')
expect(val).not.to.be.eq('60111')
expect(val).to.match(/[1-9][\d]{3,6}$/)
})