diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c830978..5bfc6e1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v4 - name: Install devbox - uses: jetpack-io/devbox-install-action@v0.11.0 + uses: jetify-com/devbox-install-action@v0.11.0 with: enable-cache: true devbox-version: 0.13.6 @@ -33,16 +33,15 @@ jobs: - name: Dump Playwright Information run: | - eval "$(devbox shellenv)" - echo "Playwright: `devbox run pnpm exec playwright --version`" echo "PLAYWRIGHT_BROWSERS_PATH=$PLAYWRIGHT_BROWSERS_PATH" + echo "Playwright paths in store:" + ls /nix/store | grep 'playwright' | sort -k2 -t '-' - name: Validate and Build - run: | - devbox run pnpm prep + run: devbox run pnpm prep - uses: actions/upload-artifact@v4 - if: always() + if: ${{ !cancelled() }} with: name: playwright-report path: "**/playwright-report/" diff --git a/README.md b/README.md index d411be7..f230cd4 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Read the [Devbox quickstart](https://jetpack.io/devbox/docs/contributor-quicksta The Playwright setup in this repository is a little finicky. When updating the version: - The version of `@playwright/test` in any package.json must be kept in sync with `playwright-driver` in `devbox.json`. Both should be precisely hard-coded (no semver ranges or `'latest'`). -- The nixpkgs hash in `devbox.lock` for `playwright-driver.browsers` must be manually changed to match the hash for the `playwright-driver` entry or the browsers will be the wrong version and tests will fail. +- The browser's path in `devbox.lock` for `playwright-driver.browsers` must be manually changed to match the hash for the `playwright-driver` entry (for the given platform). You can get the path with `ls /nix/store | grep 'playwright' | sort -k2 -t '-'`. ## Contributing diff --git a/devbox.json b/devbox.json index bcdb045..8a56629 100644 --- a/devbox.json +++ b/devbox.json @@ -1,20 +1,25 @@ { - "packages": [ - "difftastic@latest", - "git-branchless@latest", - "git@latest", - "mercurialFull@latest", - "nodejs@20.11.1", - "playwright-driver.browsers", - "playwright-driver@1.47.0", - "sapling@latest", - "subversion@latest", - "tree@latest", - "graphite-cli@latest" - ], + "packages": { + "difftastic": "latest", + "git-branchless": "latest", + "git": "latest", + "mercurialFull": "latest", + "nodejs": "20.11.1", + "playwright-driver.browsers": "", + "playwright-driver": "1.47.0", + "sapling": "latest", + "subversion": "latest", + "tree": "latest", + "graphite-cli": "latest", + "nix-ld": { + "version": "latest", + "platforms": ["aarch64-linux", "x86_64-linux"] + } + }, "env": { "DEVBOX_COREPACK_ENABLED": "true", - "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD": "1", - "PLAYWRIGHT_BROWSERS_PATH": "$DEVBOX_PACKAGES_DIR" + "LD_LIBRARY_PATH": "${DEVBOX_PACKAGES_DIR}/lib/:${LD_LIBRARY_PATH}", + "PLAYWRIGHT_BROWSERS_PATH": "${DEVBOX_PACKAGES_DIR}", + "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD": "1" } } diff --git a/devbox.lock b/devbox.lock index 0e70c2e..af4876f 100644 --- a/devbox.lock +++ b/devbox.lock @@ -341,6 +341,14 @@ "default": true } ] + }, + "x86_64-linux": { + "outputs": [ + { + "path": "/nix/store/3436ry676mz5yb6zfbkgmwkgj4xiyl5s-playwright-browsers", + "default": true + } + ] } } }, diff --git a/packages/satori-fit-text/playwright.config.ts b/packages/satori-fit-text/playwright.config.ts index 317550e..adb6c9c 100644 --- a/packages/satori-fit-text/playwright.config.ts +++ b/packages/satori-fit-text/playwright.config.ts @@ -69,29 +69,19 @@ export default defineConfig({ }, /* Configure projects for major browsers */ - projects: isCI - ? [ - // we can enable firefox/webkit when they ship in the `playwright-driver` - // nix linux derivation - // - // https://discourse.nixos.org/t/playwright-tests-on-multiple-browsers/41309 - projects.chromium, - ] - : [ - projects.chromium, - projects.webkit, + projects: [ + projects.chromium, + projects.firefox, + projects.webkit, - // satori doesn't currently work in Firefox without a polyfill - // projects.firefox, + /* Test against mobile viewports. */ + // projects.mobileChrome, + // projects.mobileSafari, - /* Test against mobile viewports. */ - // projects.mobileChrome, - // projects.mobileSafari, - - /* Test against branded browsers. */ - // projects.edge, - // projects.chrome, - ], + /* Test against branded browsers. */ + // projects.edge, + // projects.chrome, + ], /* Run your local dev server before starting the tests */ webServer: { diff --git a/packages/textfit/playwright.config.ts b/packages/textfit/playwright.config.ts index b466c93..2e77287 100644 --- a/packages/textfit/playwright.config.ts +++ b/packages/textfit/playwright.config.ts @@ -69,27 +69,19 @@ export default defineConfig({ }, /* Configure projects for major browsers */ - projects: isCI - ? [ - // we can enable firefox/webkit when they ship in the `playwright-driver` - // nix linux derivation - // - // https://discourse.nixos.org/t/playwright-tests-on-multiple-browsers/41309 - projects.chromium, - ] - : [ - projects.chromium, - projects.webkit, - projects.firefox, + projects: [ + projects.chromium, + projects.firefox, + projects.webkit, - /* Test against mobile viewports. */ - // projects.mobileChrome, - // projects.mobileSafari, + /* Test against mobile viewports. */ + // projects.mobileChrome, + // projects.mobileSafari, - /* Test against branded browsers. */ - // projects.edge, - // projects.chrome, - ], + /* Test against branded browsers. */ + // projects.edge, + // projects.chrome, + ], /* Run your local dev server before starting the tests */ webServer: { diff --git a/packages/use-toc-visible-sections/playwright.config.ts b/packages/use-toc-visible-sections/playwright.config.ts index f8e9fbf..4dd438e 100644 --- a/packages/use-toc-visible-sections/playwright.config.ts +++ b/packages/use-toc-visible-sections/playwright.config.ts @@ -69,27 +69,19 @@ export default defineConfig({ }, /* Configure projects for major browsers */ - projects: isCI - ? [ - // we can enable firefox/webkit when they ship in the `playwright-driver` - // nix linux derivation - // - // https://discourse.nixos.org/t/playwright-tests-on-multiple-browsers/41309 - projects.chromium, - ] - : [ - projects.chromium, - projects.firefox, - projects.webkit, + projects: [ + projects.chromium, + projects.firefox, + projects.webkit, - /* Test against mobile viewports. */ - // projects.mobileChrome, - // projects.mobileSafari, + /* Test against mobile viewports. */ + // projects.mobileChrome, + // projects.mobileSafari, - /* Test against branded browsers. */ - // projects.edge, - // projects.chrome, - ], + /* Test against branded browsers. */ + // projects.edge, + // projects.chrome, + ], /* Run your local dev server before starting the tests */ webServer: { diff --git a/packages/use-visible-elements/playwright.config.ts b/packages/use-visible-elements/playwright.config.ts index cd58e89..8ebe1bc 100644 --- a/packages/use-visible-elements/playwright.config.ts +++ b/packages/use-visible-elements/playwright.config.ts @@ -69,27 +69,19 @@ export default defineConfig({ }, /* Configure projects for major browsers */ - projects: isCI - ? [ - // we can enable firefox/webkit when they ship in the `playwright-driver` - // nix linux derivation - // - // https://discourse.nixos.org/t/playwright-tests-on-multiple-browsers/41309 - projects.chromium, - ] - : [ - projects.chromium, - projects.webkit, - projects.firefox, + projects: [ + projects.chromium, + projects.firefox, + projects.webkit, - /* Test against mobile viewports. */ - // projects.mobileChrome, - // projects.mobileSafari, + /* Test against mobile viewports. */ + // projects.mobileChrome, + // projects.mobileSafari, - /* Test against branded browsers. */ - // projects.edge, - // projects.chrome, - ], + /* Test against branded browsers. */ + // projects.edge, + // projects.chrome, + ], /* Run your local dev server before starting the tests */ webServer: { diff --git a/todo.txt b/todo.txt index 8ef8ae3..8b0d385 100644 --- a/todo.txt +++ b/todo.txt @@ -53,7 +53,7 @@ TODO: unit => tests/unit TODO: e2e => tests/e2e TODO: playwright: factor out playwright config TODO: switch playwright tests to component tests (https://playwright.dev/docs/test-components#example) -TODO: get linux into `playwright-driver.browsers` in devbox.lock, enable firefox/safari in playwright in CI +x 2024-11-02 TODO: get linux into `playwright-driver.browsers` in devbox.lock, enable firefox/safari in playwright in CI TODO: cleanup all the extraneous css use-element-observer: diff --git a/turbo.json b/turbo.json index b4c8287..027867f 100644 --- a/turbo.json +++ b/turbo.json @@ -30,7 +30,7 @@ }, "test:e2e": { "dependsOn": ["build"], - "env": ["PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD", "PLAYWRIGHT_BROWSERS_PATH"] + "env": ["DEVBOX_*", "LD_LIBRARY_PATH", "PLAYWRIGHT_*"] }, "lint": { "cache": false,