Ajoute un lien vers un questionnaire utilisateur

pull/1165/head
Johan Girod 2020-10-15 11:58:55 +02:00
parent 2223bd2792
commit 02abca6d6e
4 changed files with 51 additions and 14 deletions

View File

@ -24,7 +24,7 @@ describe('Simulateurs', function() {
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)) {
if (['indépendant', 'dirigeant-sasu'].includes(simulateur)) {
cy.get(chargeInputSelector).type(1000)
}
cy.get(inputSelector).each((testedInput, i) => {
@ -47,7 +47,7 @@ describe('Simulateurs', function() {
cy.get(inputSelector)
.first()
.type('{selectall}12000')
if (['indépendant', 'assimilé-salarié'].includes(simulateur)) {
if (['indépendant', 'dirigeant-sasu'].includes(simulateur)) {
cy.get(chargeInputSelector).type('{selectall}6000')
}
cy.wait(800)
@ -56,7 +56,7 @@ describe('Simulateurs', function() {
.first()
.invoke('val')
.should('match', /1[\s]000/)
if (['indépendant', 'assimilé-salarié'].includes(simulateur)) {
if (['indépendant', 'dirigeant-sasu'].includes(simulateur)) {
cy.get(chargeInputSelector)
.first()
.invoke('val')
@ -153,7 +153,8 @@ describe('Simulateur salarié', () => {
})
it('should permit selecting the smic before part-time contrat', function() {
cy.get('input[name$="brut de base"').click()
cy.visit('/simulateurs/salarié')
cy.get('input[name$="brut de base"]').click()
cy.get('button')
.contains('SMIC')
.click()
@ -162,7 +163,7 @@ describe('Simulateur salarié', () => {
cy.get('input[value="oui"]')
.parent()
.click()
cy.get('input[name$="brut de base"').should($input => {
cy.get('input[name$="brut de base"]').should($input => {
expect(+$input.val().replace(/[\s,.]/g, ''))
.to.be.above(1300)
.and.to.be.below(1500)

View File

@ -0,0 +1,28 @@
import React from 'react'
// Envie de donner un coup de pouce ? Répondez à notre sondage sur le simulateur.
export default function LinkToForm() {
const hostname = new URL(
new URLSearchParams(document.location.search).get('integratorUrl') ||
document.referrer ||
document.location.origin
).hostname.replace(/^www\.|^m\./, '')
console.log(hostname)
return (
<div
style={{ display: 'flex', justifyContent: 'center', marginTop: '1rem' }}
>
<span className="feedback-page ui__ notice">
<span>
Envie de donner un coup de pouce ?{' '}
<a
target="_blank"
href={`https://docs.google.com/forms/d/e/1FAIpQLSdrA0Jl61oACUmn54uYN7hd3XRgBQEJkpzAihPLtJn4FezmsQ/viewform?usp=pp_url&entry.455823333=${hostname}`}
>
Répondez à notre sondage sur le simulateur.
</a>
</span>
</span>
</div>
)
}

View File

@ -13,18 +13,21 @@ import React from 'react'
import { Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
import { firstStepCompletedSelector } from 'Selectors/simulationSelectors'
import LinkToForm from './Feedback/LinkToForm'
type SimulationProps = {
explanations?: React.ReactNode
results?: React.ReactNode
customEndMessages?: ConversationProps['customEndMessages']
showPeriodSwitch?: boolean
showLinkToForm?: boolean
}
export default function Simulation({
explanations,
results,
customEndMessages,
showLinkToForm,
showPeriodSwitch
}: SimulationProps) {
const firstStepCompleted = useSelector(firstStepCompletedSelector)
@ -37,14 +40,17 @@ export default function Simulation({
{results}
<Questions customEndMessages={customEndMessages} />
<br />
<PageFeedback
customMessage={
<Trans i18nKey="feedback.simulator">
Êtes-vous satisfait de ce simulateur ?
</Trans>
}
customEventName="rate simulator"
/>{' '}
{showLinkToForm && <LinkToForm />}
{!showLinkToForm && (
<PageFeedback
customMessage={
<Trans i18nKey="feedback.simulator">
Êtes-vous satisfait de ce simulateur ?
</Trans>
}
customEventName="rate simulator"
/>
)}{' '}
{explanations}
</Animate.fromTop>
)}

View File

@ -4,15 +4,17 @@ import Simulation from 'Components/Simulation'
import SalaryExplanation from 'Components/simulationExplanation/SalaryExplanation'
import { SitePathsContext } from 'Components/utils/SitePathsContext'
import { default as React, useContext } from 'react'
import { Trans } from 'react-i18next'
import { Trans, useTranslation } from 'react-i18next'
import { Link } from 'react-router-dom'
export default function SalariéSimulation() {
const sitePaths = useContext(SitePathsContext)
const { language } = useTranslation().i18n
return (
<>
<Simulation
explanations={<SalaryExplanation />}
showLinkToForm={language === 'fr'}
customEndMessages={
<>
<Trans i18nKey="simulation-end.hiring.text">