File tree 1 file changed +15
-3
lines changed
tests/legacy-cli/e2e/utils
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) {
48
48
49
49
console . log ( `Project ${ name } created... Installing packages.` ) ;
50
50
await installWorkspacePackages ( ) ;
51
-
52
51
await ng ( 'generate' , 'e2e' , '--related-app-name' , name ) ;
53
52
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
+
54
66
// Initialize selenium webdriver.
55
67
// Often fails the first time so attempt twice if necessary.
56
68
const runWebdriverUpdate = ( ) =>
@@ -63,11 +75,11 @@ export async function prepareProjectForE2e(name: string) {
63
75
'--gecko' ,
64
76
'false' ,
65
77
'--versions.chrome' ,
66
- '101.0.4951.41' ,
78
+ chromeDriverVersion ,
67
79
) ;
68
80
try {
69
81
await runWebdriverUpdate ( ) ;
70
- } catch ( e ) {
82
+ } catch {
71
83
await runWebdriverUpdate ( ) ;
72
84
}
73
85
You can’t perform that action at this time.
0 commit comments