Repository navigation
v1.8.0 — Visual suites, theme-aware selectors, One Page Checkout 9.2, run-scoped browser
Upgrade to v1.8.1. 1.8.0 breaks
importPage('FrontOffice')on PrestaShop 9 (soVisualTestsSuitethere), 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 theDEVICE/LOCALEglobals or, on the CLI, fromPRESTAFLOW_DEVICE/PRESTAFLOW_LOCALE. Checkpoints excluded for a device, or a locale that doesn't apply, are reported as skipped.VisualDevicespresets (desktop / tablet / mobile).CommonPage::visualCheckpoint(..., array $masks = [])masks elements by selector (always removed afterwards), plusscrollBelow()andwaitForStable()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 viaimportPage(..., ['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/Checkoutruns only those sub-folders. This is what the GitHub Action'ssuitesinput 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.
onAfterTesthook to stream progress out of a running suite.- Aggregated results — suites land in a single JSON, with the source location of each test.
bin/prestaflowis 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 pollsdocument.readyState, takes an optional timeout (30 s default) and throwsTimeoutException.- 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_HEADERSis 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}\PagetoPages\v9\....Commonnow 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 toPrestaFlow\Library\Pages\v9\...or go throughimportPage().- Calling a method that neither the page object nor the chrome-php
Pagedefines now throwsBadMethodCallExceptioninstead of silently returningnull. A suite that relied on a mistyped call will now fail, which is intended. waitForPageLoaded()can now throwTimeoutExceptionon a page that never finishes loading.- A
--suites/PRESTAFLOW_SUITESname that matches no folder fails the run. - The
BROWSER.WINDOW_SIZE_*globals defaulted to a swapped 1000 × 1920 (portrait) whenPRESTAFLOW_WINDOW_SIZE_WIDTH/HEIGHTwere 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. CallresetBrowser()between combinations that need different window sizes (the app does).
Upgrade
composer update prestaflow/php-library:^1.8