batchCooking/apps/web/cypress/e2e/contact.feature
Nicolas a252640fe6
Some checks failed
CI / build (push) Successful in 2m22s
CI / lint (push) Successful in 2m26s
CI / intent-service-test (push) Successful in 4m8s
CI / e2e (push) Successful in 12m40s
CI / test (push) Failing after 15m4s
CI / build-android (push) Has been skipped
feat(contact): modèle + POST /contact + formulaire utilisateur (#80)
Formulaire in-app de remontée de bug / suggestion pour les utilisateurs
connectés (PR 1/2 de l'issue #80).

- Modèle Prisma `ContactMessage` (+ relation inverse sur `UserProfile`) et
  migration `20260908120000_contact_message` — table neuve, aucun backfill.
  `authorId` nullable + `onDelete: SetNull` : un signalement survit à la
  suppression de son compte.
- Contrat partagé `schemas/contact.ts` : `CONTACT_MESSAGE_TYPES`,
  `submitContactMessageSchema` (type enum, message 10-5000 trim, pageUrl /
  appVersion optionnels — jamais le user-agent).
- Module API `contact` : `POST /contact` (`requireAuth`, monté `/contact`),
  `204` sans corps. Le user-agent est lu de l'en-tête de requête, jamais du
  corps. Émet `analytics.recordEvent(contact.submitted, …)`.
- Page `/parametres/contact` (`ContactPage` + `contact.ts` + `.scss`) :
  select de type, textarea, validation cliente via le schéma partagé, états
  succès / erreur (`ErrorMessageService`, jamais `err.message`). Entrée de
  nav « Nous contacter » dans `SETTINGS_ITEMS` + clé i18n + icône.
  `apiClient.submitContactMessage(input)` ajoute `pageUrl` / `appVersion`.
- Tests : `apps/api/test/contact.test.ts` (Mocha — insertion, en-tête UA,
  champs nullables, message trop court / trop long, type inconnu),
  `contact.feature` + steps (Cypress e2e — envoi + confirmation + contexte),
  `contact-page.cy.ts` (rendu + garde `RequireAuth` + label d'erreur).
- Docs : `batch-cooking-modele.md`, `backend-architecture.md`,
  `frontend-architecture.md`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-08 08:26:47 +02:00

25 lines
1.2 KiB
Gherkin

Feature: Contact form
As a signed-in user
I want to report a bug or send a suggestion from within the app
So that the team hears about it with the technical context attached
Background:
Given I am signed in as "Alice" "Martin"
Scenario: Sending a bug report shows a confirmation and forwards the page context
Given submitting a contact message will succeed
When I visit "/parametres/contact"
And I select "Bug" from the "contactType" field
And I fill in the "contactMessage" field with "Le bouton Envoyer ne réagit pas sur la page planning."
And I click the button "Envoyer"
Then the contact request should have been sent with type "bug"
And the contact request body should carry the current page URL and app version
And I should see "Merci ! Votre message a bien été envoyé."
Scenario: A too-short message is rejected on the client, without a request
Given submitting a contact message will succeed
When I visit "/parametres/contact"
And I fill in the "contactMessage" field with "court"
And I click the button "Envoyer"
Then I should see "Le message doit faire au moins 10 caractères"
And no contact request should have been sent