@@ -8,10 +8,10 @@ const semver = require('semver');
88const spawn = require ( 'cross-spawn' ) ;
99
1010const enginePackages = {
11- puppeteer : [ 'puppeteer@5 ' ] ,
11+ puppeteer : [ 'puppeteer@21.1.1 ' ] ,
1212 playwright : [ 'playwright@1' ] ,
1313 testcafe : [ 'testcafe@1' ] ,
14- webdriverio : [ 'webdriverio@6 ' ] ,
14+ webdriverio : [ 'webdriverio@8 ' ] ,
1515} ;
1616
1717const codeceptPackages = [
@@ -128,7 +128,7 @@ async function createCodecept(opts) {
128128 } else {
129129 console . log ( `Powered by ${ chalk . yellow ( 'Playwright' ) } engine` ) ;
130130 deps . push ( enginePackages . playwright ) ;
131- }
131+ }
132132
133133 if ( ! existsSync ( 'package.json' ) ) {
134134 console . log ( 'package.json file does not exist in current dir, creating it...' ) ;
@@ -148,11 +148,11 @@ async function createCodecept(opts) {
148148 packageJson . scripts [ 'codeceptjs' ] = 'codeceptjs run --steps' ;
149149 packageJson . scripts [ 'codeceptjs:headless' ] = 'HEADLESS=true codeceptjs run --steps' ;
150150 packageJson . scripts [ 'codeceptjs:ui' ] = 'codecept-ui --app' ;
151-
151+
152152 packageJson . scripts [ 'codeceptjs:demo' ] = `codeceptjs run --steps -c ${ demoConfigFile } ` ;
153153 packageJson . scripts [ 'codeceptjs:demo:headless' ] = `HEADLESS=true codeceptjs run --steps -c ${ demoConfigFile } ` ;
154154 packageJson . scripts [ 'codeceptjs:demo:ui' ] = `codecept-ui --app -c ${ demoConfigFile } ` ;
155-
155+
156156 fs . writeJsonSync ( 'package.json' , packageJson , { spaces : 4 } ) ;
157157
158158
@@ -191,15 +191,15 @@ async function install(dependencies, verbose) {
191191 command = 'yarnpkg' ;
192192 args = [ 'add' , '-D' , '--exact' ] ;
193193 [ ] . push . apply ( args , dependencies ) ;
194-
194+
195195 // Explicitly set cwd() to work around issues like
196196 // https://github.com/facebook/create-react-app/issues/3326.
197197 // Unfortunately we can only do this for Yarn because npm support for
198198 // equivalent --prefix flag doesn't help with this issue.
199199 // This is why for npm, we run checkThatNpmCanReadCwd() early instead.
200200 args . push ( '--cwd' ) ;
201201 args . push ( root ) ;
202-
202+
203203 } else {
204204 command = 'npm' ;
205205 args = [
@@ -214,8 +214,9 @@ async function install(dependencies, verbose) {
214214 const child = spawn ( command , args , { stdio : 'inherit' } ) ;
215215 child . on ( 'close' , code => {
216216 if ( code !== 0 ) {
217+ // if using Playwright, run the command to install the browser drivers
217218 reject ( {
218- command : `${ command } ${ args . join ( ' ' ) } ` ,
219+ command : `${ args . join ( ' ' ) . includes ( 'playwright' ) } ? ${ command } ${ args . join ( ' ' ) } ; npx playwright install : ${ command } ${ args . join ( ' ' ) } ` ,
219220 } ) ;
220221 return ;
221222 }
0 commit comments