Update cypress to v12 prerelease

pull/2413/head
Jérémy Rialland 2022-11-30 20:00:58 +01:00 committed by Jérémy Rialland
parent 6b1757a3cd
commit 9eaaf8fc22
15 changed files with 65 additions and 69 deletions

View File

@ -280,6 +280,8 @@ jobs:
- name: Test e2e mon-entreprise on preview (site=${{ matrix.site }}, browser=${{ matrix.browser}}, viewport=${{ matrix.viewport }})
uses: cypress-io/github-action@v4
with:
# Hack to use local node version, issue : https://github.com/cypress-io/github-action/issues/489#issuecomment-1021379037
command-prefix: '--'
install: false
working-directory: site
record: true

View File

@ -15,7 +15,7 @@ export default defineConfig({
retries: {
// Configure retry attempts for `cypress run`
// Default is 0
runMode: 2,
runMode: 3,
// Configure retry attempts for `cypress open`
// Default is 0
openMode: 0,

View File

@ -1,6 +1,6 @@
import { fr } from '../../support/utils'
describe('Page covid-19', function () {
describe('Page covid-19', { testIsolation: 'off' }, function () {
if (!fr) {
return
}

View File

@ -77,7 +77,9 @@ describe(`Formulaire demande mobilité (${
.focused()
cy.contains('65100').type('{enter}').focused().tab().type('{downarrow}')
cy.focused().tab().type('Brest').wait('@communes')
cy.focused().tab().type('Brest')
cy.wait('@communes')
cy.contains('29200')
.type('{enter}')

View File

@ -115,6 +115,7 @@ describe('Test prerender', function () {
cy.visit(path || '/', { script: false })
.get('#loading', { timeout: 200 })
.should('not.exist')
test(cy)
})
})

View File

@ -45,9 +45,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().type('noima')
cy.wait('@entreprises')
cy.get(searchInputPath).focus().type('noima').wait('@entreprises')
cy.get(searchResultsPath).children().should('have.length', 6)
cy.get(searchResultsPath).children().first().click()

View File

@ -4,11 +4,9 @@ describe('Champs localisation (simulateur salarié)', function () {
if (!fr) {
return
}
before(function () {
return cy.visit(encodeURI('/simulateurs/salaire-brut-net'))
})
it('should not crash when selecting localisation', function () {
cy.visit(encodeURI('/simulateurs/salaire-brut-net'))
cy.contains('SMIC').click()
cy.contains('button', 'Commune').click()
cy.contains('Commune ou code postal')

View File

@ -13,15 +13,17 @@ describe('Partage (simulateur salarié)', function () {
if (!fr) {
return
}
it('should set input value from URL', function () {
cy.visit(urlWithState)
cy.get(brutInputSelector)
cy.get(brutInputSelector, { timeout: 30 * 1000 })
.invoke('val')
.should('match', /1[\s]539[\s]€/)
cy.contains('Modifier mes réponses').click()
cy.contains('CDD')
})
it('should set URL from input value', function () {
cy.visit(simulatorUrl)
cy.get(brutInputSelector).first().type('{selectall}1539')

View File

@ -1,17 +1,13 @@
const inputSelector = 'div[id="simulator-legend"] input'
const fr = Cypress.env('language') === 'fr'
describe('Persistence (simulateur salarié)', function () {
if (!fr) {
return
}
before(function () {
return cy.visit(encodeURI('/simulateurs/salaire-brut-net'))
})
beforeEach(function () {
cy.clearLocalStorage()
})
it('should persist the current simulation (persistSimulation)', function () {
cy.visit(encodeURI('/simulateurs/salaire-brut-net'))
cy.get(inputSelector).first().type('{selectall}42')
cy.contains('button', 'Passer').click()
cy.contains('button', 'Passer').click()
@ -23,11 +19,13 @@ describe('Persistence (simulateur salarié)', function () {
)
).to.be.not.null
})
cy.visit('/simulateurs/auto-entrepreneur')
cy.get(inputSelector).first().type('{selectall}007')
cy.contains('button', 'Passer').click()
cy.contains('button', 'Passer').click()
cy.contains('button', 'Passer').click()
cy.visit(encodeURI('/simulateurs/salaire-brut-net'))
cy.contains('Retrouver ma simulation').click()
cy.get(inputSelector).first().invoke('val').should('match', /42/)

View File

@ -1,6 +1,6 @@
import { fr } from '../../support/utils'
describe('Simulateur auto-entrepreneur', function () {
describe('Simulateur auto-entrepreneur', { testIsolation: 'off' }, function () {
if (!fr) {
return
}

View File

@ -5,11 +5,9 @@ describe('Simulateur dividendes', function () {
if (!fr) {
return
}
before(function () {
return cy.visit('/simulateurs/dividendes')
})
it('should show by default the PFU calculation at 12.8 / 17.2', function () {
cy.visit('/simulateurs/dividendes')
cy.get(inputSelector).first().type('{selectall}5000')
cy.contains(/[cC]otisations\s+17,2\s*%/)
cy.contains(/[Ii]mpôt\s+12,8\s*%/)

View File

@ -1,57 +1,54 @@
import { fr } from '../../support/utils'
describe('Simulateur salarié', function () {
describe('Simulateur salarié : part time contract', function () {
if (!fr) {
return
}
before(function () {
return cy.visit(encodeURI('/simulateurs/salaire-brut-net'))
beforeEach(function () {
cy.visit(encodeURI('/simulateurs/salaire-brut-net'))
cy.get('button').contains('SMIC').click()
cy.contains('Modifier mes réponses').click()
cy.get('div[role="dialog"]')
.eq(0)
.contains('Temps partiel')
.next()
.find('button')
.click()
cy.get('div[role="dialog"]').eq(1).contains('Fermer')
cy.get('div[role="dialog"]').eq(1).contains('Oui').click()
cy.get('div[role="dialog"]').eq(1).contains('Continuer').click()
cy.get('div[role="dialog"]').eq(0).contains('Fermer').click()
})
describe('part time contract', function () {
before(function () {
cy.get('button').contains('SMIC').click()
cy.contains('Modifier mes réponses').click()
cy.get('div[role="dialog"]')
.contains('Temps partiel')
.next()
.find('button')
.click()
cy.get('div[role="dialog"]').contains('Oui').click()
cy.get('div[role="dialog"]').contains('Continuer').click()
cy.get('div[role="dialog"]').contains('Fermer').click()
it('should permit selecting the smic before part-time contrat', function () {
cy.get('#salariécontratsalairebrut').should(($input) => {
const val = $input
.val()
.toString()
.replace(/[\s,.€]/g, '')
expect(parseInt(val)).to.be.above(1300).and.to.be.below(1600)
})
})
it('should permit selecting the smic before part-time contrat', function () {
cy.get('#salariécontratsalairebrut').should(($input) => {
const val = $input
.val()
.toString()
.replace(/[\s,.€]/g, '')
expect(parseInt(val)).to.be.above(1300).and.to.be.below(1600)
})
})
it('should permit customizing the number of worked hours and clear the input value', function () {
cy.contains('Modifier mes réponses').click()
it('should permit customizing the number of worked hours and clear the input value', function () {
cy.contains('Modifier mes réponses').click()
cy.get('div[role="dialog"]')
.contains('Heures par semaine')
.next()
.find('button')
.click()
cy.focused().type('25')
cy.contains('Fermer').click()
cy.get('div[role="dialog"]')
.contains('Heures par semaine')
.next()
.find('button')
.click()
cy.focused().type('25')
cy.contains('Fermer').click()
cy.get('#salariérémunérationnetpayéaprèsimpôt').should(($input) => {
const val = $input
.val()
.toString()
.replace(/[\s,.€]/g, '')
expect(parseInt(val)).to.be.below(1000)
})
cy.get('#salariérémunérationnetpayéaprèsimpôt').should(($input) => {
const val = $input
.val()
.toString()
.replace(/[\s,.€]/g, '')
expect(parseInt(val)).to.be.below(1000)
})
})
})

View File

@ -4,7 +4,7 @@ const chargeInputSelector = 'input[id="entreprisecharges"]'
const fr = Cypress.env('language') === 'fr'
export const runSimulateurTest = (simulateur) => {
describe(`Simulateur ${simulateur}`, function () {
describe(`Simulateur ${simulateur}`, { testIsolation: 'off' }, function () {
before(function () {
return cy.visit(
encodeURI(`/${fr ? 'simulateurs' : 'calculators'}/${simulateur}`)

View File

@ -126,7 +126,7 @@
"@types/styled-components": "^5.1.26",
"@vitejs/plugin-legacy": "^2.3.1",
"@vitejs/plugin-react": "^2.2.0",
"cypress": "^11.2.0",
"cypress": "https://cdn.cypress.io/beta/npm/12.0.0/linux-arm64/release/12.0.0-e8898d2f6b65a11f36ceb2dd32ce7f1d87b103bc/cypress.tgz",
"cypress-plugin-tab": "^1.0.5",
"cypress-wait-until": "^1.7.2",
"dotenv": "^16.0.3",

View File

@ -12876,9 +12876,9 @@ __metadata:
languageName: node
linkType: hard
"cypress@npm:^11.2.0":
version: 11.2.0
resolution: "cypress@npm:11.2.0"
"cypress@https://cdn.cypress.io/beta/npm/12.0.0/linux-arm64/release/12.0.0-e8898d2f6b65a11f36ceb2dd32ce7f1d87b103bc/cypress.tgz":
version: 12.0.0
resolution: "cypress@https://cdn.cypress.io/beta/npm/12.0.0/linux-arm64/release/12.0.0-e8898d2f6b65a11f36ceb2dd32ce7f1d87b103bc/cypress.tgz"
dependencies:
"@cypress/request": ^2.88.10
"@cypress/xvfb": ^1.2.4
@ -12924,7 +12924,7 @@ __metadata:
yauzl: ^2.10.0
bin:
cypress: bin/cypress
checksum: e13649fb4b62a3c9dff7cc571f4e01dba009d8179b05c4f885c5ceb4ed76b78a7323fec491d992da35527708b54e596bfc9edb1d702f788317889f794d8c1e76
checksum: d6e0d5c3325e915406981a487caf4413fbf84a92991e570378d4d911b19d8b0bde71a7fb5c8f0417e236c3e5c4f6077e6ec14e056646d38771a5607ac4096436
languageName: node
linkType: hard
@ -25933,7 +25933,7 @@ __metadata:
"@vitejs/plugin-legacy": ^2.3.1
"@vitejs/plugin-react": ^2.2.0
algoliasearch: ^4.14.2
cypress: ^11.2.0
cypress: "https://cdn.cypress.io/beta/npm/12.0.0/linux-arm64/release/12.0.0-e8898d2f6b65a11f36ceb2dd32ce7f1d87b103bc/cypress.tgz"
cypress-plugin-tab: ^1.0.5
cypress-wait-until: ^1.7.2
dotenv: ^16.0.3