-
Notifications
You must be signed in to change notification settings - Fork 7
chore(playwright): introduce playwright & screenshot test #717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
qw-in
merged 18 commits into
main
from
quinn/eng-201-introduce-playwright-for-baseline-integration-testing
Dec 10, 2025
Merged
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
31711a3
chore(playwright): introduce playwright & screenshot test
qw-in 4a9dbf9
chore(playwright): add ARCJET_ENV that was missing in CI
qw-in 39e1104
chore(playwright): fix single worker in CI
qw-in dc1bbaa
chore(playwright): cache npm & try 4 workers
qw-in 18c2a9b
chore(playwright): what if moar workers magically fixes it?
qw-in 0322942
chore(playwright): try headless on smaller sample
qw-in 5277702
chore(playwright): tune maxDiffPixelRatio
qw-in 3984194
chore(playwright): try full suite
qw-in 473c77d
chore(playwright): try disabling aliasing for some larger images
qw-in 07c5031
chore(playwright): see if anti-aliasing is stable
qw-in 1e0677b
chore(playwright): full run with anti-aliasing update
qw-in 2c8dc33
chore(playwright): try maxDiffPixels not ratio
qw-in d1e8523
chore(playwright): fix the intentional bug
qw-in 64c55e1
chore(playwright): add contributing
qw-in de2c6cb
chore(playwright): remove old timeout comment
qw-in 6cc368d
chore(playwright): update maxDiff comment
qw-in 3ee0c4c
chore(playwright): tweak md wording
qw-in 3d5ffc6
chore(playwright): add status and path check
qw-in File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: Playwright tests | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| jobs: | ||
| test: | ||
| # timeout-minutes: 10 | ||
| # Lets get a baseline for how long this actually takes | ||
| # Runs in <1m on my local machine... | ||
| timeout-minutes: 30 | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Harden Runner | ||
| uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 | ||
| with: | ||
| egress-policy: audit | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| with: | ||
| cache: npm | ||
| node-version: lts/* | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Install Playwright Browsers | ||
| run: npm run pw:install | ||
| - name: Run Playwright tests | ||
| run: npm run pw:run | ||
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| if: ${{ !cancelled() }} | ||
| with: | ||
| name: playwright-report | ||
| path: playwright-report/ | ||
| retention-days: 30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { | ||
| defineConfig, | ||
| devices, | ||
| type PlaywrightTestConfig, | ||
| } from "@playwright/test"; | ||
|
|
||
| let baseURL: string | undefined = process.env.PLAYWRIGHT_BASE_URL; | ||
| let webServer: PlaywrightTestConfig["webServer"] = undefined; | ||
|
|
||
| if (!baseURL) { | ||
| baseURL = "http://localhost:4321"; | ||
| webServer = { | ||
| command: | ||
| "npm run astro build && npm run astro -- preview --port 4321 --host 0.0.0.0", | ||
| env: { | ||
| // We need an Arcjet key for the dev server to run, but it doesn't | ||
| // actually need to be valid for the tests to run. | ||
| ARCJET_KEY: "ajkey_dummy", | ||
| // See astro.config.mts for context. | ||
| ASTRO_FORCE_NODE_ADAPTER: "1", | ||
| }, | ||
| port: 4321, | ||
| reuseExistingServer: !process.env.CI, | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * See https://playwright.dev/docs/test-configuration. | ||
| */ | ||
| export default defineConfig({ | ||
| forbidOnly: !!process.env.CI, | ||
| fullyParallel: true, | ||
| projects: [ | ||
| { | ||
| name: "chromium", | ||
| use: { | ||
| ...devices["Desktop Chrome"], | ||
| launchOptions: { | ||
| args: [ | ||
| "--font-render-hinting=none", | ||
| "--disable-lcd-text", | ||
| "--disable-font-subpixel-positioning", | ||
| ], | ||
| }, | ||
| }, | ||
| }, | ||
| ], | ||
| reporter: [["html", { host: "0.0.0.0" }]], | ||
| retries: process.env.CI ? 1 : 0, | ||
| testDir: "./tests", | ||
| use: { | ||
| baseURL, | ||
| headless: true, | ||
| trace: "on-first-retry", | ||
| }, | ||
| workers: process.env.CI ? 2 : undefined, | ||
| webServer, | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.