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): functional test #1342

Merged
merged 4 commits into from
Nov 19, 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
3 changes: 2 additions & 1 deletion app/Resources/views/site/news/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

{% if articles|length %}
{% for article in articles %}
<a class="article article-teaser" href="{{ path('news_display', { code: article.slug}) }}">
<a class="article article-teaser" href="{{ path('news_display', { code: article.slug}) }}"
title="Lire l'article: {{ article.title }}">
<h2>{{ article.title }}</h2>
<div class="article-date"><i>{{ article.publishedAt|localizeddate('long', 'none') }}</i></div>
<p>{{ article.getTeaser|raw }} <span class="home-read-more">Lire plus <i class="fa fa-arrow-right"></i></span></p>
Expand Down
3 changes: 3 additions & 0 deletions app/config/config_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ services:
AppBundle\Offices\OfficeFinder:
class: AppBundle\Offices\NullOfficeFinder
arguments: [ '@Geocoder\Provider\GoogleMaps' ]

ewz_recaptcha:
enabled: false
3 changes: 2 additions & 1 deletion db/seeds/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function run()
'date_fin_saisie_repas_speakers' => $event - $oneDayInSeconds * 7,
'date_fin_saisie_nuites_hotel' => $event - $oneDayInSeconds * 7,
'place_name' => 'Paris',
'place_address' => 'Marriott Rive Gauche'
'place_address' => 'Marriott Rive Gauche',
'date_annonce_planning' => date('Y-m-d', $event),
],
];

Expand Down
12 changes: 12 additions & 0 deletions db/seeds/Feuilles.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ public function run()
'image' => null,
'patterns' => null,
],
[
'id' => 89,
'id_parent' => Feuille::ID_FEUILLE_HEADER,
'nom' => 'Membres',
'lien' => '/profile/company',
'alt' => '',
'position' => 8,
'date' => 1700077154,
'etat' => 1,
'image' => null,
'patterns' => null,
],
[
'id' => Feuille::ID_FEUILLE_ANTENNES,
'id_parent' =>null,
Expand Down
18 changes: 14 additions & 4 deletions db/seeds/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function run()
'language_code' => 'fr',
'markdown' => 1,
'joindin' => 24041,
'date_publication' => $date->format('Y-m-d H:i:s')
'date_publication' => null
],
[
'session_id' => self::ID_SESSIONS[1],
Expand All @@ -59,7 +59,7 @@ public function run()
'language_code' => 'fr',
'markdown' => 0,
'joindin' => 24138,
'date_publication' => $date->format('Y-m-d H:i:s')
'date_publication' => (new \DateTime())->modify('-1 days')->format('Y-m-d H:i:s')
],
[
'session_id' => 3,
Expand All @@ -81,7 +81,7 @@ public function run()
'language_code' => 'fr',
'markdown' => 1,
'joindin' => 24041,
'date_publication' => $date->format('Y-m-d H:i:s')
'date_publication' => (new \DateTime())->modify('+5 days')->format('Y-m-d H:i:s')
],
];

Expand Down Expand Up @@ -111,6 +111,16 @@ public function run()
->save()
;

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

$table
->insert([
'id' => 1,
'nom' => 'La salle T',
'id_forum' => Event::ID_FORUM,
])
->save();

$i = 1;
$plannings = [];
Expand All @@ -120,7 +130,7 @@ public function run()
'id_session' => $session['session_id'],
'debut' => $dateDebut->format('U'),
'fin' => $date->format('U'),
'id_salle' => 0,
'id_salle' => 1,
'id_forum' => Event::ID_FORUM,
'keynote' => ''
];
Expand Down
3 changes: 2 additions & 1 deletion db/seeds/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public function run()
'code_postal' => '69001',
'ville' => 'LYON',
'id_pays' => 'FR',
'etat' => 0,
'etat' => 1,
'public_profile_enabled' => 1,
'max_members' => 3
],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ public function getCompanyBadges(CompanyMember $companyMember)

