@acromedia/integration-tests
Overview
This package contains integration tests for the Gesso's Demo Sites using Playwright.
The tests are designed to run in different environments, such as production, staging, local, and merge request environmnets allowing for robust testing across multiple platforms.
Configuration
Copy the .env.example file to .env and update the values to match your environment.
If you want to run the tests against an MR environment, you can set the TEST_ENVIRONMENT
to match your merge request ID ie: TEST_ENVIRONMENT=mr-1234 and specify the platforms to tests
by setting the TEST_PLATFORMS variable to a comma-separated list of platforms ie: TEST_PLATFORMS=shopify, bigcommerce, drupal-commerce, drupal-commerce-jsonapi.
Test suites
Specs are split by whether they write to the commerce backend.
tests/read-only browses: catalogue listing, sorting, facets and price filters,
content and blog navigation, and metatags. Nothing it does outlives the page, so
any number of pipelines can run it against the same environment at once. This is
the suite CI runs.
tests/stateful writes. account.spec signs in and renames the customer it
signs in as; checkout.spec adds to the cart and drives the checkout flow, which
on some platforms reaches a "Complete Order" button behind a card number. CI does
not run it, and assertEnvironmentAcceptsWrites refuses to let it start against
production.
It is out of CI because its fixtures are shared rather than because the flows do
not matter. TEST_USERNAME is one account for the whole project, so two
pipelines running at once rename the same customer and race each other's
assertions, and nothing puts the store back afterwards. Giving each run its own
customer — registered through /account/create-account and deleted afterwards on
a best-effort basis — is what it needs before it can run unattended, at which
point a nightly job suits it better than a per-merge-request one: the drift it
catches is measured in days, not commits.
Run it by hand against a merge request or staging environment with:
pnpm test:stateful
Installation
To install the package and its dependencies, run:
pnpm install
Make sure you have the necessary dependencies installed in your environment to run Playwright tests.
Scripts
pnpm test
Runs the read-only tests in the default environment. Use this when setting TEST_ENVIRONMENT, TEST_PLATFORMS in the .env file.
pnpm test:stateful
Runs the tests that write to the backend. Never runs against production. See
Test suites before reaching for it.
pnpm test:ui
Runs the Playwright tests with the Playwright Test UI. This allows you to run tests interactively, debug, and see detailed test results.
pnpm test:production
Runs the read-only tests in the production environment.
pnpm test:staging
Runs the read-only tests in the staging environment.
pnpm test:local
Runs the read-only tests in the local environment. This is useful for testing against a local server.