@@ -9,14 +9,21 @@ const archiver = require("../helpers/archiver"),
99 utils = require ( "../helpers/utils" ) ,
1010 fileHelpers = require ( "../helpers/fileHelpers" ) ,
1111 syncRunner = require ( "../helpers/syncRunner" ) ,
12- reportGenerator = require ( '../helpers/reporterHTML' ) . reportGenerator ;
12+ reportGenerator = require ( '../helpers/reporterHTML' ) . reportGenerator ,
13+ { initTimeComponents, markBlockStart, markBlockEnd, getTimeComponents} = require ( '../helpers/timeComponents' ) ;
1314
1415module . exports = function run ( args ) {
1516 let bsConfigPath = utils . getConfigPath ( args . cf ) ;
1617 //Delete build_results.txt from log folder if already present.
18+ initTimeComponents ( ) ;
19+ markBlockStart ( 'deleteOldResults' ) ;
1720 utils . deleteResults ( ) ;
21+ markBlockEnd ( 'deleteOldResults' ) ;
1822
23+ markBlockStart ( 'validateBstackJson' ) ;
1924 return utils . validateBstackJson ( bsConfigPath ) . then ( function ( bsConfig ) {
25+ markBlockEnd ( 'validateBstackJson' ) ;
26+ markBlockStart ( 'setConfig' ) ;
2027 utils . setUsageReportingFlag ( bsConfig , args . disableUsageReporting ) ;
2128
2229 utils . setDefaults ( bsConfig , args ) ;
@@ -59,10 +66,13 @@ module.exports = function run(args) {
5966
6067 // set the no-wrap
6168 utils . setNoWrap ( bsConfig , args ) ;
69+ markBlockEnd ( 'setConfig' ) ;
6270
6371 // Validate browserstack.json values and parallels specified via arguments
72+ markBlockStart ( 'validateConfig' ) ;
6473 return capabilityHelper . validate ( bsConfig , args ) . then ( function ( cypressJson ) {
65-
74+ markBlockEnd ( 'validateConfig' ) ;
75+ markBlockStart ( 'preArchiveSteps' ) ;
6676 //get the number of spec files
6777 let specFiles = utils . getNumberOfSpecFiles ( bsConfig , args , cypressJson ) ;
6878
@@ -72,17 +82,29 @@ module.exports = function run(args) {
7282 // warn if specFiles cross our limit
7383 utils . warnSpecLimit ( bsConfig , args , specFiles ) ;
7484
85+ markBlockEnd ( 'preArchiveSteps' ) ;
7586 // Archive the spec files
87+ markBlockStart ( 'zip' ) ;
88+ markBlockStart ( 'zip.archive' ) ;
7689 return archiver . archive ( bsConfig . run_settings , config . fileName , args . exclude ) . then ( function ( data ) {
7790
91+ markBlockEnd ( 'zip.archive' ) ;
7892 // Uploaded zip file
93+ markBlockStart ( 'zip.zipUpload' ) ;
7994 return zipUploader . zipUpload ( bsConfig , config . fileName ) . then ( async function ( zip ) {
95+
96+ markBlockEnd ( 'zip.zipUpload' ) ;
97+ markBlockEnd ( 'zip' ) ;
8098 // Create build
8199
82100 //setup Local Testing
101+ markBlockStart ( 'localSetup' ) ;
83102 let bs_local = await utils . setupLocalTesting ( bsConfig , args ) ;
84-
103+ markBlockEnd ( 'localSetup' ) ;
104+ markBlockStart ( 'createBuild' ) ;
85105 return build . createBuild ( bsConfig , zip ) . then ( function ( data ) {
106+ markBlockEnd ( 'createBuild' ) ;
107+ markBlockEnd ( 'total' ) ;
86108 let message = `${ data . message } ! ${ Constants . userMessages . BUILD_CREATED } with build id: ${ data . build_id } ` ;
87109 let dashboardLink = `${ Constants . userMessages . VISIT_DASHBOARD } ${ data . dashboard_url } ` ;
88110 utils . exportResults ( data . build_id , `${ config . dashboardUrl } ${ data . build_id } ` ) ;
@@ -117,7 +139,19 @@ module.exports = function run(args) {
117139 logger . info ( message ) ;
118140 logger . info ( dashboardLink ) ;
119141 if ( ! args . sync ) logger . info ( Constants . userMessages . EXIT_SYNC_CLI_MESSAGE . replace ( "<build-id>" , data . build_id ) ) ;
120- utils . sendUsageReport ( bsConfig , args , `${ message } \n${ dashboardLink } ` , Constants . messageTypes . SUCCESS , null ) ;
142+ let dataToSend = {
143+ time_components : getTimeComponents ( ) ,
144+ build_id : data . build_id ,
145+ } ;
146+ if ( bsConfig && bsConfig . connection_settings ) {
147+ if ( bsConfig . connection_settings . local_mode ) {
148+ dataToSend . local_mode = bsConfig . connection_settings . local_mode ;
149+ }
150+ if ( bsConfig . connection_settings . usedAutoLocal ) {
151+ dataToSend . used_auto_local = bsConfig . connection_settings . usedAutoLocal ;
152+ }
153+ }
154+ utils . sendUsageReport ( bsConfig , args , `${ message } \n${ dashboardLink } ` , Constants . messageTypes . SUCCESS , null , dataToSend ) ;
121155 return ;
122156 } ) . catch ( async function ( err ) {
123157 // Build creation failed
0 commit comments