Skip to content

v1.8.0 — Visual suites, theme-aware selectors, One Page Checkout 9.2, run-scoped browser

Choose a tag to compare

@PrestaEdit PrestaEdit released this 28 Sep 14:08
· 160 commits to main since this release

Upgrade to v1.8.1. 1.8.0 breaks importPage('FrontOffice') on PrestaShop 9 (so VisualTestsSuite there), and its per-suite $psVersion / onVersion() have no effect.

Highlights

  • Data-driven visual suites (#67, #68) — the groundwork for visual suites edited from the PrestaFlow app:
    • VisualTestsSuite: a suite declared with literal $devices / $locales / $checkpoints. One run = one device × locale combination, taken from the DEVICE / LOCALE globals or, on the CLI, from PRESTAFLOW_DEVICE / PRESTAFLOW_LOCALE. Checkpoints excluded for a device, or a locale that doesn't apply, are reported as skipped.
    • VisualDevices presets (desktop / tablet / mobile).
    • CommonPage::visualCheckpoint(..., array $masks = []) masks elements by selector (always removed afterwards), plus scrollBelow() and waitForStable() helpers.
    • TestsSuite::useBrowserOptions() / browserOptions() / resetBrowser(): per-run window size and user agent, and a clean shutdown of the run's browser.
  • Theme-aware selectors — pages merge the selector overrides of the theme you state (PRESTAFLOW_THEME, or per page via importPage(..., ['theme' => ...]); nothing is auto-detected, Classic is the default). Ships a Hummingbird selector map; overrides follow the page class hierarchy, and a theme can override a selector the whole area (front office / back office) inherits. The BackOffice can also switch the shop's theme.
  • One Page Checkout for PrestaShop 9.2, plus a shop-aware checkout precondition that states the layout the four-page tunnel needs.
  • Account scenarios — account creation, and a provisioner for a known test customer.
  • Per-suite PrestaShop version — onVersion() (fluent) or a suite property overrides the version for one suite.
  • --suites / PRESTAFLOW_SUITES — prestaflow run <path> --suites=BackOffice,FrontOffice/Checkout runs only those sub-folders. This is what the GitHub Action's suites input sets, and until now the library ignored it. An unknown name fails the run (a typo no longer passes as a green job that ran zero tests).
  • Multistore screens reachable from the BackOffice.
  • onAfterTest hook to stream progress out of a running suite.
  • Aggregated results — suites land in a single JSON, with the source location of each test.
  • bin/prestaflow is now exposed as a Composer binary (vendor/bin/prestaflow).
  • Symfony Console / EventDispatcher ^7 accepted alongside ^6 (#69).

Reliability

  • One browser per run. The keepAlive browser used to be found again through one socket file per machine, so a run that finished closed any other run's Chrome under it ("The page was closed and is not available anymore", emptied carts, lost sessions). Each run now owns its browser.
  • A lost browser is reported as such instead of being read as a missing element.
  • waitForPageLoaded() now actually waits (it was a no-op): it polls document.readyState, takes an optional timeout (30 s default) and throws TimeoutException.
  • The CLI exits non-zero when a run throws.
  • Every scenario step carries an assertion, and mute steps are guarded against. Four page objects stopped reporting success they never checked.
  • PRESTAFLOW_EXTRA_HEADERS is read from the process environment too.
  • PrestaShop 1.7: account creation is reached without /registration (which does not exist there).
  • Assorted page fixes: product price inside a larger element, country re-selection, listing product link (theme-overridable, waits for the click), URL placeholders with a scalar parameter.

Architecture

  • Concrete pages moved from Pages\Common\{Area}\{Name}\Page to Pages\v9\.... Common now holds only the base classes (Common\BackOffice\Page, Common\FrontOffice\Page). The v7 and v8 namespaces are backfilled as delegates of v9, so every page still resolves on every version.

Testing infrastructure

  • Flashlight compose fixture for PrestaShop 1.7, 8.2 and 9.2 (with a second shop per container), and front-office + back-office smoke suites run in CI against all three versions.

Compatibility

  • importPage() users: no change. If you referenced a concrete page class directly (PrestaFlow\Library\Pages\Common\FrontOffice\Home\Page, …), switch to PrestaFlow\Library\Pages\v9\... or go through importPage().
  • Calling a method that neither the page object nor the chrome-php Page defines now throws BadMethodCallException instead of silently returning null. A suite that relied on a mistyped call will now fail, which is intended.
  • waitForPageLoaded() can now throw TimeoutException on a page that never finishes loading.
  • A --suites / PRESTAFLOW_SUITES name that matches no folder fails the run.
  • The BROWSER.WINDOW_SIZE_* globals defaulted to a swapped 1000 × 1920 (portrait) when PRESTAFLOW_WINDOW_SIZE_WIDTH / HEIGHT were unset. They now default to 1920 × 1080. A browser launched through that path without an explicit size will render at a different size, so check any visual baselines captured that way.
  • Known limit: on the CLI, getBrowser() reuses any live browser socket without comparing its options. Call resetBrowser() between combinations that need different window sizes (the app does).

Upgrade

composer update prestaflow/php-library:^1.8