Skip to content

Commit d0a19ee

Browse files
committed
feat: add Playwright for end-to-end testing
1 parent 904fa48 commit d0a19ee

13 files changed

+1462
-355
lines changed

index.ts

+22
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ async function init() {
6868
// --with-tests / --tests (equals to `--vitest --cypress`)
6969
// --vitest
7070
// --cypress
71+
// --playwright
7172
// --eslint
7273
// --eslint-with-prettier (only support prettier through eslint for simplicity)
7374
// --force (for force overwriting)
@@ -92,6 +93,7 @@ async function init() {
9293
argv.tests ??
9394
argv.vitest ??
9495
argv.cypress ??
96+
argv.playwright ??
9597
argv.eslint
9698
) === 'boolean'
9799

@@ -110,6 +112,7 @@ async function init() {
110112
needsPinia?: boolean
111113
needsVitest?: boolean
112114
needsCypress?: boolean
115+
needsPlaywright?: boolean
113116
needsEslint?: boolean
114117
needsPrettier?: boolean
115118
} = {}
@@ -124,6 +127,7 @@ async function init() {
124127
// - Install Vue Router for SPA development?
125128
// - Install Pinia for state management?
126129
// - Add Cypress for testing?
130+
// - Add Playwright for end-to-end testing?
127131
// - Add ESLint for code quality?
128132
// - Add Prettier for code formatting?
129133
result = await prompts(
@@ -212,6 +216,19 @@ async function init() {
212216
active: 'Yes',
213217
inactive: 'No'
214218
},
219+
{
220+
name: 'needsPlaywright',
221+
type: (prev, values) => {
222+
if (isFeatureFlagsUsed || values.needsCypress) {
223+
return null
224+
}
225+
return 'toggle'
226+
},
227+
message: 'Add Playwright for End-to-End testing?',
228+
initial: false,
229+
active: 'Yes',
230+
inactive: 'No'
231+
},
215232
{
216233
name: 'needsEslint',
217234
type: () => (isFeatureFlagsUsed ? null : 'toggle'),
@@ -256,6 +273,7 @@ async function init() {
256273
needsRouter = argv.router,
257274
needsPinia = argv.pinia,
258275
needsCypress = argv.cypress || argv.tests,
276+
needsPlaywright = argv.playwright,
259277
needsVitest = argv.vitest || argv.tests,
260278
needsEslint = argv.eslint || argv['eslint-with-prettier'],
261279
needsPrettier = argv['eslint-with-prettier']
@@ -306,6 +324,9 @@ async function init() {
306324
if (needsCypressCT) {
307325
render('config/cypress-ct')
308326
}
327+
if (needsPlaywright) {
328+
render('config/playwright')
329+
}
309330
if (needsTypeScript) {
310331
render('config/typescript')
311332

@@ -408,6 +429,7 @@ async function init() {
408429
needsTypeScript,
409430
needsVitest,
410431
needsCypress,
432+
needsPlaywright,
411433
needsCypressCT,
412434
needsEslint
413435
})

0 commit comments

Comments
 (0)