2022-07-07 18:59:18 +03:00
|
|
|
import type { PlaywrightTestConfig } from '@playwright/test';
|
|
|
|
import { devices } from '@playwright/test';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Read environment variables from file.
|
|
|
|
* https://github.com/motdotla/dotenv
|
|
|
|
*/
|
|
|
|
require('dotenv').config();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* See https://playwright.dev/docs/test-configuration.
|
|
|
|
*/
|
|
|
|
const config: PlaywrightTestConfig = {
|
2022-07-20 06:22:31 +03:00
|
|
|
|
|
|
|
/* Add location of specs. */
|
2022-07-27 00:59:02 +03:00
|
|
|
testDir: 'e2e-tests/specs',
|
2022-07-20 06:22:31 +03:00
|
|
|
|
2024-04-18 03:20:00 +03:00
|
|
|
/* Maximum time one test can run for. 3 minutes */
|
|
|
|
timeout: 60 * 1000,
|
2022-07-20 06:22:31 +03:00
|
|
|
|
|
|
|
/* Global setup */
|
2022-07-27 00:59:02 +03:00
|
|
|
globalSetup: require.resolve('./e2e-tests/global-setup.ts'),
|
2022-07-07 18:59:18 +03:00
|
|
|
|
2024-04-18 03:20:00 +03:00
|
|
|
/* Max time in milliseconds the whole test suite can to prevent CI breaking. 15 minutes */
|
|
|
|
globalTimeout: 60 * 15 * 1000,
|
2022-07-07 18:59:18 +03:00
|
|
|
|
|
|
|
// adding missing snapshots for later comparison
|
|
|
|
updateSnapshots: 'missing',
|
2023-10-03 22:02:41 +03:00
|
|
|
|
2022-07-07 18:59:18 +03:00
|
|
|
expect: {
|
|
|
|
/**
|
|
|
|
* Maximum time expect() should wait for the condition to be met.
|
|
|
|
* For example in `await expect(locator).toHaveText();`
|
|
|
|
*/
|
2022-07-30 01:30:15 +03:00
|
|
|
timeout: 5_000
|
2022-07-07 18:59:18 +03:00
|
|
|
},
|
|
|
|
/* Run tests in files in parallel */
|
2024-04-18 03:20:00 +03:00
|
|
|
fullyParallel: true,
|
2022-07-07 18:59:18 +03:00
|
|
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
|
|
forbidOnly: !!process.env.CI,
|
|
|
|
/* Retry on CI only */
|
|
|
|
retries: process.env.CI ? 1 : 0,
|
|
|
|
/* Opt out of parallel tests on CI. */
|
2022-07-30 01:30:15 +03:00
|
|
|
workers: 1,
|
2022-07-07 18:59:18 +03:00
|
|
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
2023-10-05 06:35:54 +03:00
|
|
|
reporter: [
|
|
|
|
['list'],
|
|
|
|
['html'],
|
|
|
|
],
|
2022-07-07 18:59:18 +03:00
|
|
|
/* 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,
|
2022-08-26 01:32:01 +03:00
|
|
|
|
2022-07-07 18:59:18 +03:00
|
|
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
2022-08-04 07:30:12 +03:00
|
|
|
baseURL: process.env.E2E_TEST_BASE_URL || 'https://stage.fxprivaterelay.nonprod.cloudops.mozgcp.net',
|
2022-07-07 18:59:18 +03:00
|
|
|
|
|
|
|
/* automatically take screenshot only on failures */
|
|
|
|
screenshot: 'only-on-failure',
|
|
|
|
|
|
|
|
/* automatically record video on retry */
|
|
|
|
video: 'retry-with-video',
|
|
|
|
|
|
|
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
|
|
trace: 'on-first-retry',
|
2023-10-03 22:02:41 +03:00
|
|
|
},
|
2022-07-07 18:59:18 +03:00
|
|
|
|
|
|
|
/* Configure projects for major browsers */
|
|
|
|
projects: [
|
2022-09-29 19:25:55 +03:00
|
|
|
{
|
|
|
|
name: 'chromium',
|
|
|
|
use: {
|
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
},
|
|
|
|
},
|
2022-07-30 02:46:09 +03:00
|
|
|
{
|
|
|
|
name: 'firefox',
|
|
|
|
use: {
|
|
|
|
...devices['Desktop Firefox'],
|
|
|
|
},
|
|
|
|
},
|
2022-07-30 01:30:15 +03:00
|
|
|
// {
|
|
|
|
// name: 'webkit',
|
|
|
|
// use: {
|
|
|
|
// ...devices['Desktop Safari'],
|
|
|
|
// },
|
|
|
|
// },
|
2022-07-07 18:59:18 +03:00
|
|
|
|
|
|
|
/* Test against mobile viewports. */
|
|
|
|
// {
|
|
|
|
// name: 'Mobile Chrome',
|
|
|
|
// use: {
|
|
|
|
// ...devices['Pixel 5'],
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// {
|
|
|
|
// name: 'Mobile Safari',
|
|
|
|
// use: {
|
|
|
|
// ...devices['iPhone 12'],
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
],
|
|
|
|
|
|
|
|
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
|
|
|
|
outputDir: 'test-results/',
|
|
|
|
|
|
|
|
/* Run your local dev server before starting the tests */
|
|
|
|
// webServer: {
|
|
|
|
// command: 'npm run start',
|
|
|
|
// port: 3000,
|
|
|
|
// },
|
|
|
|
};
|
|
|
|
|
|
|
|
export default config;
|