Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/integration/playwright/playwright.config.ts
12926 views
1
import { defineConfig, devices } from '@playwright/test';
2
3
/**
4
* Read environment variables from file.
5
* https://github.com/motdotla/dotenv
6
*/
7
// require('dotenv').config();
8
9
const isCI = !!process.env.CI;
10
11
/**
12
* See https://playwright.dev/docs/test-configuration.
13
*/
14
export default defineConfig({
15
/* Look for test files in the "tests" directory, relative to this configuration file. */
16
testDir: "./tests",
17
snapshotPathTemplate: "{testDir}/__screenshots__/{testFilePath}/{platform}/{arg}{ext}",
18
/* Maximum time one test can run for. */
19
timeout: 30 * 1000,
20
expect: {
21
/**
22
* Maximum time expect() should wait for the condition to be met.
23
* For example in `await expect(locator).toHaveText();`
24
*/
25
timeout: 5000,
26
},
27
/* Run tests in files in parallel */
28
fullyParallel: true,
29
/* Fail the build on CI if you accidentally left test.only in the source code. */
30
forbidOnly: isCI,
31
/* Retry on CI only */
32
retries: isCI ? 2 : 0,
33
/* Opt out of parallel tests on CI. */
34
workers: isCI ? 1 : undefined,
35
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
36
reporter: [
37
["html", { open: "never" }],
38
isCI ? ['github'] : ['line'],
39
],
40
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
41
use: {
42
/* Base URL to use in actions like `await page.goto('/')`. */
43
baseURL: 'http://127.0.0.1:8080',
44
45
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
46
trace: "on-first-retry",
47
},
48
/* Configure projects for major browsers */
49
projects: [
50
{
51
name: "chromium",
52
use: { ...devices['Desktop Chrome'] },
53
},
54
55
{
56
name: "firefox",
57
use: {...devices["Desktop Firefox"] },
58
},
59
60
{
61
name: "webkit",
62
use: { ...devices["Desktop Safari"] },
63
},
64
/* Test against mobile viewports. */
65
// {
66
// name: 'Mobile Chrome',
67
// use: {
68
// ...devices['Pixel 5'],
69
// },
70
// },
71
// {
72
// name: 'Mobile Safari',
73
// use: {
74
// ...devices['iPhone 12'],
75
// },
76
// },
77
78
/* Test against branded browsers. */
79
// {
80
// name: 'Microsoft Edge',
81
// use: {
82
// channel: 'msedge',
83
// },
84
// },
85
// {
86
// name: 'Google Chrome',
87
// use: {
88
// channel: 'chrome',
89
// },
90
// },
91
],
92
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
93
// outputDir: 'test-results/',
94
95
/* Run your local dev server before starting the tests */
96
/* We use python for this but we could also try using another tool */
97
webServer: [
98
{
99
// HTTP server for rendered HTML files
100
command: 'uv run python -m http.server 8080',
101
url: 'http://127.0.0.1:8080',
102
reuseExistingServer: !isCI,
103
cwd: '../../docs/playwright',
104
stderr: 'ignore', // Suppress verbose HTTP request logs
105
},
106
{
107
// Socket.IO multiplex server for RevealJS
108
command: 'npm start',
109
url: 'http://127.0.0.1:1948',
110
reuseExistingServer: !isCI,
111
cwd: './multiplex-server',
112
timeout: 10000,
113
stderr: 'ignore', // Suppress verbose logs
114
}
115
],
116
});
117
118