Skip to the content.

Tests

There is currently 2 automated tests available for :

Automated tests

End to end (user application)

The scope of the application and its features are basically covered; these tests are not yet very detailed but already allow to check the essential. It follows 3 dimensions, according to Strategy:

Prerequisites

The tests

Suites available by user type (screen size used) :

Tests have some name conventions :

À re-enregistrer — la partie « lieu » du projet clique des cases id=categorie_bistrot, id=categorie_salle… que le formulaire ne porte plus : les catégories sont depuis la 3.13.0 un Select2 multiple #categories (#117). Le reste du scénario suit le déplacement de la page vers /lieu/edit.php et le renommage de determinant en preposition_nom, mais ces clics-là ne peuvent pas être transposés sans repasser par l’enregistreur.

Running the tests on an instance

  1. in your browser, launch Selenium IDE and open project tests/ladecadanse.side
  2. disable website CSP and to detect PHP errors ensure ENV equals ‘dev’ (when Whoops error page appears, a test is garanteed to fail)
  3. select a test in a suite
  4. enter the URL to test (local, prod…)
  5. run all tests in suite

Edit

Functional (API)

Prerequisites

The application API must be configured with its access credentials defined in app/env.php (LADECADANSE_API_USER and LADECADANSE_API_KEY)

Setup

Copy tests/.env_model to a new file tests/.env and enter the values used by your tests (URL targeted and submitted credentials)

The tests

Running the tests on an instance

composer test:api

Functional (site)

Server-side tests of the user application, run with Codeception’s site suite (PhpBrowser). They cover the areas where a regression is silent and costly — permission rules, form validation, and the server-rendered contract the recent JavaScript relies on.

They are read-only: every POST is deliberately invalid, so validation fails before any UPDATE and no mail is ever sent. The suite can be replayed indefinitely on the same instance.

The one deliberate exception is UserRegisterCest::potDeMielRempliBloqueInscription, whose payload is valid except for the honeypot — the only way to prove that guard alone blocks the submission. If the honeypot ever disappears, that test fails and registers a zz-codeception-pot-de-miel account: delete it before replaying the suite.

JavaScript is out of scope here (PhpBrowser does not execute it): the beforeunload guard and the datepicker remain covered by the Selenium IDE project, while the keyboard shortcuts and the mouseless mode have unit tests in tests/js/ (vitest + jsdom, npm test).

Prerequisites

Note: tests/Api/ApiCest.php requires app/env.php at file level and codeception.yml has lint: true, so a missing app/env.php breaks even a site-only run.

Setup

In tests/.env (copied from tests/.env_model), fill in:

A past event is a read-only archive for anyone below groupe 6, so the first three fixtures must point at future events — a past one would make the “can edit” tests fail for the wrong reason. An event counts as past once 06:00:00 has struck on the day after dateEvenement.

Tests whose variables are left empty are reported as skipped, not failed.

The tests

Running the tests on an instance

composer test:site (or composer test for every suite)

Strategy

Criteria considered to build tests suites (their scope and depth)

Depth of checks in order to meet the user expectations of user actions, by order of precision and complexity to test :

  1. links respond and in their content the basic data are displayed, according to user :
    • selection by
      • filtering
        • entity type : event, lieu…
        • entity values : region, date
        • format (html, json, rss…)
      • scope
        • detail : collection or single item
        • entity detail (values selection) : summary or detailed
    • intention : view, add/edit, delete, other (report, export…)
  2. data displayed is relevant according to filter (events : date, category, etc.) and scope (as in the previous point)
  3. users are guided in expected way by handling their mistakes (error handling, particularly in forms)
  4. data is modified exactly according to user action on it
  5. special and unexpected cases are handled