@@ -9,14 +9,21 @@ const archiver = require("../helpers/archiver"),
9
9
utils = require ( "../helpers/utils" ) ,
10
10
fileHelpers = require ( "../helpers/fileHelpers" ) ,
11
11
syncRunner = require ( "../helpers/syncRunner" ) ,
12
- reportGenerator = require ( '../helpers/reporterHTML' ) . reportGenerator ;
12
+ reportGenerator = require ( '../helpers/reporterHTML' ) . reportGenerator ,
13
+ { initTimeComponents, markBlockStart, markBlockEnd, getTimeComponents} = require ( '../helpers/timeComponents' ) ;
13
14
14
15
module . exports = function run ( args ) {
15
16
let bsConfigPath = utils . getConfigPath ( args . cf ) ;
16
17
//Delete build_results.txt from log folder if already present.
18
+ initTimeComponents ( ) ;
19
+ markBlockStart ( 'deleteOldResults' ) ;
17
20
utils . deleteResults ( ) ;
21
+ markBlockEnd ( 'deleteOldResults' ) ;
18
22
23
+ markBlockStart ( 'validateBstackJson' ) ;
19
24
return utils . validateBstackJson ( bsConfigPath ) . then ( function ( bsConfig ) {
25
+ markBlockEnd ( 'validateBstackJson' ) ;
26
+ markBlockStart ( 'setConfig' ) ;
20
27
utils . setUsageReportingFlag ( bsConfig , args . disableUsageReporting ) ;
21
28
22
29
utils . setDefaults ( bsConfig , args ) ;
@@ -59,10 +66,13 @@ module.exports = function run(args) {
59
66
60
67
// set the no-wrap
61
68
utils . setNoWrap ( bsConfig , args ) ;
69
+ markBlockEnd ( 'setConfig' ) ;
62
70
63
71
// Validate browserstack.json values and parallels specified via arguments
72
+ markBlockStart ( 'validateConfig' ) ;
64
73
return capabilityHelper . validate ( bsConfig , args ) . then ( function ( cypressJson ) {
65
-
74
+ markBlockEnd ( 'validateConfig' ) ;
75
+ markBlockStart ( 'preArchiveSteps' ) ;
66
76
//get the number of spec files
67
77
let specFiles = utils . getNumberOfSpecFiles ( bsConfig , args , cypressJson ) ;
68
78
@@ -72,17 +82,29 @@ module.exports = function run(args) {
72
82
// warn if specFiles cross our limit
73
83
utils . warnSpecLimit ( bsConfig , args , specFiles ) ;
74
84
85
+ markBlockEnd ( 'preArchiveSteps' ) ;
75
86
// Archive the spec files
87
+ markBlockStart ( 'zip' ) ;
88
+ markBlockStart ( 'zip.archive' ) ;
76
89
return archiver . archive ( bsConfig . run_settings , config . fileName , args . exclude ) . then ( function ( data ) {
77
90
91
+ markBlockEnd ( 'zip.archive' ) ;
78
92
// Uploaded zip file
93
+ markBlockStart ( 'zip.zipUpload' ) ;
79
94
return zipUploader . zipUpload ( bsConfig , config . fileName ) . then ( async function ( zip ) {
95
+
96
+ markBlockEnd ( 'zip.zipUpload' ) ;
97
+ markBlockEnd ( 'zip' ) ;
80
98
// Create build
81
99
82
100
//setup Local Testing
101
+ markBlockStart ( 'localSetup' ) ;
83
102
let bs_local = await utils . setupLocalTesting ( bsConfig , args ) ;
84
-
103
+ markBlockEnd ( 'localSetup' ) ;
104
+ markBlockStart ( 'createBuild' ) ;
85
105
return build . createBuild ( bsConfig , zip ) . then ( function ( data ) {
106
+ markBlockEnd ( 'createBuild' ) ;
107
+ markBlockEnd ( 'total' ) ;
86
108
let message = `${ data . message } ! ${ Constants . userMessages . BUILD_CREATED } with build id: ${ data . build_id } ` ;
87
109
let dashboardLink = `${ Constants . userMessages . VISIT_DASHBOARD } ${ data . dashboard_url } ` ;
88
110
utils . exportResults ( data . build_id , `${ config . dashboardUrl } ${ data . build_id } ` ) ;
@@ -117,7 +139,19 @@ module.exports = function run(args) {
117
139
logger . info ( message ) ;
118
140
logger . info ( dashboardLink ) ;
119
141
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 ) ;
121
155
return ;
122
156
} ) . catch ( async function ( err ) {
123
157
// Build creation failed
0 commit comments