File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
tests/legacy-cli/e2e/utils Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -48,9 +48,21 @@ export async function prepareProjectForE2e(name: string) {
4848
4949 console . log ( `Project ${ name } created... Installing packages.` ) ;
5050 await installWorkspacePackages ( ) ;
51-
5251 await ng ( 'generate' , 'e2e' , '--related-app-name' , name ) ;
5352
53+ const protractorPath = require . resolve ( 'protractor' ) ;
54+ const webdriverUpdatePath = require . resolve ( 'webdriver-manager/selenium/update-config.json' , {
55+ paths : [ protractorPath ] ,
56+ } ) ;
57+ const webdriverUpdate = JSON . parse ( await readFile ( webdriverUpdatePath ) ) as {
58+ chrome : { last : string } ;
59+ } ;
60+
61+ const chromeDriverVersion = webdriverUpdate . chrome . last . match ( / c h r o m e d r i v e r _ ( [ \d | \. ] + ) / ) ?. [ 1 ] ;
62+ if ( ! chromeDriverVersion ) {
63+ throw new Error ( 'Could not extract chrome webdriver version.' ) ;
64+ }
65+
5466 // Initialize selenium webdriver.
5567 // Often fails the first time so attempt twice if necessary.
5668 const runWebdriverUpdate = ( ) =>
@@ -63,11 +75,11 @@ export async function prepareProjectForE2e(name: string) {
6375 '--gecko' ,
6476 'false' ,
6577 '--versions.chrome' ,
66- '101.0.4951.41' ,
78+ chromeDriverVersion ,
6779 ) ;
6880 try {
6981 await runWebdriverUpdate ( ) ;
70- } catch ( e ) {
82+ } catch {
7183 await runWebdriverUpdate ( ) ;
7284 }
7385
You can’t perform that action at this time.
0 commit comments