$badgesInfos = $this->sortBadgesInfos($badgesInfos);

$badgesCodes = $this->mapBadgesCodes($badgesInfos);
$badges = $this->filterExistingBadges($badgesInfos);

$badges = $this->filterExistingBadges($badgesCodes);
$badges = $this->mapBadgesCodes($badges);

return $badges;
}
Expand Down
7 changes: 6 additions & 1 deletion sources/AppBundle/Controller/MemberShipController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ public function becomeMemberAction()

public function companyAction(Request $request)
{
$subscribeForm = $this->createForm(CompanyMemberType::class);
$data = new CompanyMember();
$data->setInvitations([
(new CompanyMemberInvitation())->setManager(true)
]);

$subscribeForm = $this->createForm(CompanyMemberType::class, $data);
$subscribeForm->handleRequest($request);

if ($subscribeForm->isSubmitted() && $subscribeForm->isValid()) {
Expand Down
2 changes: 1 addition & 1 deletion tests/behat/features/Admin/Events/Salles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Administration - Évènements - Salles
When I press "Ajouter"
And I should see "La salle \"La salle ronde\" a été ajoutée."
And I should see "Liste des salles pour forum"
And I fill in "edit_room_53_name" with "La grande salle ronde"
And I fill in "edit_room_1_name" with "La grande salle ronde"
When I press "Sauvegarder"
And I should see "La salle \"La grande salle ronde\" a été sauvegardée."
And I should see "Liste des salles pour forum"
Expand Down
51 changes: 51 additions & 0 deletions tests/behat/features/Api/Api.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Feature: API pour event

@reloadDbWithTestData
Scenario: Liste du programme sans filtre
Given I am on "/blog/forum/program?apply-publication-date-filters=0&speakers-page-prefix=/forum/conferencier-e-s/"
Then the response should contain "<script type=\"application/ld+json\">"
And the response should contain "Jouons tous ensemble à un petit jeu"
And the response should contain "REST ou GraphQL ? Exemples illustrés avec Symfony et API Platform"
And the response should contain "Révolutionons PHP"

@reloadDbWithTestData
Scenario: Liste du programme avec filtre
Given I am on "/blog/forum/program?apply-publication-date-filters=1&speakers-page-prefix=/forum/conferencier-e-s/"
Then the response should contain "<script type=\"application/ld+json\">"
And the response should contain "Jouons tous ensemble à un petit jeu"
And the response should contain "REST ou GraphQL ? Exemples illustrés avec Symfony et API Platform"
And the response should not contain "Révolutionons PHP"

@reloadDbWithTestData
Scenario: Planning
Given I am on "/blog/forum/planning"
Then the response should contain "La salle T"
And the response should contain "<script type=\"application/ld+json\">"

@reloadDbWithTestData
Scenario: Speakers sans filtre
Given I am on "/blog/forum/speakers?apply-publication-date-filters=0"
Then the response should contain "<script type=\"application/ld+json\">"
And the response should contain "Adrien GALLOU"
And the response should contain "Geoffrey BACHELET"

@reloadDbWithTestData
Scenario: Speakers avec filtre
Given I am on "/blog/forum/speakers?apply-publication-date-filters=1"
Then the response should contain "<script type=\"application/ld+json\">"
And the response should not contain "Adrien GALLOU"
And the response should contain "Geoffrey BACHELET"

@reloadDbWithTestData
Scenario: Ical Talk 1
Given I am on "/blog/talk_widget?ids=1"
Then the response should contain "Jouons tous ensemble à un petit jeu"
And the response should not contain "REST ou GraphQL ? Exemples illustrés avec Symfony et API Platform"
And the response should contain "Geoffrey BACHELET"

@reloadDbWithTestData
Scenario: Ical Talk 1 et 2
Given I am on "/blog/talk_widget?ids=1,2"
Then the response should contain "Jouons tous ensemble à un petit jeu"
And the response should contain "REST ou GraphQL ? Exemples illustrés avec Symfony et API Platform"
And the response should contain "Geoffrey BACHELET"
3 changes: 2 additions & 1 deletion tests/behat/features/Api/Talks/OpenfeedbackExport.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ Feature: Export talks Openfeedback - API
Given I am on "/event/forum/openfeedback.json"
Then the response status code should be 200
And the response header "Content-Type" should match "#^application/json#"
And the response header "Content-Length" should match "#^1018#"
And the response should contain "Jouons tous ensemble \u00e0 un petit jeu"
And the response should contain "REST ou GraphQL ? Exemples illustr\u00e9s avec Symfony et API Platform"
13 changes: 13 additions & 0 deletions tests/behat/features/PublicSite/Members.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Feature: Site Public - Membres

@reloadDbWithTestData
@clearEmails
Scenario: Liste des entreprises
Given I am on the homepage
When I follow "Membres"
Then I should see "Entreprises adhérentes"
And I should see "MyCorp"
When I follow "MyCorp"
Then I should see "MyCorp"
Then I should see "L'entreprise"
Then I should see "MyCorp n'a pas renseigné d'antenne à proximité."
26 changes: 26 additions & 0 deletions tests/behat/features/PublicSite/News.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Feature: Site Public - News

@reloadDbWithTestData
Scenario: Accès à la liste des actualités
Given I am on the homepage
When I follow "Actualités"
Then I should see "Actualités"
And I should see "Les vidéos des talks du Forum PHP 2018 sont disponibles"
And I follow "Lire l'article: Les vidéos des talks du Forum PHP 2018 sont disponibles"
Then I should see "Les vidéos des talks du Forum PHP 2018 sont disponibles"
Then I should see "Cycle de conférences : forum / Année : 2018"

@reloadDbWithTestData
Scenario: Filtre sur les actualités
Given I am on the homepage
When I follow "Actualités"
Then I should see "Actualités"
And I should see "Les vidéos des talks du Forum PHP 2018 sont disponibles"
And I check "news_filters_year_0"
And I submit the form with name "news_filters"
And I should be on "/news/?news_filters[year][0]=2018"
And I should see "Les vidéos des talks du Forum PHP 2018 sont disponibles"
And I check "news_filters_theme_0"
And I submit the form with name "news_filters"
And I should be on "/news/?news_filters[theme][0]=1"
And I should not see "Les vidéos des talks du Forum PHP 2018 sont disponibles"
58 changes: 57 additions & 1 deletion tests/behat/features/PublicSite/Register.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Feature: Site Public - Register

@reloadDbWithTestData
@clearEmails
Scenario: Accès à l'adhésion particulier
Given I am on the homepage
When I follow "Adhérer"
Expand All @@ -19,4 +20,59 @@ Feature: Site Public - Register
And I fill in "confirmation_mot_de_passe" with "test"
And I press "Ajouter"
Then I should see "Espace membre"
And I should see " Merci pour votre inscription. Il ne reste plus qu'à régler votre cotisation."
And I should see "Merci pour votre inscription. Il ne reste plus qu'à régler votre cotisation."
When I follow "Se mettre à jour"
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 |

@reloadDbWithTestData
@clearEmails
Scenario: Accès à l'adhésion entreprise
Given I am on the homepage
When I follow "Adhérer"
Then I should see "Devenir membre de l'AFUP"
When I follow "Adhérer en tant qu'entreprise"
Then I should see "Adhésion entreprise à l'AFUP"
When I fill in "company_member_companyName" with "Une société"
And I fill in "company_member_siret" with "123456789"
And I fill in "company_member_address" with "45 rue des Roses"
And I fill in "company_member_zipcode" with "69003"
And I fill in "company_member_city" with "LYON"
And I fill in "company_member_firstName" with "Mon prénom de dirigeant"
And I fill in "company_member_lastName" with "Mon nom de dirigeant"
And I fill in "company_member_email" with "registeredCompany@gmail.com"
And I fill in "company_member_phone" with "0123456"
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> | Une société vous invite à profiter de son compte "Membre AFUP" |
Loading