Skip to content

Commit 536582f

Browse files
authored
test: running a11y test suite sequentially (#15130)
1 parent a8785ba commit 536582f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/runE2E.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,9 @@ if (!suiteName) {
9898

9999
console.log(`${allSuitesInFolder.join('\n')}\n`)
100100

101-
for (const file of allSuitesInFolder) {
102-
clearWebpackCache()
103-
executePlaywright(file, baseTestFolder, false, suiteConfigPath)
104-
}
101+
// Run all spec files in the folder with a single dev server and playwright invocation
102+
// This avoids port conflicts when multiple spec files exist in the same folder
103+
executePlaywright(allSuitesInFolder, baseTestFolder, false, suiteConfigPath)
105104
}
106105

107106
console.log('\nRESULTS:')
@@ -114,12 +113,13 @@ console.log('\n')
114113
// We need this because pnpm dev for a given test suite will always be run from the top level test folder,
115114
// not from a nested suite folder.
116115
function executePlaywright(
117-
suitePath: string,
116+
suitePaths: string | string[],
118117
baseTestFolder: string,
119118
bail = false,
120119
suiteConfigPath?: string,
121120
) {
122-
console.log(`Executing ${suitePath}...`)
121+
const paths = Array.isArray(suitePaths) ? suitePaths : [suitePaths]
122+
console.log(`Executing ${paths.join(', ')}...`)
123123
const playwrightCfg = path.resolve(
124124
dirname,
125125
`${bail ? 'playwright.bail.config.ts' : 'playwright.config.ts'}`,
@@ -148,12 +148,12 @@ function executePlaywright(
148148
},
149149
})
150150

151-
const cmd = slash(`${playwrightBin} test ${suitePath} -c ${playwrightCfg}`)
151+
const cmd = slash(`${playwrightBin} test ${paths.join(' ')} -c ${playwrightCfg}`)
152152
console.log('\n', cmd)
153153
const { code, stdout } = shelljs.exec(cmd, {
154154
cwd: path.resolve(dirname, '..'),
155155
})
156-
const suite = path.basename(path.dirname(suitePath))
156+
const suite = path.basename(path.dirname(paths[0]!))
157157
const results = { code, suiteName: suite }
158158

159159
if (code) {

0 commit comments

Comments
 (0)