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

feat (afup#1110): functionals tests #1329

Merged
merged 5 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions app/Resources/views/admin/planete/feed_list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@
{% if feed.status == 1 %}
{% if testFeeds and feed.id in feedResults|keys %}
{% set color = feedResults[feed.id] ? 'green' : 'red' %}
{% set text = feedResults[feed.id] ? 'validé' : 'erreur' %}
{% endif %}
<i class="flag {{ color|default('blue') }} checkered icon"></i>
{{ text|default('non testé') }}
{% endif %}
</td>
<td style="text-align: right">
Expand Down
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
2 changes: 1 addition & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ parameters:
icon: "tag"
elements:
configuration:
nom: 'Configuration'
nom: 'Configuration du site'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il y a une autre entrée dans le menu qui est Configuration.

niveau: 'ROLE_ADMIN'
membre_administrateur:
nom: 'Administrateurs du site'
Expand Down
43 changes: 43 additions & 0 deletions db/seeds/FeedArticle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

use Phinx\Seed\AbstractSeed;

class FeedArticle extends AbstractSeed
{
public function run()
{
$feed = [
'nom' => 'Un super site PHP',
'url' => 'https://afup.org',
'feed' => 'https://afup.org/rss.xml',
'etat' => 0,
];
$table = $this->table('afup_planete_flux');
$table->truncate();

$table
->insert($feed)
->save();

$data = [
[
'afup_planete_flux_id' => 2,
'clef' => '0482a33e-7370-11ee-b962-0242ac120002',
'titre' => 'Un titre',
'url' => 'https://afup.org/url.html',
'maj' => time(),
'auteur' => 'Un super auteur',
'resume' => 'Un super article',
'contenu' => 'Le contenu du super article',
'etat' => 1
],
];

$table = $this->table('afup_planete_billet');
$table->truncate();

$table
->insert($data)
->save();
}
}
23 changes: 23 additions & 0 deletions db/seeds/NiveauPartenariat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

use Phinx\Seed\AbstractSeed;

class NiveauPartenariat extends AbstractSeed
{
public function run()
{
$data = [
['titre' => 'Platine'],
['titre' => 'Or'],
['titre' => 'Argent'],
['titre' => 'Bronze'],
];

$table = $this->table('afup_niveau_partenariat');
$table->truncate();

$table
->insert($data)
->save();
}
}
14 changes: 12 additions & 2 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,8 +139,16 @@ 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_PHYSIQUE
'id_personne' => self::ID_USER_PERSONNE_PHYSIQUE,
'montant' => 25,
'date_fin' => $now + $oneMonthInSeconds * 12,
'numero_facture' => 'COTIS-'.date('Y').'-201',
]
];

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
19 changes: 19 additions & 0 deletions tests/behat/features/Admin/Divers/Administrateurs.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Feature: Administration - Administrateurs du site

@reloadDbWithTestData
Scenario: Afficher / modifier les administrateurs du site
Given I am logged in as admin and on the Administration
And I follow "Administrateurs du site"
Then I should see "Administrateurs du site"
And I should see "Admin Admin Actif Administrateur"
And I follow the button of tooltip "Modifier la fiche de Admin Admin"
And I should see "Modifier une personne physique"
And I fill in "user_edit_lastname" with "SuperLastnameAdmin"
And I fill in "user_edit_firstname" with "SuperFirstnameAdmin"
And I fill in "user_edit_address" with "Address"
And I fill in "user_edit_zipcode" with "77777"
And I fill in "user_edit_city" with "City"
And I press "Modifier"
Then the ".content .message" element should contain "La personne physique a été modifiée"
And I follow "Administrateurs du site"
And I should see "SuperLastnameAdmin SuperFirstnameAdmin Actif Administrateur"
12 changes: 12 additions & 0 deletions tests/behat/features/Admin/Divers/Configuration.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Feature: Administration - Configuration

@reloadDbWithTestData
Scenario: Afficher / modifier l'adresse
Given I am logged in as admin and on the Administration
And I follow "Configuration du site"
Then I should see "Configuration"
And I should see "32, Boulevard de Strasbourg CS 30108"
And I fill in "afup|adresse" with "32, Boulevard de Nantes CS 30108"
When I press "Enregistrer"
Then the ".content .message" element should contain "La configuration a été enregistrée"
And I should see "32, Boulevard de Nantes CS 30108"
8 changes: 8 additions & 0 deletions tests/behat/features/Admin/Divers/Logs.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Feature: Administration - Logs

