Skip to content

Commit

Permalink
feat (afup#1110): functional test
Browse files Browse the repository at this point in the history
Site public :
- Adhésion personne morale
  • Loading branch information
stakovicz committed Nov 15, 2023
1 parent 358cabf commit 6878aea
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
20 changes: 20 additions & 0 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,26 @@ public function iAmLoggedInWithTheUserAndThePassword($user, $password)
$this->minkContext->assertPageContainsText("Espace membre");
}

/**
* @Then I emulate JS collection on adhesion_entreprise.html.twig
*/
public function emulateJSCollectionAdhesionEntreprise()
{
$emailCount = 0;

$emailList = $this->minkContext->getSession()->getPage()->find('xpath', '//*[@id="company_member_invitations"]');

$newWidget = $emailList->getAttribute('data-prototype');
$newWidget = preg_replace("/__name__label__/g", 'Membre #' . ($emailCount+1), $newWidget);
$newWidget = preg_replace("/__name__/g", $emailCount, $newWidget);


$newDiv = '<div>'.$newWidget.'</div>';

// TODO ajouter le contenu de $newDiv à $emailList
// Puis réinjecter l'HTML dans Mink
}

/**
* @Then I submit the form with name :formName
*/
Expand Down
17 changes: 17 additions & 0 deletions tests/behat/features/PublicSite/Register.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,24 @@ Feature: Site Public - Register
And I fill in "company_member_email" with "registeredCompany@gmail.com"
And I fill in "company_member_phone" with "0123456"
And print last response
And I emulate JS collection on adhesion_entreprise.html.twig
And I fill in "company_member[invitations][0][email]" with "registeredUser@gmail.com"
And I press "Enregistrer mon adhésion"
And I should see "Adhésion enregistrée !"
And I should see "Montant de la cotisation: 150.00 Euros"
When I press "Régler par carte"
# Pour suivre la redirection POST de Paybox
And I submit the form with name "PAYBOX"
When I fill in "NUMERO_CARTE" with "1111222233334444"
And I select "12" from "MOIS_VALIDITE"
And I select "25" from "AN_VALIDITE"
And I fill in "CVVX" with "123"
And I press "Valider"
Then I should see "PAIEMENT ACCEPTÉ"
When I follow "Retour"
Then I should see "Le paiement de votre cotisation s'est bien passé, merci."
# Simuler l'appel de callback Paybox
And simulate the Paybox callback
And I should only receive the following emails:
| to | subject |
| <registeredUser@gmail.com> | Votre compte afup.org |

0 comments on commit 6878aea

Please sign in to comment.