Skip to content

Commit b2a32e5

Browse files
committed
feat: add Playwright for end-to-end testing
1 parent dfa9e68 commit b2a32e5

File tree

13 files changed

+1938
-168
lines changed

13 files changed

+1938
-168
lines changed

index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ async function init() {
5656
// --with-tests / --tests (equals to `--vitest --cypress`)
5757
// --vitest
5858
// --cypress
59+
// --playwright
5960
// --eslint
6061
// --eslint-with-prettier (only support prettier through eslint for simplicity)
6162
// --force (for force overwriting)
@@ -80,6 +81,7 @@ async function init() {
8081
argv.tests ??
8182
argv.vitest ??
8283
argv.cypress ??
84+
argv.playwright ??
8385
argv.eslint
8486
) === 'boolean'
8587

@@ -98,6 +100,7 @@ async function init() {
98100
needsPinia?: boolean
99101
needsVitest?: boolean
100102
needsCypress?: boolean
103+
needsPlaywright?: boolean
101104
needsEslint?: boolean
102105
needsPrettier?: boolean
103106
} = {}
@@ -112,6 +115,7 @@ async function init() {
112115
// - Install Vue Router for SPA development?
113116
// - Install Pinia for state management?
114117
// - Add Cypress for testing?
118+
// - Add Playwright for end-to-end testing?
115119
// - Add ESLint for code quality?
116120
// - Add Prettier for code formatting?
117121
result = await prompts(
@@ -200,6 +204,19 @@ async function init() {
200204
active: 'Yes',
201205
inactive: 'No'
202206
},
207+
{
208+
name: 'needsPlaywright',
209+
type: (prev, values) => {
210+
if (isFeatureFlagsUsed || values.needsCypress) {
211+
return null
212+
}
213+
return 'toggle'
214+
},
215+
message: 'Add Playwright for End-to-End testing?',
216+
initial: false,
217+
active: 'Yes',
218+
inactive: 'No'
219+
},
203220
{
204221
name: 'needsEslint',
205222
type: () => (isFeatureFlagsUsed ? null : 'toggle'),
@@ -244,6 +261,7 @@ async function init() {
244261
needsRouter = argv.router,
245262
needsPinia = argv.pinia,
246263
needsCypress = argv.cypress || argv.tests,
264+
needsPlaywright = argv.playwright,
247265
needsVitest = argv.vitest || argv.tests,
248266
needsEslint = argv.eslint || argv['eslint-with-prettier'],
249267
needsPrettier = argv['eslint-with-prettier']
@@ -294,6 +312,9 @@ async function init() {
294312
if (needsCypressCT) {
295313
render('config/cypress-ct')
296314
}
315+
if (needsPlaywright) {
316+
render('config/playwright')
317+
}
297318
if (needsTypeScript) {
298319
render('config/typescript')
299320

@@ -395,6 +416,7 @@ async function init() {
395416
needsTypeScript,
396417
needsVitest,
397418
needsCypress,
419+
needsPlaywright,
398420
needsCypressCT,
399421
needsEslint
400422
})

0 commit comments

Comments
 (0)