@reloadDbWithTestData
Scenario: Afficher les logs
Given I am logged in as admin and on the Administration
And I follow "Logs"
Then I should see "Logs"
And I should see "Date Nom Prénom Texte"
38 changes: 38 additions & 0 deletions tests/behat/features/Admin/Divers/Sponsors.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Feature: Administration - Sponsors/Partenaires

@reloadDbWithTestData
Scenario: Afficher Sponsors/Partenaires création / modification / suppression
Given I am logged in as admin and on the Administration
And I follow "Sponsors/Partenaires"
Then I should see "Liste des sponsors/partenaires de forum"
And I should see "Aucun inscrit"
# Création
When I follow "Ajouter un partenaire"
Then I should see "Ajouter un partenaire"
# Choix du Forum
And I fill in "id_forum" with "1"
# Choix du niveau Or
And I fill in "id_niveau_partenariat" with "2"
And I fill in "ranking" with "42"
And I fill in "nom" with "Un partenaire en Or"
And I fill in "presentation" with "La présentation du partenaire en Or"
And I fill in "site" with "https://www.exemple.com"
And I attach the file "avatar1.png" to "logo"
When I press "Soumettre"
# Liste
Then the ".content .message" element should contain "Le partenaire a été ajouté"
And I should see "forum Or Un partenaire en Or https://www.exemple.com avatar1.png 42"
# Modification
When I follow "Modifier le partenaire Un partenaire en Or"
Then I should see "Partenaire de forum"
And I fill in "ranking" with "73"
And I fill in "nom" with "Un partenaire modifié"
And I fill in "presentation" with "La présentation du partenaire modifié"
And I fill in "site" with "https://www.exemple.com/updated"
When I press "Soumettre"
Then the ".content .message" element should contain "Le partenaire a été modifié"
And I should see "forum Or Un partenaire modifié https://www.exemple.com/updated avatar1.png 73"
# Suppression
When I follow "Supprimer le partenaire Un partenaire modifié"
Then the ".content .message" element should contain "Le partenaire a été supprimé"
And I should see "Aucun inscrit"
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*"
8 changes: 8 additions & 0 deletions tests/behat/features/Admin/PlanetePHP/BIllets.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Feature: Administration - Planète PHP - Billets

@reloadDbWithTestData
Scenario: Gestion des flux
Given I am logged in as admin and on the Administration
When I follow "Billets"
Then the ".content h2" element should contain "Billets"
And I should see "Un titre Le contenu du super article Actif"
31 changes: 31 additions & 0 deletions tests/behat/features/Admin/PlanetePHP/Flux.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Feature: Administration - Planète PHP - Flux

Scenario: Gestion des flux
Given I am logged in as admin and on the Administration
When I follow "Flux"
Then the ".content h2" element should contain "Flux"
# Ajout d'un flux
When I follow "Ajouter"
Then the ".content h2" element should contain "Ajouter un flux"
When I fill in "feed_form[name]" with "Site web les-tilleuls.coop"
And I fill in "feed_form[url]" with "https://les-tilleuls.coop"
And I fill in "feed_form[feed]" with "https://les-tilleuls.coop/feed.xml"
And I press "Ajouter"
Then the ".content .message" element should contain "Le flux a été ajouté"
# Liste des flux
And I should see "les-tilleuls.coop https://les-tilleuls.coop Actif Oui non testé"
# Test de validité
When I follow "Test validité"
And I should see "les-tilleuls.coop https://les-tilleuls.coop Actif Oui validé"
# Modification + désactivation d'un flux
When I follow the button of tooltip "Modifier la fiche de Site web les-tilleuls.coop"
Then the ".content h2" element should contain "Modifier un flux"
When I fill in "feed_form[name]" with "Site web les-tilleuls.coop modifié"
And I select "0" from "feed_form[status]"
And I press "Modifier"
Then the ".content .message" element should contain "Le flux a été modifié"
And I should see "les-tilleuls.coop modifié https://les-tilleuls.coop Inactif"
# Suppression
When I follow the button of tooltip "Supprimer la fiche de Site web les-tilleuls.coop modifié"
Then the ".content .message" element should contain "Le flux a été supprimé"
And I should not see "les-tilleuls.coop"
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."
Loading
Loading