Skip to content

Commit 57216d4

Browse files
committed
fix: duration calculation with dashboard duration
1 parent 4c90710 commit 57216d4

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

bin/helpers/sync/specsSummary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ let printSpecsRunSummary = (data, machines, customErrorsToPrint) => {
3333
});
3434

3535
logger.info(`Total tests: ${summary.total}, passed: ${summary.passed}, failed: ${summary.failed}, skipped: ${summary.skipped}, passed_with_skipped: ${summary.passed_with_skipped}, pending: ${summary.pending}`);
36-
// logger.info(`Done in ${data.duration/1000} seconds using ${machines} machines\n`);
36+
logger.debug(`CLI calculated duration: ${data.duration/1000} seconds using ${machines} machines\n`);
3737

3838
if (customErrorsToPrint && customErrorsToPrint.length > 0) {
3939
for (const error of customErrorsToPrint) {

bin/helpers/sync/syncSpecsLogs.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"use strict";
2+
3+
const { util } = require("chai");
4+
25
const request = require("request"),
36
config = require("../config"),
47
utils = require("../utils"),
@@ -148,12 +151,6 @@ let whileProcess = (whilstCallback) => {
148151
switch (response.statusCode) {
149152
case 202: // get data here and print it
150153
n = 2
151-
// try {
152-
// parsed_body = JSON.parse(JSON.stringify(body));
153-
// showSpecsStatus(parsed_body['data']);
154-
// } catch (error) {
155-
// console.log(`---> Got error: ${JSON.stringify(error)}`)
156-
// }
157154
showSpecsStatus(body, 202);
158155
return setTimeout(whilstCallback, timeout * n, null);
159156
case 204: // No data available, wait for some time and ask again
@@ -162,12 +159,6 @@ let whileProcess = (whilstCallback) => {
162159
case 200: // Build is completed.
163160
whileLoop = false;
164161
endTime = Date.now();
165-
// try {
166-
// parsed_body = JSON.parse(body);
167-
// showSpecsStatus(JSON.stringify(parsed_body['data']));
168-
// } catch (error) {
169-
// console.log(`---> Got error: ${JSON.stringify(error)}`)
170-
// }
171162
showSpecsStatus(body, 200);
172163
return specSummary.exitCode == Constants.BUILD_FAILED_EXIT_CODE ?
173164
whilstCallback({ status: 204, message: "No specs ran in the build"} ) : whilstCallback(null, body);
@@ -184,7 +175,7 @@ let getStackTraceUrl = () => {
184175

185176
let showSpecsStatus = (data, statusCode) => {
186177
let specData = JSON.parse(data);
187-
specData["specDetails"].forEach(specDetails => {
178+
specData["specData"].forEach(specDetails => {
188179
if (specDetails.type === Constants.CYPRESS_CUSTOM_ERRORS_TO_PRINT_KEY) {
189180
addCustomErrorToPrint(specDetails);
190181
} else {
@@ -205,12 +196,14 @@ let showSpecsStatus = (data, statusCode) => {
205196
});
206197
if ( statusCode != 200 ) return;
207198
// Below block is for printing build details, return if non 200 status code
208-
if ("buildDetails" in specData) {
209-
const buildDetails = specData["buildDetails"];
210-
logger.info(`Done in ${buildDetails["duration"]} seconds with ${buildDetails["parallels"]} parallels.\n`);
199+
if ("buildData" in specData) {
200+
const buildDetails = specData.buildData;
201+
const totalDuration = buildDetails.duration?.total_duration
202+
const parallels = buildDetails.parallels
203+
logger.info(`Done in ${totalDuration} seconds with ${parallels} parallels.\n`);
211204
} else {
212205
logger.debug(`Build details not sent`)
213-
}
206+
}
214207
}
215208

216209
let printInitialLog = () => {

0 commit comments

Comments
 (0)