Skip to content
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

JME users can become adherents #7333

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Debug behat default suite
Remg committed Jun 3, 2022

Verified

This commit was signed with the committer’s verified signature.
fiznool Tom Spencer
commit c1dc12cdd5e96710415cc8929eec8e677eb49162
62 changes: 47 additions & 15 deletions features/admin/adherent.feature
Original file line number Diff line number Diff line change
@@ -37,6 +37,37 @@ Feature: Manage adherent from admin panel
When I press "Je rejoins La République En Marche"
Then I should be on "/espace-adherent/accueil"
And I should see "Votre compte adhérent est maintenant actif."
And I should have 1 email
And I should have 1 email "AdherentAccountConfirmationMessage" for "je-mengage-user-1@en-marche-dev.fr" with payload:
"""
{
"template_name": "adherent-account-confirmation",
"template_content": [],
"message": {
"subject": "Et maintenant ?",
"from_email": "contact@en-marche.fr",
"merge_vars": [
{
"rcpt": "je-mengage-user-1@en-marche-dev.fr",
"vars": [
{
"name": "target_firstname",
"content": "Jules"
}
]
}
],
"from_name": "La République En Marche !",
"to": [
{
"email": "je-mengage-user-1@en-marche-dev.fr",
"type": "to",
"name": "Jules Fullstack"
}
]
}
}
"""
Then I go to "/deconnexion"
Then I should be on "/"

@@ -51,7 +82,6 @@ Feature: Manage adherent from admin panel

Then I follow "Connexion"
Then I should be on "/connexion"
And I should have 0 email
Then I follow "Mot de passe oublié ? Cliquez ici"
Then I should be on "/mot-de-passe-oublie"
And I fill in the following:
@@ -60,33 +90,35 @@ Feature: Manage adherent from admin panel
And I press "Envoyer un e-mail"
Then I should be on "/connexion"
And I should see "Si l'adresse que vous avez saisie est valide, un e-mail vous a été envoyé contenant un lien pour réinitialiser votre mot de passe."
And I should have 1 email
And I should have 2 emails
And I should have 1 email "AdherentResetPasswordMessage" for "je-mengage-user-1@en-marche-dev.fr" with payload:
"""
{
"template_name": "adherent-reset-password,
"template_content": [],
"template_name":"adherent-reset-password",
"template_content":[],
"message": {
"subject": "Réinitialisation de votre mot de passe",
"from_email": "contact@en-marche.fr",
"from_name": "La République En Marche !",
"subject":"Réinitialisation de votre mot de passe",
"from_email":"contact@en-marche.fr",
"global_merge_vars": [
{
"name": "first_name",
"content": "Jules"
"name":"first_name",
"content":"Jules"
},
{
"name": "reset_link",
"content": "http://enmarche.code/changer-mot-de-passe/@string@/@string@"
"name":"reset_link",
"content":"http://test.enmarche.code/changer-mot-de-passe/@uuid@/@string@"
}
],
"to": [
"from_name":"La République En Marche !",
"to":[
{
"email": "je-mengage-user-1@en-marche-dev.fr",
"type": "to",
"name": "Jules Fullstack"
"email":"je-mengage-user-1@en-marche-dev.fr",
"type":"to",
"name":"Jules Fullstack"
}
]
}
}
"""
When I click on the email link "reset_link"
Then the url should match "#^/changer-mot-de-passe/[a-z0-9-]+/[a-zA-Z0-9]+$#"
2 changes: 1 addition & 1 deletion features/registration.feature
Original file line number Diff line number Diff line change
@@ -242,7 +242,7 @@ Feature:
]
}
],
"from_name": "La R\u00e9publique En Marche !",
"from_name": "La République En Marche !",
"to": [
{
"email": "jp@test.com",
9 changes: 8 additions & 1 deletion tests/Behat/Context/EmailContext.php
Original file line number Diff line number Diff line change
@@ -42,7 +42,14 @@ public function gatherContexts(BeforeScenarioScope $scope): void
public function iShouldHaveMessages(int $number)
{
if (($nb = $this->emailRepository->count([])) !== $number) {
throw new \RuntimeException(sprintf('I found %d email(s) instead of %d', $nb, $number));
$messages = [];
if ($nb > 0) {
foreach ($this->emailRepository->findAll() as $email) {
$messages[] = sprintf('%s (%s) - ', $email->getMessageClass(), $email->getRecipientsAsString());
}
}

throw new \RuntimeException(sprintf('I found %d email(s) instead of %d. (%s)', $nb, $number, implode(', ', $messages)));
}
}