2024_DEV_BUT3/playwright.config.js

79 lines
2.1 KiB
JavaScript
Raw Normal View History

2024-04-01 12:55:40 +02:00
// @ts-check
2024-03-27 01:37:35 +01:00
import { defineConfig, devices } from "@playwright/test";
2024-04-01 12:55:40 +02:00
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
2024-03-27 01:37:35 +01:00
2024-04-01 12:55:40 +02:00
/**
* @see https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
testDir: "./tests",
/* Run tests in files in parallel */
2024-03-27 01:37:35 +01:00
fullyParallel: true,
2024-04-01 12:55:40 +02: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 ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
2024-03-27 01:37:35 +01:00
reporter: "html",
2024-04-01 12:55:40 +02:00
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2024-03-27 01:37:35 +01:00
use: {
2024-04-01 12:55:40 +02:00
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: "http://127.0.0.1:3000",
2024-03-27 01:37:35 +01:00
2024-04-01 12:55:40 +02:00
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
2024-03-27 01:37:35 +01:00
trace: "on-first-retry",
},
2024-04-01 12:55:40 +02:00
/* Configure projects for major browsers */
2024-03-27 01:37:35 +01:00
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
2024-04-01 12:55:40 +02:00
// {
// name: "firefox",
// use: { ...devices["Desktop Firefox"] },
// },
// {
// name: "webkit",
// use: { ...devices["Desktop Safari"] },
// },
/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
2024-03-27 01:37:35 +01:00
],
2024-04-01 12:55:40 +02:00
//Run your local dev server before starting the tests /
2024-03-27 01:37:35 +01:00
webServer: {
command: "npm run dev",
2024-04-01 12:55:40 +02:00
url: "http://127.0.0.1:3000",
reuseExistingServer: !process.env.CI,
2024-03-27 01:37:35 +01:00
},
});