@@ -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 ) ;
@@ -56,10 +63,13 @@ module.exports = function run(args) {
56
63
57
64
// set the no-wrap
58
65
utils . setNoWrap ( bsConfig , args ) ;
66
+ markBlockEnd ( 'setConfig' ) ;
59
67
60
68
// Validate browserstack.json values and parallels specified via arguments
69
+ markBlockStart ( 'validateConfig' ) ;
61
70
return capabilityHelper . validate ( bsConfig , args ) . then ( function ( cypressJson ) {
62
-
71
+ markBlockEnd ( 'validateConfig' ) ;
72
+ markBlockStart ( 'preArchiveSteps' ) ;
63
73
//get the number of spec files
64
74
let specFiles = utils . getNumberOfSpecFiles ( bsConfig , args , cypressJson ) ;
65
75
@@ -69,17 +79,29 @@ module.exports = function run(args) {
69
79
// warn if specFiles cross our limit
70
80
utils . warnSpecLimit ( bsConfig , args , specFiles ) ;
71
81
82
+ markBlockEnd ( 'preArchiveSteps' ) ;
72
83
// Archive the spec files
84
+ markBlockStart ( 'zip' ) ;
85
+ markBlockStart ( 'zip.archive' ) ;
73
86
return archiver . archive ( bsConfig . run_settings , config . fileName , args . exclude ) . then ( function ( data ) {
74
87
88
+ markBlockEnd ( 'zip.archive' ) ;
75
89
// Uploaded zip file
90
+ markBlockStart ( 'zip.zipUpload' ) ;
76
91
return zipUploader . zipUpload ( bsConfig , config . fileName ) . then ( async function ( zip ) {
92
+
93
+ markBlockEnd ( 'zip.zipUpload' ) ;
94
+ markBlockEnd ( 'zip' ) ;
77
95
// Create build
78
96
79
97
//setup Local Testing
98
+ markBlockStart ( 'localSetup' ) ;
80
99
let bs_local = await utils . setupLocalTesting ( bsConfig , args ) ;
81
-
100
+ markBlockEnd ( 'localSetup' ) ;
101
+ markBlockStart ( 'createBuild' ) ;
82
102
return build . createBuild ( bsConfig , zip ) . then ( function ( data ) {
103
+ markBlockEnd ( 'createBuild' ) ;
104
+ markBlockEnd ( 'total' ) ;
83
105
let message = `${ data . message } ! ${ Constants . userMessages . BUILD_CREATED } with build id: ${ data . build_id } ` ;
84
106
let dashboardLink = `${ Constants . userMessages . VISIT_DASHBOARD } ${ data . dashboard_url } ` ;
85
107
utils . exportResults ( data . build_id , `${ config . dashboardUrl } ${ data . build_id } ` ) ;
@@ -114,7 +136,19 @@ module.exports = function run(args) {
114
136
logger . info ( message ) ;
115
137
logger . info ( dashboardLink ) ;
116
138
if ( ! args . sync ) logger . info ( Constants . userMessages . EXIT_SYNC_CLI_MESSAGE . replace ( "<build-id>" , data . build_id ) ) ;
117
- utils . sendUsageReport ( bsConfig , args , `${ message } \n${ dashboardLink } ` , Constants . messageTypes . SUCCESS , null ) ;
139
+ let dataToSend = {
140
+ time_components : getTimeComponents ( ) ,
141
+ build_id : data . build_id ,
142
+ } ;
143
+ if ( bsConfig && bsConfig . connection_settings ) {
144
+ if ( bsConfig . connection_settings . local_mode ) {
145
+ dataToSend . local_mode = bsConfig . connection_settings . local_mode ;
146
+ }
147
+ if ( bsConfig . connection_settings . usedAutoLocal ) {
148
+ dataToSend . used_auto_local = bsConfig . connection_settings . usedAutoLocal ;
149
+ }
150
+ }
151
+ utils . sendUsageReport ( bsConfig , args , `${ message } \n${ dashboardLink } ` , Constants . messageTypes . SUCCESS , null , dataToSend ) ;
118
152
return ;
119
153
} ) . catch ( async function ( err ) {
120
154
// Build creation failed
0 commit comments