This repository was archived by the owner on Dec 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +55
-17
lines changed Expand file tree Collapse file tree 6 files changed +55
-17
lines changed Original file line number Diff line number Diff line change
1
+ var launch = require ( '../lib' ) ;
2
+
3
+ launch . browserstack ( {
4
+ username : '<your browserstack username>' ,
5
+ password : 'password'
6
+ } , function ( err , launcher ) {
7
+ launcher ( 'http://github.com' , {
8
+ browser : 'firefox' ,
9
+ version : 'latest' ,
10
+ os : 'win'
11
+ } , function ( err , worker ) {
12
+ console . log ( 'Started browser' , worker . id ) ;
13
+ worker . status ( function ( status ) {
14
+ console . log ( 'Browser status is:' , status ) ;
15
+ setTimeout ( function ( ) {
16
+ worker . stop ( function ( err , worker ) {
17
+ console . log ( 'Stopped browser' , worker ) ;
18
+ } ) ;
19
+ } , 5000 ) ;
20
+ } )
21
+ } ) ;
22
+ } ) ;
Original file line number Diff line number Diff line change 1
1
var launch = require ( '../lib' ) ;
2
2
3
- launch . local ( { } , function ( err , launcher ) {
4
- launcher . firefox ( 'http://github.com/daffl' , function ( ) {
3
+ launch . local ( function ( err , launcher ) {
4
+ // User the launcher api
5
+ launcher ( 'http://github.com/ekryski' , {
6
+ browser : 'opera'
7
+ } , function ( error , worker ) {
8
+ console . log ( 'Launched Opera. Process id:' , worker . id ) ;
9
+ setTimeout ( function ( ) {
10
+ worker . stop ( function ( ) {
11
+ console . log ( 'Opera stopped' ) ;
12
+ } ) ;
13
+ } , 4000 ) ;
14
+ } ) ;
5
15
16
+ // Short hand launcher
17
+ launcher . firefox ( 'http://github.com/daffl' , function ( err , worker ) {
18
+ console . log ( 'Launched Firefox. Process id:' , worker . id ) ;
19
+ setTimeout ( function ( ) {
20
+ worker . stop ( function ( ) {
21
+ console . log ( 'Firefox stopped' ) ;
22
+ } ) ;
23
+ } , 2000 ) ;
6
24
} ) ;
7
25
} ) ;
Original file line number Diff line number Diff line change @@ -5,18 +5,17 @@ launch.remote({
5
5
host : 'localhost' ,
6
6
username : 'launcher' ,
7
7
password : 'testing'
8
- } , function ( err , api ) {
9
- console . log ( api ) ;
10
- api ( 'http://github.com' , {
11
- browser : 'opera' ,
8
+ } , function ( err , launcher ) {
9
+ launcher ( 'http://github.com' , {
10
+ browser : 'firefox' ,
12
11
version : 'latest'
13
- } , function ( err , instance ) {
14
- instance . status ( function ( ) {
15
- console . log ( arguments ) ;
16
- console . dir ( instance ) ;
12
+ } , function ( err , worker ) {
13
+ console . log ( 'Started browser' , worker . id ) ;
14
+ worker . status ( function ( status ) {
15
+ console . log ( 'Browser status is:' , status ) ;
17
16
setTimeout ( function ( ) {
18
- instance . stop ( function ( err , worker ) {
19
- console . log ( worker ) ;
17
+ worker . stop ( function ( err , worker ) {
18
+ console . log ( 'Stopped browser' , worker ) ;
20
19
} ) ;
21
20
} , 5000 ) ;
22
21
} )
Original file line number Diff line number Diff line change @@ -7,17 +7,17 @@ var emitter = launch.server({
7
7
} ) ;
8
8
9
9
emitter . on ( 'listening' , function ( configuration , server ) {
10
- console . log ( 'Listening on port ' + configuration . port ) ;
10
+ console . log ( 'Listening on port' , configuration . port ) ;
11
11
} ) ;
12
12
13
13
emitter . on ( 'authorized' , function ( req , res ) {
14
- console . log ( 'Authorized ' , req . authorization . basic . username ) ;
14
+ console . log ( 'Authorized' , req . authorization . basic . username ) ;
15
15
} ) ;
16
16
17
17
emitter . on ( 'started' , function ( info , instance ) {
18
- console . log ( 'Started browser ' , info )
18
+ console . log ( 'Started browser' , info )
19
19
} ) ;
20
20
21
21
emitter . on ( 'stopped' , function ( info ) {
22
- console . log ( 'Stopped browser ' , info ) ;
22
+ console . log ( 'Stopped browser' , info ) ;
23
23
} ) ;
Original file line number Diff line number Diff line change @@ -131,7 +131,6 @@ module.exports = function (config) {
131
131
next ( new Error ( 'You are not authorized' ) ) ;
132
132
} ) ;
133
133
134
- // URL routing
135
134
server . get ( '/' , api . index ) ;
136
135
server . get ( '/1/browsers' , api . listBrowsers ) ;
137
136
server . get ( '/1/worker' , api . listWorkers ) ;
You can’t perform that action at this time.
0 commit comments