all repos — caroster @ add-playwright

[Octree] Group carpool to your event https://caroster.io

frontend/playwright.config.ts (view raw)

 1import {defineConfig, devices} from '@playwright/test';
 2
 3/**
 4 * Read environment variables from file.
 5 * https://github.com/motdotla/dotenv
 6 */
 7require('dotenv').config();
 8
 9/**
10 * See https://playwright.dev/docs/test-configuration.
11 */
12export default defineConfig({
13  testDir: './tests',
14  outputDir: './tests/playwright/test-results',
15  /* Run tests in files in parallel */
16  fullyParallel: true,
17  /* Fail the build on CI if you accidentally left test.only in the source code. */
18  forbidOnly: !!process.env.CI,
19  /* Retry on CI only */
20  retries: process.env.CI ? 2 : 0,
21  /* Opt out of parallel tests on CI. */
22  workers: 1, //process.env.CI ? 1 : undefined,
23  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
24  reporter: 'html',
25  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
26  use: {
27    /* Base URL to use in actions like `await page.goto('/')`. */
28    baseURL: 'http://localhost:3000',
29
30    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
31    trace: 'on-first-retry',
32  },
33
34  /* Configure projects for major browsers */
35  projects: [
36    {
37      name: 'setup',
38      testMatch: /.*\.setup\.ts/,
39      use: {...devices['Desktop Firefox']},
40    },
41    {
42      name: 'chromium',
43      use: {...devices['Desktop Chrome']},
44    },
45
46    {
47      name: 'firefox',
48      use: {...devices['Desktop Firefox']},
49    },
50
51    // {
52    //   name: 'webkit',
53    //   use: {...devices['Desktop Safari']},
54    // },
55
56    /* Test against mobile viewports. */
57    // {
58    //   name: 'Mobile Chrome',
59    //   use: { ...devices['Pixel 5'] },
60    // },
61    // {
62    //   name: 'Mobile Safari',
63    //   use: { ...devices['iPhone 12'] },
64    // },
65
66    /* Test against branded browsers. */
67    // {
68    //   name: 'Microsoft Edge',
69    //   use: { ...devices['Desktop Edge'], channel: 'msedge' },
70    // },
71    // {
72    //   name: 'Google Chrome',
73    //   use: { ...devices['Desktop Chrome'], channel: 'chrome' },
74    // },
75  ],
76
77  /* Run your local dev server before starting the tests */
78  webServer: [
79    {
80      command: 'yarn start',
81      url: 'http://localhost:3000',
82      reuseExistingServer: !process.env.CI,
83    },
84    // {
85    //   command: 'cd ../backend && NODE_ENV=test yarn start',
86    //   url: 'http://localhost:1337',
87    //   reuseExistingServer: true,
88    //   timeout: 200000,
89    // },
90  ],
91});