1/**2 * Copyright (c) Meta Platforms, Inc. and affiliates.3 *4 * This source code is licensed under the MIT license found in the5 * LICENSE file in the root directory of this source tree.6 */78import {defineConfig, devices} from '@playwright/test';9import path from 'path';1011// Use process.env.PORT by default and fallback to port 300012const PORT = process.env.PORT || 3000;1314// Set webServer.url and use.baseURL with the location of the WebServer respecting the correct set port15const baseURL = `http://localhost:${PORT}`;1617// Reference: https://playwright.dev/docs/test-configuration18export default defineConfig({19 // Timeout per test20 timeout: 30 * 1000,21 // Run all tests in parallel.22 fullyParallel: true,23 // Test directory24 testDir: path.join(__dirname, '__tests__/e2e'),25 // If a test fails, retry it additional 2 times26 retries: 5,27 // Artifacts folder where screenshots, videos, and traces are stored.28 outputDir: 'test-results/',29 // Note: we only use text snapshots, so its safe to omit the host environment name30 snapshotPathTemplate: '{testDir}/__snapshots__/{testFilePath}/{arg}{ext}',3132 // Run your local dev server before starting the tests:33 // https://playwright.dev/docs/test-advanced#launching-a-development-web-server-during-the-tests34 webServer: {35 command: 'yarn dev',36 url: baseURL,37 timeout: 300 * 1000,38 reuseExistingServer: !process.env.CI,39 },4041 // 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot'42 // default 'list' when running locally43 reporter: process.env.CI ? 'github' : 'list',4445 use: {46 // Use baseURL so to make navigations relative.47 // More information: https://playwright.dev/docs/api/class-testoptions#test-options-base-url48 baseURL,4950 // Retry a test if its failing with enabled tracing. This allows you to analyze the DOM, console logs, network traffic etc.51 // More information: https://playwright.dev/docs/trace-viewer52 trace: 'retry-with-trace',5354 // All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context55 // contextOptions: {56 // ignoreHTTPSErrors: true,57 // },58 viewport: {width: 1920, height: 1080},59 },6061 projects: [62 {63 name: 'chromium',64 use: {65 ...devices['Desktop Chrome'],66 viewport: {width: 1920, height: 1080},67 },68 },69 // {70 // name: 'Desktop Firefox',71 // use: {72 // ...devices['Desktop Firefox'],73 // },74 // },75 // {76 // name: 'Desktop Safari',77 // use: {78 // ...devices['Desktop Safari'],79 // },80 // },81 // Test against mobile viewports.82 // {83 // name: "Mobile Chrome",84 // use: {85 // ...devices["Pixel 5"],86 // },87 // },88 // {89 // name: "Mobile Safari",90 // use: devices["iPhone 12"],91 // },92 ],93});
Findings
✓ No findings reported for this file.