From 044178a234274e112bc8477aa3324602e068c75a Mon Sep 17 00:00:00 2001 From: Morris Brodersen Date: Sat, 28 Dec 2024 21:02:31 +0100 Subject: [PATCH] add playwright config for testing more browsers --- README.md | 5 +++++ playwright.config.js | 44 ++++++++++++++++++++++++++++++++++++++++ scripts/test-coverage.sh | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 playwright.config.js diff --git a/README.md b/README.md index d17d08c..dbd7de6 100644 --- a/README.md +++ b/README.md @@ -887,6 +887,11 @@ Thanks! ## 9. Changelog +### 12/2024 + +- Add Playwright config for testing more browsers +- Update dependencies + ### 08/2024 - Link to [Vanilla Prime](https://github.com/morris/vanilla-prime) diff --git a/playwright.config.js b/playwright.config.js new file mode 100644 index 0000000..096af33 --- /dev/null +++ b/playwright.config.js @@ -0,0 +1,44 @@ +/* global process */ +import { defineConfig, devices } from '@playwright/test'; + +export default defineConfig({ + workers: process.env.CI ? 1 : undefined, + ignoreSnapshots: !!process.env.CI, + projects: [ + { + name: 'Chromium', + use: { ...devices['Desktop Chrome'] }, + // Includes unit tests + }, + { + name: 'Firefox', + use: { ...devices['Desktop Firefox'] }, + testMatch: /e2e/, + }, + { + name: 'Safari', + use: { ...devices['Desktop Safari'] }, + testMatch: /e2e/, + }, + { + name: 'Mobile Chrome', + use: { ...devices['Pixel 5'] }, + testMatch: /e2e/, + }, + { + name: 'Mobile Safari', + use: { ...devices['iPhone 12'] }, + testMatch: /e2e/, + }, + { + name: 'Google Chrome', + use: { ...devices['Desktop Chrome'], channel: 'chrome' }, + testMatch: /e2e/, + }, + { + name: 'Microsoft Edge', + use: { ...devices['Desktop Edge'], channel: 'msedge' }, + testMatch: /e2e/, + }, + ], +}); diff --git a/scripts/test-coverage.sh b/scripts/test-coverage.sh index 53c01c8..895920c 100644 --- a/scripts/test-coverage.sh +++ b/scripts/test-coverage.sh @@ -1,3 +1,3 @@ set -e rm -rf coverage -c8 --src public --reporter text --reporter lcov playwright test $1 +c8 --src public --reporter text --reporter lcov playwright test --project Chromium $1