Write browser-based tests for complex workflows, using real integrations to validate customer workflows.

Unlike our traditional end-to-end framework, these tests are designed to be run against a local instance or a staging site. This means that we have no access to fixtures or mocks — instead we need to instruct the browser to set things up in a resilient way to ensure our tests are reliable.

Playwright has some really great docs, located here:

Writing Tests | Playwright

To check whether something is as you expect, you can use Assertions:

Assertions | Playwright

Setup

  1. Install browsers for Playwright — this will go into gstenv eventually, but is currently achieved with: yarn test:browser:setup from the Ghost/ghost/core directory
  2. Login to Stripe CLI — stripe login (this is used for Stripe webhooks)
  3. Setup Stripe Connect
    1. In the Stripe web UI, click on Connect on the side bar and then follow the instructions to setup as a platform
  4. Run the browser tests from the top-level of the repo:
STRIPE_ACCOUNT_ID=acct_1234  \\
STRIPE_PUBLISHABLE_KEY=pk_test_1234 \\
STRIPE_SECRET_KEY=sk_test_12345 \\
yarn test:browser

Alternatively, you can export the keys or add them to your shell profile and then you only need to run yarn test:browser each time you run the tests.

This command will build and run Ghost, Admin, and all of the frontend apps like portal and comments locally, then run the browser test suite against them.

Other commands: