From ab8a785e1c02fe68a4ffd52e7851a74ab1b9b4c2 Mon Sep 17 00:00:00 2001 From: Albin Date: Sun, 29 Oct 2023 14:54:20 +0100 Subject: [PATCH] feat (afup#1110): functional test Espace membres > Gestion des utilisateurs personnes morales --- .../views/site/member/index.html.twig | 9 ++-- db/seeds/Users.php | 8 +-- .../AdminPersonnesMoralesCotisations.feature | 2 +- .../Members/AdminMembersReporting.feature | 2 +- .../Tresorerie/RechercheComptable.feature | 3 +- .../behat/features/MembersArea/Index.feature | 6 +-- .../MembersArea/PersonneMorale.feature | 51 +++++++++++++++++++ 7 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 tests/behat/features/MembersArea/PersonneMorale.feature diff --git a/app/Resources/views/site/member/index.html.twig b/app/Resources/views/site/member/index.html.twig index 39400a056..7e21a9e6c 100644 --- a/app/Resources/views/site/member/index.html.twig +++ b/app/Resources/views/site/member/index.html.twig @@ -198,7 +198,8 @@ Coordonnées @@ -211,7 +212,8 @@ Personnes rattachées @@ -224,7 +226,8 @@ Profil public diff --git a/db/seeds/Users.php b/db/seeds/Users.php index 2ce283fae..95f7164ac 100644 --- a/db/seeds/Users.php +++ b/db/seeds/Users.php @@ -29,6 +29,7 @@ public function run() 'ville' => 'LYON', 'id_pays' => 'FR', 'etat' => 0, + 'max_members' => 3 ], ]; @@ -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, @@ -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, diff --git a/tests/behat/features/Admin/AdminPersonnesMoralesCotisations.feature b/tests/behat/features/Admin/AdminPersonnesMoralesCotisations.feature index 1c620ee16..beb51f692 100644 --- a/tests/behat/features/Admin/AdminPersonnesMoralesCotisations.feature +++ b/tests/behat/features/Admin/AdminPersonnesMoralesCotisations.feature @@ -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 diff --git a/tests/behat/features/Admin/Members/AdminMembersReporting.feature b/tests/behat/features/Admin/Members/AdminMembersReporting.feature index 9ae3d93b7..7c6dba12d 100644 --- a/tests/behat/features/Admin/Members/AdminMembersReporting.feature +++ b/tests/behat/features/Admin/Members/AdminMembersReporting.feature @@ -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*" diff --git a/tests/behat/features/Admin/Tresorerie/RechercheComptable.feature b/tests/behat/features/Admin/Tresorerie/RechercheComptable.feature index bdb83c782..659c6d2cb 100644 --- a/tests/behat/features/Admin/Tresorerie/RechercheComptable.feature +++ b/tests/behat/features/Admin/Tresorerie/RechercheComptable.feature @@ -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 " + And I should see "Jul 13, 2018 >" + And I should see "150.00 Dupont Raoul " diff --git a/tests/behat/features/MembersArea/Index.feature b/tests/behat/features/MembersArea/Index.feature index f70020597..6936c91e2 100644 --- a/tests/behat/features/MembersArea/Index.feature +++ b/tests/behat/features/MembersArea/Index.feature @@ -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" diff --git a/tests/behat/features/MembersArea/PersonneMorale.feature b/tests/behat/features/MembersArea/PersonneMorale.feature new file mode 100644 index 000000000..d90babf5c --- /dev/null +++ b/tests/behat/features/MembersArea/PersonneMorale.feature @@ -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 jean.raoul@mycorp.fr" + # 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 "email1@email.com" + And I press "Envoyer l'invitation" + Then I should see "L'invitation a été envoyée à l'adresse email1@email.com." + And I should only receive the following emails: + | to | subject | + | | MyCorp vous invite à profiter de son compte "Membre AFUP" | + And I should see "email1@email.com Non" + # Envoyer la dernière + Then I fill in "company_member_invitation[email]" with "email2@email.com" + 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 | + | | MyCorp vous invite à profiter de son compte "Membre AFUP" | + | | MyCorp vous invite à profiter de son compte "Membre AFUP" | + | | 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."