Skip to content

Commit

Permalink
feat (#1110): functional test
Browse files Browse the repository at this point in the history
Administration - Trésorerie :
- Synthese des évènements
- Compte bancaire
- Bilan
- Configuration
- Recherche comptable
Site public :
- Flux RSS
  • Loading branch information
stakovicz committed Oct 18, 2023
1 parent 71b6b8c commit 66c2035
Show file tree
Hide file tree
Showing 9 changed files with 185 additions and 0 deletions.
41 changes: 41 additions & 0 deletions db/seeds/Compta.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

use Phinx\Seed\AbstractSeed;

class Compta extends AbstractSeed
{
public function run()
{
$data = [
[
'idoperation' => 2,
'idcategorie' => 34,
'montant' => 1000,
'idmode_regl' => 2,
'date_regl' => '2023-10-16',
'date_ecriture' => '2023-10-17',
'description' => 'Une recette qui rapporte',
'idevenement' => 5,
'idcompte' => 1
],
[
'idoperation' => 1,
'idcategorie' => 34,
'montant' => 500,
'idmode_regl' => 2,
'date_regl' => '2023-10-17',
'date_ecriture' => '2023-10-18',
'description' => 'Une dépense très utile',
'idevenement' => 5,
'idcompte' => 1
],
];

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

$table
->insert($data)
->save();
}
}
1 change: 1 addition & 0 deletions htdocs/templates/administration/compta_synthese.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ <h2>Synthese des évènements</h2>
<option value="{$listsEvenement.id}" {if $idevnt == $listsEvenement.id} selected{/if}> {$listsEvenement.evenement}</option>
{/foreach}
</select>
<button type="submit" name="evt_submit" style="visibility: hidden">Valider</button>
</div>
</div>
</div>
Expand Down
11 changes: 11 additions & 0 deletions tests/behat/features/Admin/Tresorerie/BalanceComptable.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Feature: Administration - Trésorerie - Balance comptable

@reloadDbWithTestData
Scenario: Balance comptable afficher
Given I am logged in as admin and on the Administration
When I follow "Balance comptable"
Then the ".content h2" element should contain "Balance comptable"
And I should see "AG 500,00 1 000,00"
And I follow the button of tooltip "Voir sur la page courante"
And I should see "17/10/2023 Assurances Une recette qui rapporte 0,00 1 000,00"
And I should see "18/10/2023 Assurances Une dépense très utile 500,00 0,00"
12 changes: 12 additions & 0 deletions tests/behat/features/Admin/Tresorerie/Bilan.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Feature: Administration - Trésorerie - Bilan

@reloadDbWithTestData
Scenario: Bilan afficher
Given I am logged in as admin and on the Administration
When I follow "Bilan"
Then the ".content h2" element should contain "Bilan"
And I should see "AG 500,00"
And I should see "AG 1 000,00"
And I follow the button of tooltip "Déplier les écritures de débit/crédit pour AG"
And I should see "18/10/2023 Une dépense très utile 500,00"
And I should see "17/10/2023 Une recette qui rapporte 1 000,00"
24 changes: 24 additions & 0 deletions tests/behat/features/Admin/Tresorerie/CompteBanques.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Feature: Administration - Trésorerie - Compte banques

@reloadDbWithTestData
Scenario: Compte banques voir le journal de banque
Given I am logged in as admin and on the Administration
When I follow "Compte banques"
Then the ".content h2" element should contain "Journal de banque"
Then I should see "16/10/2023 Carte Bleue Une recette qui rapporte 1 000,00"
Then I should see "17/10/2023 Carte Bleue Une dépense très utile 500,00"
Then I should see "500,00 Total débit"
Then I should see "1 000,00 Total crédit"
Then I should see "500,00 solde"

Scenario: Compte banques Export Excel
Given I am logged in as admin and on the Administration
When I follow "Compte banques"
And I follow "Export XLSX"
Then the response header "Content-disposition" should match '#filename="compta_afup_(.*).xlsx"#'

# Scenario: Compte banques Télécharger les justificatifs triés par mois
# Given I am logged in as admin and on the Administration
# When I follow "Compte banques"
# And I follow "Télécharger les justificatifs triés par mois"
# Then the response header "Content-disposition" should match '#???#'
62 changes: 62 additions & 0 deletions tests/behat/features/Admin/Tresorerie/Configuration.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Feature: Administration - Trésorerie - Configuration

Scenario: Création/liste des évènements
Given I am logged in as admin and on the Administration
When I follow "Configuration"
Then the ".content h2" element should contain "Configuration"
When I follow "Évènements"
When I follow "Ajouter"
Then the ".content h2" element should contain "Ajouter une ligne configuration 'Evenement'"
When I fill in "evenement" with "Un super évènement"
And I press "soumettre"
Then the ".content .message" element should contain "L'écriture a été ajoutée"
And I should see "Un super évènement"

Scenario: Création/liste des catégories
Given I am logged in as admin and on the Administration
When I follow "Configuration"
Then the ".content h2" element should contain "Configuration"
When I follow "Catégories"
When I follow "Ajouter"
Then the ".content h2" element should contain "Ajouter une categorie"
When I fill in "categorie" with "Une super catégorie"
And I press "soumettre"
Then the ".content .message" element should contain "L'écriture a été ajoutée"
And I should see "Une super catégorie"

Scenario: Création/liste des opérations
Given I am logged in as admin and on the Administration
When I follow "Configuration"
Then the ".content h2" element should contain "Configuration"
When I follow "Opérations"
When I follow "Ajouter"
Then the ".content h2" element should contain "Ajouter une opération"
When I fill in "operation" with "Une super opération"
And I press "soumettre"
Then the ".content .message" element should contain "L'écriture a été ajoutée"
And I should see "Une super opération"

Scenario: Création/liste des opérations
Given I am logged in as admin and on the Administration
When I follow "Configuration"
Then the ".content h2" element should contain "Configuration"
When I follow "Modes de réglements"
When I follow "Ajouter"
Then the ".content h2" element should contain "Ajouter un type de reglement"
When I fill in "reglement" with "Un super règlement"
And I press "soumettre"
Then the ".content .message" element should contain "L'écriture a été ajoutée"
And I should see "Un super règlement"

Scenario: Création/liste des comptes
Given I am logged in as admin and on the Administration
When I follow "Configuration"
Then the ".content h2" element should contain "Configuration"
When I follow "Comptes"
When I follow "Ajouter"
Then the ".content h2" element should contain "Ajouter un compte"
When I fill in "nom_compte" with "Un super compte"
And I press "soumettre"
Then the ".content .message" element should contain "L'écriture a été ajoutée"
And I should see "Un super compte"

10 changes: 10 additions & 0 deletions tests/behat/features/Admin/Tresorerie/RechercheComptable.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Feature: Administration - Trésorerie - Recherche comptable

@reloadDbWithTestData
Scenario: Recherche Comptable pour raoul
Given I am logged in as admin and on the Administration
When I follow "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]>"
15 changes: 15 additions & 0 deletions tests/behat/features/Admin/Tresorerie/SyntheseEvenements.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Administration - Synthese des évènements

@reloadDbWithTestData
Scenario: Synthese des évènements de l'AG
Given I am logged in as admin and on the Administration
When I follow "Synthese évènement"
Then the ".content h2" element should contain "Synthese des évènements"
Then I select "5" from "idevnt"
And I press "evt_submit"
Then I should see "Assurances Une dépense très utile 500,00"
Then I should see "Assurances Une recette qui rapporte 1 000,00"
Then I should see "500,00 Total dépenses"
Then I should see "1 000,00 Total recettes"
Then I should see "500,00 Différence"

9 changes: 9 additions & 0 deletions tests/behat/features/PublicSite/Rss.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Feature: Site Public - Flux RSS

Scenario: On accède au flux RSS via le lien dans le footer
Given I am on the homepage
And I follow "Accédez au flux RSS de l'AFUP"
Then the response header "Content-type" should match '#^text/xml; charset=UTF-8$#'
And the response should contain "Le flux RSS de l'AFUP"
And the response should contain "<rss version=\"2.0\">"
And the response should contain "</rss>"

0 comments on commit 66c2035

Please sign in to comment.