1
1
import path from 'node:path'
2
2
3
3
import { defineConfig , devices } from '@playwright/experimental-ct-react'
4
+ import aliases from '@repo/dev-aliases'
4
5
5
6
// Paths
6
7
const TESTS_PATH = path . join ( __dirname , 'playwright-ct' , 'tests' )
7
8
const HTML_REPORT_PATH = path . join ( __dirname , 'playwright-ct' , 'report' )
8
9
const ARTIFACT_OUTPUT_PATH = path . join ( __dirname , 'playwright-ct' , 'results' )
9
10
const isCI = ! ! process . env . CI
11
+ const monorepoPath = path . resolve ( __dirname , '..' , '..' )
10
12
11
13
/**
12
14
* See https://playwright.dev/docs/test-configuration.
@@ -19,11 +21,11 @@ export default defineConfig({
19
21
/* Run tests in files in parallel */
20
22
fullyParallel : true ,
21
23
/* Fail the build on CI if you accidentally left test.only in the source code. */
22
- forbidOnly : ! ! process . env . CI ,
23
- /* Retry on CI only */
24
- retries : process . env . CI ? 6 : 0 ,
24
+ forbidOnly : isCI ,
25
+ /* Flaky tests require us to allow up to 6 retries */
26
+ retries : 6 ,
25
27
/* Opt out of parallel tests on CI. */
26
- workers : process . env . CI ? 1 : undefined ,
28
+ workers : isCI ? 1 : undefined ,
27
29
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
28
30
reporter : isCI
29
31
? [ [ 'list' ] , [ 'blob' ] ]
@@ -55,20 +57,20 @@ export default defineConfig({
55
57
/* Port to use for Playwright component endpoint. */
56
58
ctPort : 3100 ,
57
59
/* Configure Playwright vite config */
58
- /*
59
60
ctViteConfig : {
60
61
resolve : {
61
- alias: {
62
- ' @sanity /util/content': path.join(
63
- __dirname,
64
- './packages/@sanity/util/src/content/index.ts'
65
- ),
66
- } ,
62
+ alias : Object . fromEntries (
63
+ Object . entries ( aliases ) . map ( ( [ pkgName , pkgPath ] ) => {
64
+ return [ pkgName , path . resolve ( monorepoPath , path . join ( 'packages' , pkgPath ) ) ]
65
+ } ) ,
66
+ ) ,
67
+ dedupe : [ '@sanity/ui' , 'styled-components' ] ,
67
68
} ,
68
69
} ,
69
- */
70
70
/* Where to find playwright-ct template files */
71
71
ctTemplateDir : './playwright-ct/template' ,
72
+ /* Don't wait for animations */
73
+ contextOptions : { reducedMotion : 'reduce' } ,
72
74
} ,
73
75
74
76
/* Configure projects for major browsers */
@@ -79,6 +81,7 @@ export default defineConfig({
79
81
...devices [ 'Desktop Chrome' ] ,
80
82
permissions : [ 'clipboard-read' , 'clipboard-write' ] ,
81
83
contextOptions : {
84
+ reducedMotion : 'reduce' ,
82
85
// chromium-specific permissions
83
86
permissions : [ 'clipboard-read' , 'clipboard-write' ] ,
84
87
} ,
0 commit comments