-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat: gestion reset captcha (#230) * reset captcha en cas d'erreur * resolve warning : Warning: An update to TestComponent inside a test was not wrapped in act(...). * retour commentaire * prise en cmpte retour formulaire (#238) * build(deps): bump the minor-and-patch group across 1 directory with 10 updates (#239) Bumps the minor-and-patch group with 9 updates in the / directory: | Package | From | To | | --- | --- | --- | | [@reduxjs/toolkit](https://github.com/reduxjs/redux-toolkit) | `2.2.7` | `2.3.0` | | [dayjs](https://github.com/iamkun/dayjs) | `1.11.12` | `1.11.13` | | [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) | `6.25.1` | `6.27.0` | | [react-tooltip](https://github.com/ReactTooltip/react-tooltip) | `5.27.1` | `5.28.0` | | [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) | `5.3.5` | `5.4.10` | | [web-vitals](https://github.com/GoogleChrome/web-vitals) | `4.2.2` | `4.2.4` | | [@testing-library/react](https://github.com/testing-library/react-testing-library) | `16.0.0` | `16.0.1` | | [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react) | `4.3.1` | `4.3.3` | | [@vitest/coverage-istanbul](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-istanbul) | `2.0.4` | `2.1.4` | Updates `@reduxjs/toolkit` from 2.2.7 to 2.3.0 - [Release notes](https://github.com/reduxjs/redux-toolkit/releases) - [Commits](reduxjs/redux-toolkit@v2.2.7...v2.3.0) Updates `dayjs` from 1.11.12 to 1.11.13 - [Release notes](https://github.com/iamkun/dayjs/releases) - [Changelog](https://github.com/iamkun/dayjs/blob/v1.11.13/CHANGELOG.md) - [Commits](iamkun/dayjs@v1.11.12...v1.11.13) Updates `react-router-dom` from 6.25.1 to 6.27.0 - [Release notes](https://github.com/remix-run/react-router/releases) - [Changelog](https://github.com/remix-run/react-router/blob/[email protected]/packages/react-router-dom/CHANGELOG.md) - [Commits](https://github.com/remix-run/react-router/commits/[email protected]/packages/react-router-dom) Updates `react-tooltip` from 5.27.1 to 5.28.0 - [Release notes](https://github.com/ReactTooltip/react-tooltip/releases) - [Changelog](https://github.com/ReactTooltip/react-tooltip/blob/master/CHANGELOG.md) - [Commits](ReactTooltip/react-tooltip@v5.27.1...v5.28.0) Updates `vite` from 5.3.5 to 5.4.10 - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.4.10/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.4.10/packages/vite) Updates `web-vitals` from 4.2.2 to 4.2.4 - [Changelog](https://github.com/GoogleChrome/web-vitals/blob/main/CHANGELOG.md) - [Commits](GoogleChrome/web-vitals@v4.2.2...v4.2.4) Updates `@testing-library/react` from 16.0.0 to 16.0.1 - [Release notes](https://github.com/testing-library/react-testing-library/releases) - [Changelog](https://github.com/testing-library/react-testing-library/blob/main/CHANGELOG.md) - [Commits](testing-library/react-testing-library@v16.0.0...v16.0.1) Updates `@vitejs/plugin-react` from 4.3.1 to 4.3.3 - [Release notes](https://github.com/vitejs/vite-plugin-react/releases) - [Changelog](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite-plugin-react/commits/v4.3.3/packages/plugin-react) Updates `@vitest/coverage-istanbul` from 2.0.4 to 2.1.4 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.4/packages/coverage-istanbul) Updates `vitest` from 2.0.4 to 2.1.4 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.4/packages/vitest) --- updated-dependencies: - dependency-name: "@reduxjs/toolkit" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: dayjs dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor-and-patch - dependency-name: react-router-dom dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: react-tooltip dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: vite dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: web-vitals dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor-and-patch - dependency-name: "@testing-library/react" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor-and-patch - dependency-name: "@vitejs/plugin-react" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor-and-patch - dependency-name: "@vitest/coverage-istanbul" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: vitest dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor-and-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * maj url menu + maj wording (#242) * maj menu partie 2 (#244) --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5dcf8aa
commit d8cdedb
Showing
20 changed files
with
537 additions
and
714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ describe('candidature conseiller', () => { | |
expect(nom).toHaveAttribute('type', 'text'); | ||
expect(nom).toBeRequired(); | ||
|
||
const email = within(etapeInformationsDeContact).getByLabelText('Adresse e-mail * Format attendu : [email protected]'); | ||
const email = within(etapeInformationsDeContact).getByLabelText('Adresse électronique * Format attendu : [email protected]'); | ||
expect(email).toHaveAttribute('type', 'email'); | ||
expect(email).toBeRequired(); | ||
|
||
|
@@ -343,7 +343,7 @@ describe('candidature conseiller', () => { | |
|
||
// WHEN | ||
const adresse = screen.getByLabelText('Votre lieu d’habitation * Saississez le nom ou le code postal de votre commune.'); | ||
fireEvent.change(adresse, { target: { value: 'par' } }); | ||
fireEvent.change(adresse, { target: { value: 'paris' } }); | ||
|
||
// THEN | ||
const paris = await screen.findByRole('option', { name: '75001 Paris', hidden: true }); | ||
|
@@ -369,7 +369,7 @@ describe('candidature conseiller', () => { | |
fireEvent.change(prenom, { target: { value: 'Jean' } }); | ||
const nom = screen.getByLabelText('Nom *'); | ||
fireEvent.change(nom, { target: { value: 'Dupont' } }); | ||
const email = screen.getByLabelText('Adresse e-mail * Format attendu : [email protected]'); | ||
const email = screen.getByLabelText('Adresse électronique * Format attendu : [email protected]'); | ||
fireEvent.change(email, { target: { value: '[email protected]' } }); | ||
const adresse = screen.getByLabelText('Votre lieu d’habitation * Saississez le nom ou le code postal de votre commune.'); | ||
fireEvent.change(adresse, { target: { value: '93100 Montreuil' } }); | ||
|
@@ -408,7 +408,7 @@ describe('candidature conseiller', () => { | |
fireEvent.change(prenom, { target: { value: 'Jean' } }); | ||
const nom = screen.getByLabelText('Nom *'); | ||
fireEvent.change(nom, { target: { value: 'Dupont' } }); | ||
const email = screen.getByLabelText('Adresse e-mail * Format attendu : [email protected]'); | ||
const email = screen.getByLabelText('Adresse électronique * Format attendu : [email protected]'); | ||
fireEvent.change(email, { target: { value: '[email protected]' } }); | ||
const adresse = screen.getByLabelText('Votre lieu d’habitation * Saississez le nom ou le code postal de votre commune.'); | ||
fireEvent.change(adresse, { target: { value: '93100 Montreuil' } }); | ||
|
@@ -431,21 +431,26 @@ describe('candidature conseiller', () => { | |
vi.useRealTimers(); | ||
}); | ||
|
||
it('quand je remplis le formulaire, que je l’envoie et que le serveur me renvoie une erreur, alors elle s’affiche sur la page', async () => { | ||
// eslint-disable-next-line max-len | ||
it('quand je remplis le formulaire, que je l’envoie et que le serveur me renvoie une erreur, alors elle s’affiche sur la page et le captcha est rénitialisé', async () => { | ||
// GIVEN | ||
vi.useFakeTimers(); | ||
vi.setSystemTime(new Date(2023, 11, 12, 13)); | ||
|
||
vi.stubGlobal('fetch', vi.fn( | ||
() => ({ status: 400, json: async () => Promise.resolve({ message: 'Cette adresse mail est déjà utilisée' }) })) | ||
); | ||
vi.stubGlobal('hcaptcha', { | ||
reset: vi.fn(), | ||
render: vi.fn() | ||
}); | ||
|
||
render(<CandidatureConseiller />); | ||
const prenom = screen.getByLabelText('Prénom *'); | ||
fireEvent.change(prenom, { target: { value: 'Jean' } }); | ||
const nom = screen.getByLabelText('Nom *'); | ||
fireEvent.change(nom, { target: { value: 'Dupont' } }); | ||
const email = screen.getByLabelText('Adresse e-mail * Format attendu : [email protected]'); | ||
const email = screen.getByLabelText('Adresse électronique * Format attendu : [email protected]'); | ||
fireEvent.change(email, { target: { value: '[email protected]' } }); | ||
const adresse = screen.getByLabelText('Votre lieu d’habitation * Saississez le nom ou le code postal de votre commune.'); | ||
fireEvent.change(adresse, { target: { value: '93100 Montreuil' } }); | ||
|
@@ -469,6 +474,7 @@ describe('candidature conseiller', () => { | |
}); | ||
|
||
// THEN | ||
expect(window.hcaptcha.reset).toHaveBeenCalledTimes(1); | ||
const titreErreurValidation = screen.getByRole('heading', { level: 3, name: 'Erreur de validation' }); | ||
expect(titreErreurValidation).toBeInTheDocument(); | ||
const contenuErreurValidation = screen.getByText('Cette adresse mail est déjà utilisée', { selector: 'p' }); | ||
|
@@ -493,7 +499,7 @@ describe('candidature conseiller', () => { | |
fireEvent.change(prenom, { target: { value: 'Jean' } }); | ||
const nom = screen.getByLabelText('Nom *'); | ||
fireEvent.change(nom, { target: { value: 'Dupont' } }); | ||
const email = screen.getByLabelText('Adresse e-mail * Format attendu : [email protected]'); | ||
const email = screen.getByLabelText('Adresse électronique * Format attendu : [email protected]'); | ||
const adresse = screen.getByLabelText('Votre lieu d’habitation * Saississez le nom ou le code postal de votre commune.'); | ||
fireEvent.change(adresse, { target: { value: '93100 Montreuil' } }); | ||
fireEvent.change(email, { target: { value: '[email protected]' } }); | ||
|
@@ -539,7 +545,7 @@ describe('candidature conseiller', () => { | |
fireEvent.change(prenom, { target: { value: 'Jean' } }); | ||
const nom = screen.getByLabelText('Nom *'); | ||
fireEvent.change(nom, { target: { value: 'Dupont' } }); | ||
const email = screen.getByLabelText('Adresse e-mail * Format attendu : [email protected]'); | ||
const email = screen.getByLabelText('Adresse électronique * Format attendu : [email protected]'); | ||
fireEvent.change(email, { target: { value: '[email protected]' } }); | ||
const adresse = screen.getByLabelText('Votre lieu d’habitation * Saississez le nom ou le code postal de votre commune.'); | ||
fireEvent.change(adresse, { target: { value: '93100 Montreuil' } }); | ||
|
@@ -662,7 +668,7 @@ describe('candidature conseiller', () => { | |
vi.useRealTimers(); | ||
}); | ||
|
||
it('quand je remplis le formulaire et qu’une erreur se produit alors un message d’erreur s’affiche', async () => { | ||
it('quand je remplis le formulaire et qu’une erreur se produit alors un message d’erreur s’affiche et le captcha est rénitialisé', async () => { | ||
// GIVEN | ||
vi.useFakeTimers(); | ||
vi.setSystemTime(new Date(2023, 11, 12, 13)); | ||
|
@@ -671,13 +677,17 @@ describe('candidature conseiller', () => { | |
creerCandidatureConseiller: vi.fn().mockReturnValue({ message: 'Failed to fetch' }), | ||
buildConseillerData: vi.fn(), | ||
})); | ||
vi.stubGlobal('hcaptcha', { | ||
reset: vi.fn(), | ||
render: vi.fn() | ||
}); | ||
|
||
render(<CandidatureConseiller />); | ||
const prenom = screen.getByLabelText('Prénom *'); | ||
fireEvent.change(prenom, { target: { value: 'Jean' } }); | ||
const nom = screen.getByLabelText('Nom *'); | ||
fireEvent.change(nom, { target: { value: 'Dupont' } }); | ||
const email = screen.getByLabelText('Adresse e-mail * Format attendu : [email protected]'); | ||
const email = screen.getByLabelText('Adresse électronique * Format attendu : [email protected]'); | ||
fireEvent.change(email, { target: { value: '[email protected]' } }); | ||
const adresse = screen.getByLabelText('Votre lieu d’habitation * Saississez le nom ou le code postal de votre commune.'); | ||
fireEvent.change(adresse, { target: { value: '93100 Montreuil' } }); | ||
|
@@ -703,6 +713,7 @@ describe('candidature conseiller', () => { | |
}); | ||
|
||
// THEN | ||
expect(window.hcaptcha.reset).toHaveBeenCalledTimes(1); | ||
const contenuErreurValidation = screen.getByText('Failed to fetch', { selector: 'p' }); | ||
expect(contenuErreurValidation).toBeInTheDocument(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ export default function InformationsDeContact() { | |
id="email" | ||
type="email" | ||
> | ||
Adresse e-mail <span className="cc-obligatoire">*</span> <span className="fr-hint-text">Format attendu : [email protected]</span> | ||
Adresse électronique <span className="cc-obligatoire">*</span> <span className="fr-hint-text">Format attendu : [email protected]</span> | ||
</Input> | ||
<Input | ||
id="telephone" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.