changement

This commit is contained in:
Emma781227
2026-07-23 13:45:11 +02:00
parent b6506435d5
commit 7f816c165b
13 changed files with 208 additions and 96 deletions

View File

@@ -19,8 +19,8 @@ describe('Connexion', () => {
renderWithProviders(<Connexion />, { route: '/connexion' })
expect(screen.getByRole('heading', { name: /se connecter/i })).toBeInTheDocument()
expect(screen.getByPlaceholderText(/votre email/i)).toBeInTheDocument()
expect(screen.getByPlaceholderText(/votre mot de passe/i)).toBeInTheDocument()
expect(screen.getByLabelText(/adresse email/i)).toBeInTheDocument()
expect(screen.getByLabelText(/^mot de passe/i)).toBeInTheDocument()
expect(screen.getByRole('button', { name: /se connecter/i })).toBeInTheDocument()
})
@@ -37,8 +37,8 @@ describe('Connexion', () => {
renderWithProviders(<Connexion />, { route: '/connexion' })
await userEvent.type(screen.getByPlaceholderText(/votre email/i), 'test@example.com')
await userEvent.type(screen.getByPlaceholderText(/votre mot de passe/i), 'mauvais-mdp')
await userEvent.type(screen.getByLabelText(/adresse email/i), 'test@example.com')
await userEvent.type(screen.getByLabelText(/^mot de passe/i), 'mauvais-mdp')
await userEvent.click(screen.getByRole('button', { name: /se connecter/i }))
expect(await screen.findByText('Email ou mot de passe incorrect.')).toBeInTheDocument()
@@ -56,8 +56,8 @@ describe('Connexion', () => {
routes: { '/mes-gains': <p>Page Mes Gains</p> },
})
await userEvent.type(screen.getByPlaceholderText(/votre email/i), 'client@example.com')
await userEvent.type(screen.getByPlaceholderText(/votre mot de passe/i), 'MotDePasse123!')
await userEvent.type(screen.getByLabelText(/adresse email/i), 'client@example.com')
await userEvent.type(screen.getByLabelText(/^mot de passe/i), 'MotDePasse123!')
await userEvent.click(screen.getByRole('button', { name: /se connecter/i }))
expect(await screen.findByText('Page Mes Gains')).toBeInTheDocument()
@@ -75,8 +75,8 @@ describe('Connexion', () => {
routes: { '/admin': <p>Page Admin</p> },
})
await userEvent.type(screen.getByPlaceholderText(/votre email/i), 'admin@example.com')
await userEvent.type(screen.getByPlaceholderText(/votre mot de passe/i), 'MotDePasse123!')
await userEvent.type(screen.getByLabelText(/adresse email/i), 'admin@example.com')
await userEvent.type(screen.getByLabelText(/^mot de passe/i), 'MotDePasse123!')
await userEvent.click(screen.getByRole('button', { name: /se connecter/i }))
expect(await screen.findByText('Page Admin')).toBeInTheDocument()

View File

@@ -12,10 +12,10 @@ vi.mock('../../services/auth', () => ({
// Remplit et soumet le formulaire d'inscription (étape 1).
async function remplirEtSoumettre() {
await userEvent.type(screen.getByPlaceholderText(/votre email/i), 'jean@example.com')
await userEvent.type(screen.getByPlaceholderText(/votre nom/i), 'Dupont')
await userEvent.type(screen.getByPlaceholderText(/votre prénom/i), 'Jean')
await userEvent.type(screen.getByPlaceholderText(/votre mot de passe/i), 'MotDePasse123!')
await userEvent.type(screen.getByLabelText(/adresse email/i), 'jean@example.com')
await userEvent.type(screen.getByLabelText(/^nom/i), 'Dupont')
await userEvent.type(screen.getByLabelText(/prénom/i), 'Jean')
await userEvent.type(screen.getByLabelText(/^mot de passe/i), 'MotDePasse123!')
await userEvent.click(screen.getByRole('checkbox'))
await userEvent.click(screen.getByRole('button', { name: /s'inscrire/i }))
}
@@ -37,10 +37,10 @@ describe('Inscription', () => {
renderWithProviders(<Inscription />, { route: '/inscription' })
expect(screen.getByRole('heading', { name: /s'inscrire/i })).toBeInTheDocument()
expect(screen.getByPlaceholderText(/votre email/i)).toBeInTheDocument()
expect(screen.getByPlaceholderText(/votre nom/i)).toBeInTheDocument()
expect(screen.getByPlaceholderText(/votre prénom/i)).toBeInTheDocument()
expect(screen.getByPlaceholderText(/votre mot de passe/i)).toBeInTheDocument()
expect(screen.getByLabelText(/adresse email/i)).toBeInTheDocument()
expect(screen.getByLabelText(/^nom/i)).toBeInTheDocument()
expect(screen.getByLabelText(/prénom/i)).toBeInTheDocument()
expect(screen.getByLabelText(/^mot de passe/i)).toBeInTheDocument()
})
it("désactive le bouton tant que les conditions ne sont pas acceptées", async () => {