to run the old cypress tests, run the following command:
START_CYPRESS=1 ./bin/e2e-test-runner
to run the new playwright tests, run the following command:
START_PLAYWRIGHT=1 ./bin/e2e-test-runner
to run the new playwright tests against an already locally running PostHog instance
LOGIN_USERNAME='my@email.address' LOGIN_PASSWORD="the-password" BASE_URL='http://localhost:8010' pnpm --filter=@posthog/playwright exec playwright test --ui
Consider adding a better selector, an intermediate step like waiting for URL or page title to change, or waiting for a critical network request to complete.
If you write a selector that is too loose and matches multiple elements, playwright will output all the matches. With a better selector for each
Error: locator.click: Error: strict mode violation: locator('text=Set a billing limit') resolved to 2 elements:
1) <span class="LemonButton__content">Set a billing limit</span> aka getByTestId('billing-limit-input-wrapper-product_analytics').getByRole('button', { name: 'Set a billing limit' })
2) <span class="LemonButton__content">Set a billing limit</span> aka getByTestId('billing-limit-input-wrapper-session_replay').getByRole('button', { name: 'Set a billing limit' })