mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-11-29 18:48:14 +08:00
c49c39a4a2
* Update test environments and lint configuration Update Jest (unit + integration) and Playwright (e2e) test environments. Includes stability improvements for e2e tests using newer, more stable methods per the Playwright docs. - Update Jest 26 => 27 - Update Jest-related libs (babel parser) - Update Playwright 1.8 => Playwright Test 1.18 - Update GitHub CI (action versions, job parallelization, and matrices) - Update ESLint 5 => 8 - Update ESLint-related libs (parser, prettier, Jest, Playwright) - Fix test failures on M1-based Macs - Fix e2e stability issues by replacing PW $ method calls - Fix ESLint errors - Fix incorrect CI flag on Jest runs (-ci => --ci) - Refactor e2e test runner from Jest to Playwright Test - Refactor e2e test files for Playwright Test - Refactor fix-lint script name to lint:fix for consistency - Refactor npm scripts order for readability - Remove unnecessary configs and libs - Remove example image snapshots
65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
const { devices } = require('@playwright/test');
|
|
|
|
/**
|
|
* @see https://playwright.dev/docs/test-configuration
|
|
* @type {import('@playwright/test').PlaywrightTestConfig}
|
|
*/
|
|
const config = {
|
|
// Setup / Teardown
|
|
globalSetup: './test/config/playwright.setup.js',
|
|
globalTeardown: './test/config/playwright.teardown.js',
|
|
|
|
// Test Execution
|
|
expect: {
|
|
timeout: 5000,
|
|
},
|
|
retries: process.env.CI ? 2 : 0, // Retry on CI only
|
|
testDir: './test/e2e',
|
|
timeout: 30 * 1000,
|
|
workers: process.env.CI ? 1 : undefined, // No parallel tests on CI
|
|
forbidOnly: !!process.env.CI, // Fail on CI if test.only in source
|
|
|
|
// Output
|
|
outputDir: './_playwright-results/', // screenshots, videos, traces, etc.
|
|
reporter: [
|
|
[
|
|
'html',
|
|
{
|
|
open: 'never',
|
|
outputFolder: '_playwright-report',
|
|
},
|
|
],
|
|
],
|
|
snapshotDir: './test/e2e/__snapshots__',
|
|
|
|
// Config - Shared
|
|
// See https://playwright.dev/docs/api/class-testoptions
|
|
use: {
|
|
actionTimeout: 0,
|
|
baseURL: `${process.env.TEST_HOST}`, // Allow relative page.goto() (e.g. `await page.goto('/')`).
|
|
trace: 'on-first-retry',
|
|
},
|
|
|
|
// Projects
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
},
|
|
{
|
|
name: 'firefox',
|
|
use: { ...devices['Desktop Firefox'] },
|
|
},
|
|
{
|
|
name: 'webkit',
|
|
use: { ...devices['Desktop Safari'] },
|
|
},
|
|
// {
|
|
// name: 'Mobile Safari',
|
|
// use: { ...devices['iPhone 12'] }
|
|
// },
|
|
],
|
|
};
|
|
|
|
module.exports = config;
|