summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Emanuele Stoppa <my.burning@gmail.com> 2024-05-15 08:06:44 +0100
committerGravatar GitHub <noreply@github.com> 2024-05-15 08:06:44 +0100
commite90c98fea1c294d66df3fbba8646e98dcbb34e84 (patch)
tree4743f349f3cc2418beabb7e9ed6559a9fc1772c3
parentcf8dee4d629857f9be05b2e3033c9ce46a973ac5 (diff)
downloadastro-e90c98fea1c294d66df3fbba8646e98dcbb34e84.tar.gz
astro-e90c98fea1c294d66df3fbba8646e98dcbb34e84.tar.zst
astro-e90c98fea1c294d66df3fbba8646e98dcbb34e84.zip
test: add firefox to the list of browsers to test (#11036)
-rw-r--r--package.json4
-rw-r--r--packages/astro/package.json4
-rw-r--r--packages/astro/playwright.firefox.config.js43
3 files changed, 48 insertions, 3 deletions
diff --git a/package.json b/package.json
index 1105350f5..75fbad30d 100644
--- a/package.json
+++ b/package.json
@@ -30,8 +30,8 @@
"test:smoke:docs": "turbo run build --filter=docs",
"test:check-examples": "node ./scripts/smoke/check.js",
"test:vite-ci": "turbo run test --filter=astro",
- "test:e2e": "cd packages/astro && pnpm playwright install chromium && pnpm run test:e2e",
- "test:e2e:match": "cd packages/astro && pnpm playwright install chromium && pnpm run test:e2e:match",
+ "test:e2e": "cd packages/astro && pnpm playwright install chromium firefox && pnpm run test:e2e",
+ "test:e2e:match": "cd packages/astro && pnpm playwright install chromium firefox && pnpm run test:e2e:match",
"test:e2e:hosts": "turbo run test:hosted",
"benchmark": "astro-benchmark",
"lint": "eslint . --report-unused-disable-directives",
diff --git a/packages/astro/package.json b/packages/astro/package.json
index d12048ed6..1e4187f3e 100644
--- a/packages/astro/package.json
+++ b/packages/astro/package.json
@@ -112,8 +112,10 @@
"postbuild": "astro-scripts copy \"src/**/*.astro\" && astro-scripts copy \"src/**/*.wasm\"",
"test": "pnpm run test:node",
"test:match": "pnpm run test:node --match",
- "test:e2e": "playwright test",
+ "test:e2e": "pnpm test:e2e:chrome && pnpm test:e2e:firefox",
"test:e2e:match": "playwright test -g",
+ "test:e2e:chrome": "playwright test",
+ "test:e2e:firefox": "playwright test --config playwright.firefox.config.js",
"test:node": "astro-scripts test \"test/**/*.test.js\""
},
"dependencies": {
diff --git a/packages/astro/playwright.firefox.config.js b/packages/astro/playwright.firefox.config.js
new file mode 100644
index 000000000..1934a68ed
--- /dev/null
+++ b/packages/astro/playwright.firefox.config.js
@@ -0,0 +1,43 @@
+// NOTE: Sometimes, tests fail with `TypeError: process.stdout.clearLine is not a function`
+// for some reason. This comes from Vite, and is conditionally called based on `isTTY`.
+// We set it to false here to skip this odd behavior.
+process.stdout.isTTY = false;
+
+const config = {
+ // TODO: add more tests like view transitions and audits, and fix them. Some of them are failing.
+ testMatch: ['e2e/css.test.js'],
+ /* Maximum time one test can run for. */
+ timeout: 40 * 1000,
+ expect: {
+ /**
+ * Maximum time expect() should wait for the condition to be met.
+ * For example in `await expect(locator).toHaveText();`
+ */
+ timeout: 4 * 1000,
+ },
+ /* Fail the build on CI if you accidentally left test in the source code. */
+ forbidOnly: !!process.env.CI,
+ /* Retry on CI only */
+ retries: process.env.CI ? 3 : 0,
+ /* Opt out of parallel tests on CI. */
+ workers: 1,
+ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
+ use: {
+ /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
+ actionTimeout: 0,
+ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
+ trace: 'on-first-retry',
+ },
+ projects: [
+ {
+ name: 'Firefox Stable',
+ use: {
+ browserName: 'firefox',
+ channel: 'firefox',
+ args: ['--use-gl=egl'],
+ },
+ },
+ ],
+};
+
+export default config;