55 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
66
77const minimist = require ( "minimist" ) ;
8- const url = require ( ' url' ) ;
9- var path = require ( ' path' ) ;
8+ const url = require ( " url" ) ;
9+ var path = require ( " path" ) ;
1010const webdriver = require ( "selenium-webdriver" ) ;
1111const firefox = require ( "selenium-webdriver/firefox" ) ;
1212const isWindows = / ^ w i n / . test ( process . platform ) ;
1313
14- addGeckoDriverToPath ( )
14+ addGeckoDriverToPath ( ) ;
1515
1616const By = webdriver . By ;
1717const until = webdriver . until ;
1818const Key = webdriver . Key ;
1919
20- const args = minimist ( process . argv . slice ( 2 ) ,
21- {
20+ const args = minimist ( process . argv . slice ( 2 ) , {
2221 boolean : [ "start" , "tests" , "websocket" ] ,
23- string : [ "location" ] ,
22+ string : [ "location" ]
2423} ) ;
2524
2625const shouldStart = args . start ;
@@ -32,16 +31,19 @@ function addGeckoDriverToPath() {
3231 // NOTE: when the launchpad is symlinked we ned to check for
3332 // geckodriver in a different location
3433 const isSymLinked = __dirname . match ( / d e v t o o l s - c o r e / ) ;
35- const relativeGeckoPath = isSymLinked ?
36- '../node_modules/geckodriver' : '../../geckodriver' ;
34+ const relativeGeckoPath = isSymLinked
35+ ? "../node_modules/geckodriver"
36+ : "../../geckodriver" ;
3737 const geckoDriverPath = path . resolve ( __dirname , relativeGeckoPath ) ;
3838 process . env . PATH = `${ geckoDriverPath } ${ path . delimiter } ${ process . env . PATH } ` ;
3939}
4040
4141function binaryArgs ( ) {
42- const connectionString = useWebSocket ? `ws:${ connectionPort } ` : `${ connectionPort } ` ;
42+ const connectionString = useWebSocket
43+ ? `ws:${ connectionPort } `
44+ : `${ connectionPort } ` ;
4345 if ( isWindows ) {
44- return [ "-start-debugger-server" , connectionString ] ; // e.g. -start-debugger-server 6080
46+ return [ "-start-debugger-server" , connectionString ] ; // e.g. -start-debugger-server 6080
4547 } else {
4648 return [ "--start-debugger-server=" + connectionString ] ; // e.g. --start-debugger-server=6080
4749 }
@@ -71,7 +73,9 @@ function firefoxProfile() {
7173function start ( _url , _options = { } ) {
7274 if ( _options . useWebSocket ) {
7375 useWebSocket = true ;
74- connectionPort = _options . webSocketPort ? _options . webSocketPort : connectionPort ;
76+ connectionPort = _options . webSocketPort
77+ ? _options . webSocketPort
78+ : connectionPort ;
7579 } else {
7680 connectionPort = _options . tcpPort ? _options . tcpPort : connectionPort ;
7781 }
@@ -88,22 +92,23 @@ function start(_url, _options = {}) {
8892
8993 let location = url . parse ( _url ) ;
9094 if ( location . protocol === null ) {
91- location . protocol = ' http:' ;
95+ location . protocol = " http:" ;
9296 }
9397 driver . get ( url . format ( location ) ) ;
9498
9599 return driver ;
96100}
97101
98102if ( shouldStart ) {
99- start ( args . location || ' about:blank' ) ;
103+ start ( args . location || " about:blank" ) ;
100104 setInterval ( ( ) => { } , 100 ) ;
101105}
102106
103107function getResults ( driver ) {
104108 driver
105109 . findElement ( By . id ( "mocha-stats" ) )
106- . getText ( ) . then ( results => {
110+ . getText ( )
111+ . then ( results => {
107112 console . log ( "results " , results ) ;
108113 const match = results . match ( / f a i l u r e s : ( \d * ) / ) ;
109114 const resultCode = parseInt ( match [ 1 ] , 10 ) > 0 ? 1 : 0 ;
0 commit comments