Skip to content

Commit

Permalink
feat (#1110): functional test
Browse files Browse the repository at this point in the history
Espace membres > Gestion des utilisateurs personnes morales
  • Loading branch information
stakovicz committed Oct 29, 2023
1 parent d61ab6f commit 90fc8be
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 12 deletions.
9 changes: 6 additions & 3 deletions app/Resources/views/site/member/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@
</a>
<span class="member-index-item--title">Coordonnées</span>
<div class="member-index-item--link">
<a class="button-inverted button__medium" href="{{ href }}">Modifier</a>
<a class="button-inverted button__medium" title="Modifier les coordonnées"
href="{{ href }}">Modifier</a>
</div>
</div>
</div>
Expand All @@ -211,7 +212,8 @@
</a>
<span class="member-index-item--title">Personnes rattachées</span>
<div class="member-index-item--link">
<a class="button-inverted button__medium" href="{{ path('admin_company_members') }}">Modifier</a>
<a class="button-inverted button__medium" title="Modifier les personnes rattachées"
href="{{ path('admin_company_members') }}">Modifier</a>
</div>
</div>
</div>
Expand All @@ -224,7 +226,8 @@
</a>
<span class="member-index-item--title">Profil public</span>
<div class="member-index-item--link">
<a class="button-inverted button__medium" href="{{ href }}">Modifier</a>
<a class="button-inverted button__medium" title="Modifier le profil public"
href="{{ href }}">Modifier</a>
</div>

</div>
Expand Down
8 changes: 5 additions & 3 deletions db/seeds/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function run()
'ville' => 'LYON',
'id_pays' => 'FR',
'etat' => 0,
'max_members' => 3
],
];

