@@ -8,10 +8,10 @@ const semver = require('semver');
8
8
const spawn = require ( 'cross-spawn' ) ;
9
9
10
10
const enginePackages = {
11
- puppeteer : [ 'puppeteer@5 ' ] ,
11
+ puppeteer : [ 'puppeteer@21.1.1 ' ] ,
12
12
playwright : [ 'playwright@1' ] ,
13
13
testcafe : [ 'testcafe@1' ] ,
14
- webdriverio : [ 'webdriverio@6 ' ] ,
14
+ webdriverio : [ 'webdriverio@8 ' ] ,
15
15
} ;
16
16
17
17
const codeceptPackages = [
@@ -128,7 +128,7 @@ async function createCodecept(opts) {
128
128
} else {
129
129
console . log ( `Powered by ${ chalk . yellow ( 'Playwright' ) } engine` ) ;
130
130
deps . push ( enginePackages . playwright ) ;
131
- }
131
+ }
132
132
133
133
if ( ! existsSync ( 'package.json' ) ) {
134
134
console . log ( 'package.json file does not exist in current dir, creating it...' ) ;
@@ -148,11 +148,11 @@ async function createCodecept(opts) {
148
148
packageJson . scripts [ 'codeceptjs' ] = 'codeceptjs run --steps' ;
149
149
packageJson . scripts [ 'codeceptjs:headless' ] = 'HEADLESS=true codeceptjs run --steps' ;
150
150
packageJson . scripts [ 'codeceptjs:ui' ] = 'codecept-ui --app' ;
151
-
151
+
152
152
packageJson . scripts [ 'codeceptjs:demo' ] = `codeceptjs run --steps -c ${ demoConfigFile } ` ;
153
153
packageJson . scripts [ 'codeceptjs:demo:headless' ] = `HEADLESS=true codeceptjs run --steps -c ${ demoConfigFile } ` ;
154
154
packageJson . scripts [ 'codeceptjs:demo:ui' ] = `codecept-ui --app -c ${ demoConfigFile } ` ;
155
-
155
+
156
156
fs . writeJsonSync ( 'package.json' , packageJson , { spaces : 4 } ) ;
157
157
158
158
@@ -191,15 +191,15 @@ async function install(dependencies, verbose) {
191
191
command = 'yarnpkg' ;
192
192
args = [ 'add' , '-D' , '--exact' ] ;
193
193
[ ] . push . apply ( args , dependencies ) ;
194
-
194
+
195
195
// Explicitly set cwd() to work around issues like
196
196
// https://github.com/facebook/create-react-app/issues/3326.
197
197
// Unfortunately we can only do this for Yarn because npm support for
198
198
// equivalent --prefix flag doesn't help with this issue.
199
199
// This is why for npm, we run checkThatNpmCanReadCwd() early instead.
200
200
args . push ( '--cwd' ) ;
201
201
args . push ( root ) ;
202
-
202
+
203
203
} else {
204
204
command = 'npm' ;
205
205
args = [
@@ -214,8 +214,9 @@ async function install(dependencies, verbose) {
214
214
const child = spawn ( command , args , { stdio : 'inherit' } ) ;
215
215
child . on ( 'close' , code => {
216
216
if ( code !== 0 ) {
217
+ // if using Playwright, run the command to install the browser drivers
217
218
reject ( {
218
- command : `${ command } ${ args . join ( ' ' ) } ` ,
219
+ command : `${ args . join ( ' ' ) . includes ( 'playwright' ) } ? ${ command } ${ args . join ( ' ' ) } ; npx playwright install : ${ command } ${ args . join ( ' ' ) } ` ,
219
220
} ) ;
220
221
return ;
221
222
}
0 commit comments