File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ jest.setTimeout(95000); // eslint-disable-line no-undef
55import bindAll from 'lodash.bindall' ;
66import webdriver from 'selenium-webdriver' ;
77import pathModule from 'path' ;
8- const fs = require ( 'fs' ) ;
98
109const { Button, By, until} = webdriver ;
1110
@@ -72,7 +71,8 @@ class SeleniumHelper {
7271 'getSauceDriver' ,
7372 'getLogs' ,
7473 'loadUri' ,
75- 'rightClickText'
74+ 'rightClickText' ,
75+ 'urlFor'
7676 ] ) ;
7777
7878 this . Key = webdriver . Key ; // map Key constants, for sending special keys
@@ -409,13 +409,17 @@ class SeleniumHelper {
409409 }
410410 }
411411
412+ /**
413+ * Generate a URL for the given path.
414+ * @param {string } path The path to generate a URL for.
415+ * @returns {string } The URL.
416+ */
412417 urlFor ( path ) {
413- switch ( path ) {
414- case '/' :
415- return pathModule . resolve ( __dirname , '../../build/index.html' ) ;
416- default :
417- throw new Error ( `Invalid path: ${ path } ` ) ;
418+ const baseUri = pathModule . resolve ( __dirname , '../../build/index.html' ) ;
419+ if ( path === '/' ) {
420+ return baseUri ;
418421 }
422+ return `${ baseUri } ${ path } ` ;
419423 }
420424}
421425
You can’t perform that action at this time.
0 commit comments