Expand Down Expand Up @@ -87,6 +88,7 @@ public function run()
'roles' => '[]',
'id_personne_morale' => self::ID_PERSONNE_MORALE_MY_CORP,
'niveau_modules' => '00000',
'etat' => 1
],
[
'id' => self::ID_USER_PERSONNE_PHYSIQUE,
Expand Down Expand Up @@ -137,12 +139,12 @@ public function run()
'type_personne' => 1, // AFUP_COTISATION_MORALE
'id_personne' => self::ID_PERSONNE_MORALE_MY_CORP,
'montant' => 150,
'date_fin' => $dateDebutUserExpire + $oneMonthInSeconds * 12,
'numero_facture' => 'COTIS-2018-201',
'date_fin' => $now + $oneMonthInSeconds * 12,
'numero_facture' => 'COTIS-'.date('Y').'-200',
],
[
'date_debut' => $dateDebutUserExpire,
'type_personne' => 0, // AFUP_COTISATION_MORALE
'type_personne' => 0, // AFUP_COTISATION_PHYSIQUE
'id_personne' => self::ID_USER_PERSONNE_PHYSIQUE,
'montant' => 25,
'date_fin' => $now + $oneMonthInSeconds * 12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: Administration - Partie Personnes morales - cotisations
When I follow the button of tooltip "Gérer les cotisations de MyCorp"
Then I should see "Cotisations de MyCorp"
When I follow the button of tooltip "Télécharger la facture"
Then the response header "Content-disposition" should equal 'attachment; filename="MyCorp_COTIS-2018-201_13072018.pdf"'
Then the response header "Content-disposition" should match '#attachment; filename="MyCorp_COTIS-#'

@reloadDbWithTestData
Scenario: On test la gestion des cotisations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Feature: Administration - Partie Reporting
Given I am logged in as admin and on the Administration
And I follow "Reporting"
Then the ".content h2" element should contain "Statistiques concernant les membres"
Then I should see "1 Personnes physiques totales*"
Then I should see "2 Personnes physiques totales*"
Then I should see "1 Personnes physiques non rattachées à une personne morale*"
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ Feature: Administration - Trésorerie - Recherche comptable
Then the ".content h2" element should contain "Recherche comptable"
When I fill in "q" with "raoul"
And I press "Rechercher"
And I should see "Jul 13, 2018 > Jul 8, 2019 150.00 Dupont Raoul <[email protected]>"
And I should see "Jul 13, 2018 >"
And I should see "150.00 Dupont Raoul <[email protected]>"
6 changes: 3 additions & 3 deletions tests/behat/features/MembersArea/Index.feature
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ Feature: Espace membre, accueil
Given I am logged-in with the user "edmonddupont" and the password "edmonddupont"
And I follow "Espace membre"
Then I should see "Cotisations"
When I follow "Se mettre à jour"
When I follow "Consulter"
Then I should see "Payer ma cotisation"
When I follow "Télécharger la facture"
Then the response header "Content-disposition" should equal 'attachment; filename="MyCorp_COTIS-2018-201_13072018.pdf"'
Then the response header "Content-disposition" should equal 'attachment; filename="MyCorp_COTIS-2023-200_13072018.pdf"'

@reloadDbWithTestData
Scenario: Si on est pas company manager de la personne morale, on ne peux pas télécharger la facture
Given I am logged-in with the user "raoul" and the password "raoul"
And I follow "Espace membre"
Then I should see "Cotisations"
When I follow "Se mettre à jour"
When I follow "Consulter"
Then I should see "Payer ma cotisation"
Then I should not see "Télécharger la facture"
When I am on "/member/membership-fee/download?id=3"
Expand Down
51 changes: 51 additions & 0 deletions tests/behat/features/MembersArea/PersonneMorale.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Feature: Espace membre > Personne morale > Personnes rattachés

@reloadDbWithTestData
@clearEmails
Scenario: Gestions des droits
Given I am logged-in with the user "edmonddupont" and the password "edmonddupont"
And I follow "Espace membre"
Then I should see "Espace membre"
And I follow "Modifier les personnes rattachées"
# Liste des membres
Then I should see "Les membres rattachés à mon entreprise"
Then I should see "Jan Raoul Non [email protected]"
# Donner les droits
And I press "Donner les droits de gestion"
Then I should see "Le membre a été promu en tant que manager."
# Retirer les droits
And I press "Enlever les droits de gestion"
Then I should see "Le membre n'a plus accès la gestion de l'entreprise."

@reloadDbWithTestData
@clearEmails
Scenario: Invitation des membres
Given I am logged-in with the user "edmonddupont" and the password "edmonddupont"
And I follow "Espace membre"
Then I should see "Espace membre"
And I follow "Modifier les personnes rattachées"
# Envoyer une invitation
Then I fill in "company_member_invitation[email]" with "[email protected]"
And I press "Envoyer l'invitation"
Then I should see "L'invitation a été envoyée à l'adresse [email protected]."
And I should only receive the following emails:
| to | subject |
| <email1@email.com> | MyCorp vous invite à profiter de son compte "Membre AFUP" |
And I should see "[email protected] Non"
# Envoyer la dernière
Then I fill in "company_member_invitation[email]" with "[email protected]"
And I press "Envoyer l'invitation"
# Renvoyer la dernière invitation
And I press "Envoyer à nouveau"
And I should see "L'invitation a été renvoyée."
And I should only receive the following emails:
| to | subject |
| <email1@email.com> | MyCorp vous invite à profiter de son compte "Membre AFUP" |
| <email2@email.com> | MyCorp vous invite à profiter de son compte "Membre AFUP" |
| <email1@email.com> | MyCorp vous invite à profiter de son compte "Membre AFUP" |
# Invitation max bloqué
Then I should see "Vous avez actuellement 1 membre(s) rattaché(s) et 2 invitation(s) en attente."
# Annulation d'une invitation
And I press "Annuler"
Then I should see "L'invitation a été annulée."
Then I should not see "Vous avez actuellement 1 membre(s) rattaché(s) et 2 invitation(s) en attente."

0 comments on commit 90fc8be

Please sign in to comment.