-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework account creation flow #1012
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
d59ed85
chore(frontend): add react-hook-form
Falinor 313ce61
feat(frontend): deprecate AppTextInput; create new text input based o…
Falinor 27a331b
feat(frontend): rework the email filling step
Falinor fc4780a
feat: add SignupLinkDTO
Falinor f52e827
feat(frontend): add response Image
Falinor d54f8ce
feat(frontend): rework AccountEmailActivationView
Falinor 752b4bd
feat(frontend): concat multiple errors when using the corresponding form
Falinor 5255e99
feat: add EstablishmentDTO and ProspectDTO
Falinor fad13c0
refactor(frontend): rework prospect service
Falinor c70c4fa
test(frontend): add prospect handler for MSW API
Falinor c11bd01
feat(frontend): rework AccountPasswordCreationView
Falinor 58283f4
feat(frontend): rework AccountAwaitingAccessView
Falinor 301051c
feat(frontend): rework AccountAccessForbiddenView
Falinor d2df0cd
feat(frontend): replace AccountCampaignIntentCreationView by AccountS…
Falinor 09036d6
feat(server): remove establishment’s campaign intent and priority
Falinor 0b25d1d
refactor(frontend): avoid flash effect when loading a prospect
Falinor 901f795
refactor(frontend): fix wording
Falinor adec6fa
feat(frontend): remove campaign intent
Falinor 59ec7a4
test(frontend): fix failing tests
Falinor 4cc54cd
test(e2e): test the sign up flow
Falinor 688a814
test(e2e): test the sign up flow failures
Falinor 3a265f2
feat(frontend): add a simplified Header to the guest routes
Falinor 5f465f8
fix(frontend): fix links href
Falinor 5721375
test(frontend): remove the useless Header test
Falinor 2a31419
feat(frontend): treat review comments
Falinor afd9794
test(frontend): fix failing test
Falinor 2ef9cc6
feat(frontend): remove the last account creation step
Falinor 7f74159
feat(frontend): augment DSFR theme with subtitle1 et 2
Falinor 43419ce
feat(frontend): add hook useIsDsfrReady
Falinor 42376fb
feat(frontend): add an onboarding modal on authenticated pages
Falinor c775e82
refactor(frontend): remove unused imports
Falinor ad113bb
test(frontend): fix failing tests
Falinor 6e03db2
feat(frontend): set min password characters to 12
Falinor f4b3f67
test(frontend): fix failing tests
Falinor 4575366
fix(frontend): increase the onboarding modal’s width
Falinor 6a56424
fix(frontend): revert wrong changes
Falinor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import { faker } from '@faker-js/faker/locale/fr'; | ||
|
||
describe('Sign up', () => { | ||
it('should sign up', () => { | ||
cy.visit('/connexion'); | ||
cy.get('a').contains('Créer votre compte').click(); | ||
|
||
const user = faker.internet.email(); | ||
|
||
cy.get('label') | ||
.contains(/Adresse e-mail/i) | ||
.next() | ||
.type(`${user}{enter}`); | ||
|
||
cy.location('pathname').should('eq', '/inscription/activation'); | ||
|
||
// Fetch emails from the Nodemailer API | ||
cy.request({ | ||
method: 'GET', | ||
url: `${Cypress.env('MAILER_HOST')}/email`, | ||
auth: { | ||
username: Cypress.env('MAILER_USER'), | ||
password: Cypress.env('MAILER_PASSWORD') | ||
} | ||
}).then((response) => { | ||
const emails: ReadonlyArray<Email> = response.body; | ||
const email: Email = emails | ||
.filter(subject('Activation du compte')) | ||
.filter(to(user)) | ||
.filter(unread()) | ||
.reduce((acc, email) => (acc.date > email.date ? acc : email)); | ||
const link = email.html.substring( | ||
email.html.indexOf('/inscription/mot-de-passe') | ||
); | ||
cy.visit(link); | ||
}); | ||
|
||
cy.get('label') | ||
.contains(/Définissez votre mot de passe/i) | ||
.next() | ||
.type('123QWEasd'); | ||
cy.get('label') | ||
.contains(/Confirmez votre mot de passe/i) | ||
.next() | ||
.type('123QWEasd{enter}'); | ||
|
||
cy.get('button') | ||
.contains(/Créer mon compte/i) | ||
.click(); | ||
|
||
cy.location('pathname').should('eq', '/parc-de-logements'); | ||
}); | ||
|
||
it('should await access to LOVAC', () => { | ||
cy.visit('/connexion'); | ||
cy.get('a').contains('Créer votre compte').click(); | ||
|
||
const user = '[email protected]'; | ||
|
||
cy.get('label') | ||
.contains(/Adresse e-mail/i) | ||
.next() | ||
.type(`${user}{enter}`); | ||
|
||
cy.location('pathname').should('eq', '/inscription/activation'); | ||
|
||
// Fetch emails from the Nodemailer API | ||
cy.request({ | ||
method: 'GET', | ||
url: `${Cypress.env('MAILER_HOST')}/email`, | ||
auth: { | ||
username: Cypress.env('MAILER_USER'), | ||
password: Cypress.env('MAILER_PASSWORD') | ||
} | ||
}).then((response) => { | ||
const emails: ReadonlyArray<Email> = response.body; | ||
const email: Email = emails | ||
.filter(subject('Activation du compte')) | ||
.filter(to(user)) | ||
.filter(unread()) | ||
.reduce((acc, email) => (acc.date > email.date ? acc : email)); | ||
const link = email.html.substring( | ||
email.html.indexOf('/inscription/mot-de-passe') | ||
); | ||
cy.visit(link); | ||
}); | ||
|
||
cy.location('pathname').should('eq', '/inscription/en-attente'); | ||
}); | ||
|
||
it('should forbid access to unauthorized users', () => { | ||
cy.visit('/connexion'); | ||
cy.get('a').contains('Créer votre compte').click(); | ||
|
||
const user = '[email protected]'; | ||
|
||
cy.get('label') | ||
.contains(/Adresse e-mail/i) | ||
.next() | ||
.type(`${user}{enter}`); | ||
|
||
cy.location('pathname').should('eq', '/inscription/activation'); | ||
|
||
// Fetch emails from the Nodemailer API | ||
cy.request({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍👍 |
||
method: 'GET', | ||
url: `${Cypress.env('MAILER_HOST')}/email`, | ||
auth: { | ||
username: Cypress.env('MAILER_USER'), | ||
password: Cypress.env('MAILER_PASSWORD') | ||
} | ||
}).then((response) => { | ||
const emails: ReadonlyArray<Email> = response.body; | ||
const email: Email = emails | ||
.filter(subject('Activation du compte')) | ||
.filter(to(user)) | ||
.filter(unread()) | ||
.reduce((acc, email) => (acc.date > email.date ? acc : email)); | ||
const link = email.html.substring( | ||
email.html.indexOf('/inscription/mot-de-passe') | ||
); | ||
cy.visit(link); | ||
}); | ||
|
||
cy.location('pathname').should('eq', '/inscription/impossible'); | ||
}); | ||
}); | ||
|
||
interface Email { | ||
id: string; | ||
html: string; | ||
subject: string; | ||
from: ReadonlyArray<{ | ||
address: string; | ||
name: string; | ||
}>; | ||
to: ReadonlyArray<{ | ||
address: string; | ||
name: string; | ||
}>; | ||
date: string; | ||
read: boolean; | ||
} | ||
|
||
function subject(subject: string) { | ||
return (email: Email) => email.subject === subject; | ||
} | ||
|
||
function to(recipient: string) { | ||
return (email: Email) => email.to.some((to) => to.address === recipient); | ||
} | ||
|
||
function unread() { | ||
return (email: Email) => !email.read; | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
top !