💚 répare les tests cypress en ajoutant un encodeURI

pull/1519/head
Johan Girod 2021-05-03 15:54:59 +02:00
parent 985e64b4fe
commit 6bbb476eb6
7 changed files with 287 additions and 11 deletions

View File

@ -0,0 +1,274 @@
<!DOCTYPE html>
<html>
<head> <script type='text/javascript'> document.domain = '1521--mon-entreprise.netlify.app'; var Cypress = window.Cypress = parent.Cypress; if (!Cypress) { throw new Error('Something went terribly wrong and we cannot proceed. We expected to find the global Cypress in the parent window but it is missing!. This should never happen and likely is a bug. Please open an issue!'); }; Cypress.action('app:window:before:load', window); </script>
<meta charset="utf-8" />
<base href="/" />
<meta name="viewport" content="initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link
rel="apple-touch-icon"
sizes="180x180"
href="/favicon/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon/favicon-16x16.png"
/>
<link rel="shortcut icon" href="/favicon/favicon.ico" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="msapplication-config" content="/favicon/browserconfig.xml" />
<meta
name="google-site-verification"
content="y1B_PVRQAlMoLd7La3AlOt_0Ja8Lp-lrkoXGat9-uMA"
/>
<meta
name="google-site-verification"
content="C03WwnrJP0FLqf83ibMBA7_N-TLQcwsJaAhqKXppxaE"
/>
<meta
name="google-site-verification"
content="QciT8g0vom7kg0Qz6aFIS9s_5r7-21ip0Ho6cuEN1KA"
/>
<!-- vérification pour Bing Webmaster -->
<meta name="msvalidate.01" content="65161AFDF93A706CED3F68C7621C00D7" />
<meta
name="description"
content="Du statut juridique à la première embauche, en passant par la simulation des cotisations, vous trouverez ici toutes les ressources pour démarrer votre activité."
data-react-helmet="true"
/>
<meta property="og:type" content="website" />
<meta
property="og:title"
data-react-helmet="true"
content="Mon-entreprise.fr : L'assistant officiel du créateur d'entreprise"
/>
<meta
property="og:description"
data-react-helmet="true"
content="Du statut juridique à la première embauche, en passant par la simulation des cotisations, vous trouverez ici toutes les ressources pour démarrer votre activité."
/>
<meta
property="og:image"
data-react-helmet="true"
content="https://mon-entreprise.fr/images/logo-share.png"
/>
<!-- data-helmet pour que React Helmet puisse écraser ce meta par défaut -->
<link rel="manifest" href="/manifest.webmanifest" />
<title>
Mon-entreprise.fr : L'assistant officiel du créateur d'entreprise
</title>
<link href="mon-entreprise.1d7310f5b6fcef0614f1.css" rel="stylesheet" />
<style>
html[data-useragent*='MSIE'] #outdated-browser,
html[data-useragent*='Safari'][data-useragent*='Version/8']
#outdated-browser,
html[data-useragent*='Safari'][data-useragent*='Version/7']
#outdated-browser,
html[data-useragent*='Trident'] #outdated-browser {
display: block !important;
}
html[data-useragent*='MSIE'] #loading,
html[data-useragent*='Safari'][data-useragent*='Version/8'] #loading,
html[data-useragent*='Safari'][data-useragent*='Version/7'] #loading,
html[data-useragent*='Trident'] #loading {
display: none !important;
}
html[data-useragent*='MSIE'] #js,
html[data-useragent*='Safari'][data-useragent*='Version/8'] #js,
html[data-useragent*='Safari'][data-useragent*='Version/7'] #js,
html[data-useragent*='Trident'] #js {
display: none !important;
}
/* Prevent FOUC effect */
#js {
opacity: 0;
}
/* CSS Loader */
#loading {
animation: appear 0.6s;
transform: translateY(35vh);
width: 100%;
}
#lds-ellipsis {
margin: auto;
position: relative;
width: 64px;
animation: appear 1.5s;
height: 64px;
}
#lds-ellipsis div {
position: absolute;
top: 27px;
width: 11px;
height: 11px;
border-radius: 50%;
background: rgb(41, 117, 209);
animation-timing-function: cubic-bezier(0, 1, 1, 0);
}
#lds-ellipsis div:nth-child(1) {
left: 6px;
animation: lds-ellipsis1 0.6s infinite;
}
#lds-ellipsis div:nth-child(2) {
left: 6px;
animation: lds-ellipsis2 0.6s infinite;
}
#lds-ellipsis div:nth-child(3) {
left: 26px;
animation: lds-ellipsis2 0.6s infinite;
}
#lds-ellipsis div:nth-child(4) {
left: 45px;
animation: lds-ellipsis3 0.6s infinite;
}
@keyframes appear {
from {
opacity: 0;
}
80% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes lds-ellipsis1 {
0% {
transform: scale(0);
}
100% {
transform: scale(1);
}
}
@keyframes lds-ellipsis3 {
0% {
transform: scale(1);
}
100% {
transform: scale(0);
}
}
@keyframes lds-ellipsis2 {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(19px, 0);
}
}
</style>
<meta name="theme-color" content="#2975d1" />
</head>
<body>
<div id="loading">
<img
src="images/logo.svg"
alt="Un service de l'État français"
style="width: 300px; margin: auto; margin-bottom: 0.6rem; display:block"
/>
<div id="lds-ellipsis">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
<!-- USER AGENT DATA ATTRIBUTE -->
<script>
var b = document.documentElement
b.setAttribute('data-useragent', navigator.userAgent)
</script>
<!-- APP -->
<div id="js"></div>
<!-- OUTDATED BROWSER WARNING -->
<div
id="outdated-browser"
style="position: fixed; top: 0; left: 0; bottom: 0; right: 0; display: none; background-color: white"
>
<div
style="margin: 100px auto; max-width: 800px; text-align: center; font-family: 'Montserrat', sans-serif; font-weight: 300;"
>
<img
src="images/logo.svg"
alt="Logo mon-entreprise.fr"
style="width: 200px; margin-bottom: 2rem;"
/>
<h1>
Votre navigateur n'est plus supporté.
</h1>
<h2>
Nous vous invitons à réessayer avec un autre, ou depuis un mobile
récent.
</h2>
<br />
<br />
<h3>
Si besoin, vous pouvez en installer un nouveau depuis
<a style="color: #2975d1" href="https://outdatedbrowser.com/fr"
>cette page</a
>
</h3>
<h3>
<a
href="javascript:void(0);"
onclick="
var b = document.documentElement;
b.setAttribute('data-useragent', 'force-navigation-anyway');
"
>Continuer quand même vers le site</a
>
</h3>
</div>
</div>
<script
type="module"
src="mon-entreprise.2f9d22ef7f796f3d0266.bundle.js"
></script>
<!-- Polyfill and source for old browser -->
<!-- Add polyfill.io for a very narrow web feature
IntersectionObserver : SAFARI 11 & 12.0 https://caniuse.com/#search=intersectionobserver
Intl : SAFARI 9 & 10.0 https://caniuse.com/#search=Intl
-->
<script src="https://polyfill.io/v3/polyfill.min.js?features=Intl.~locale.en%2CIntl.~locale.fr%2CIntersectionObserver"></script>
<script nomodule src="mon-entreprise.legacy.bundle.js"></script>
</body>
</html>

