This repository was archived by the owner on Dec 13, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ var cbt = require ( 'cbt_tunnels' ) ;
2+ var request = require ( 'request' ) ;
3+
4+ var authkey = "" ; // Place CBT user credentials here
5+ var username = "" ;
6+
7+ var configObj = {
8+ authkey : authkey ,
9+ username : username ,
10+ }
11+
12+ var baseUrl = 'https://' + configObj . username + ':' + configObj . authkey + '@crossbrowsertesting.com/api/v3/' ;
13+ console . info ( "baseUrl: " , baseUrl ) ;
14+
15+ // https://crossbrowsertesting.com/apidocs/v3/livetests.html#!/default/get_livetests
16+
17+ cbt . start ( configObj , function ( err ) {
18+ if ( err ) {
19+ console . error ( "Error starting: " , err ) ;
20+ return err ;
21+ }
22+ var queryUrl = baseUrl + 'livetests?format=json&num=10&active=true&os_type=mac&browser_type=firefox' ;
23+ request . get ( { url : queryUrl } , function ( error , response , body ) {
24+ if ( error ) {
25+ console . error ( "Error posting: " , error ) ;
26+ return error ;
27+ }
28+
29+ var livetests = JSON . parse ( body ) . livetests ;
30+ console . log ( "livetest count: " , livetests . length ) ;
31+
32+ for ( var test of livetests ) {
33+ // do something
34+ }
35+
36+ cbt . stop ( ) ;
37+ console . log ( 'Exiting!' ) ;
38+ process . exit ( 0 ) ;
39+ } ) ;
40+ } ) ;
You can’t perform that action at this time.
0 commit comments