View File

@ -10,7 +10,7 @@ describe('Page covid-19', function () {
if (!fr) {
return
}
before(() => cy.visit('/simulateurs/chômage-partiel'))
before(() => cy.visit(encodeURI('/simulateurs/chômage-partiel')))
it('should not crash', () => {
cy.contains('Salaire brut mensuel')
})

View File

@ -12,7 +12,7 @@ describe(
if (!fr) {
return
}
before(() => cy.visit('/gérer/demande-mobilité'))
before(() => cy.visit(encodeURI('/gérer/demande-mobilité')))
it('should not crash', () => {
cy.contains('Demande de mobilité internationale')
})

View File

@ -1,7 +1,7 @@
describe('Manage page test', function () {
const fr = Cypress.env('language') === 'fr'
beforeEach(() => {
cy.visit(fr ? '/gérer' : '/manage')
cy.visit(fr ? encodeURI('/gérer') : '/manage')
})
it('should not crash', function () {
cy.contains(fr ? 'Gérer mon activité' : 'Manage my business')

View File

@ -1,16 +1,18 @@
describe('Navigation', function () {
const fr = Cypress.env('language') === 'fr'
it('should enable switching site language', () => {
cy.visit(fr ? '/créer/auto-entrepreneur' : '/create/auto-entrepreneur')
cy.visit(
fr ? encodeURI('/créer/auto-entrepreneur') : '/create/auto-entrepreneur'
)
cy.contains(fr ? 'Switch to English' : 'Passer en français').click()
cy.url().should(
'include',
fr ? '/create/auto-entrepreneur' : '/cr%C3%A9er/auto-entrepreneur'
fr ? '/create/auto-entrepreneur' : encodeURI('/créer/auto-entrepreneur')
)
})
it('should go back to home when clicking on logo', () => {
cy.visit('/documentation/contrat-salarié')
cy.visit(encodeURI('/documentation/contrat-salarié'))
cy.get('img[alt^="logo mon-entreprise"]').click()
cy.url().should('match', new RegExp(`${Cypress.config().baseUrl}/?`))
})

View File

@ -17,7 +17,7 @@ describe('Simulateurs', function () {
'profession-liberale/chirurgien-dentiste',
].forEach((simulateur) =>
describe(simulateur, () => {
before(() => cy.visit(`/simulateurs/${simulateur}`))
before(() => cy.visit(encodeURI(`/simulateurs/${simulateur}`)))
it('should not crash', function () {
cy.get(inputSelector)
})
@ -139,7 +139,7 @@ describe('Simulateur salarié', () => {
if (!fr) {
return
}
before(() => cy.visit('/simulateurs/salarié'))
before(() => cy.visit(encodeURI('/simulateurs/salarié')))
it('should persist the current simulation (persistSimulation)', function () {
cy.get(inputSelector).first().type('{selectall}42')
@ -153,7 +153,7 @@ describe('Simulateur salarié', () => {
cy.contains('Passer').click()
cy.contains('Passer').click()
cy.wait(1600)
cy.visit('/simulateurs/salarié')
cy.visit(encodeURI('/simulateurs/salarié'))
cy.contains('Retrouver ma simulation').click()
cy.get(inputSelector).first().invoke('val').should('match', /42/)
})
@ -169,7 +169,7 @@ describe('Simulateur salarié', () => {
describe('part time contract', () => {
before(() => {
cy.visit('/simulateurs/salarié')
cy.visit(encodeURI('/simulateurs/salarié'))
cy.get('input[name$="brut de base"]').click()
cy.get('button').contains('SMIC').click()
cy.contains('Voir mes paramètres').click()

View File

@ -1,7 +1,7 @@
describe('Status guide', function () {
const fr = Cypress.env('language') === 'fr'
beforeEach(() => {
cy.visit(fr ? '/créer' : '/create')
cy.visit(fr ? encodeURI('/créer') : '/create')
cy.get('.cta').click()
})