Skip to content

Commit e2b16ed

Browse files
authored
Merge pull request #267 from LambdaTest/dev
Release 3 Sep
2 parents 0a220d1 + 27e9160 commit e2b16ed

File tree

5 files changed

+40
-5
lines changed

5 files changed

+40
-5
lines changed

commands/utils/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ module.exports = {
1111
DEFAULT_TEST_PATH: ".",
1212
LAMBDA_CONFIG: "./lambdatest-config.json",
1313
SUPPORTED_CYPRESS_VERSIONS: ["5", "6"],
14-
WHITELISTED_ENV_VARS: ["CI_BUILD_ID", "PERCY_TOKEN"],
14+
WHITELISTED_ENV_VARS: ["CI_BUILD_ID", "PERCY_TOKEN", "QASE_REPORT", "QASE_RUN_ID", "QASE_RUN_NAME", "QASE_RUN_DESCRIPTION", "QASE_API_TOKEN", "QASE_API_BASE_URL", "QASE_ENVIRONMENT_ID", "QASE_SCREENSHOT_FOLDER", "QASE_SCREENSHOT_SENDING", "QASE_RUN_COMPLETE"],
1515
BUILD_END_STATES:
16-
"&status=running,queued,created,initiated,pqueued,error,lambda error,failed",
16+
"&status=running,queued,created,initiated,pqueued,error,lambda error,failed,completed,queue_timeout,idle_timeout,stopped,cancelled,passed,timeout,inactive",
1717
BUILD_ERROR_STATES: "&status=error,lambda error,failed",
1818
CYPRESS_ENV_FILE_PATH: "cypress.env.json",
1919
ENVS: ["stage", "beta", "prod", "preprod", "stage_new"],

commands/utils/poller/build_stats.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const constants = require("../constants");
22
const request = require("request");
33
const builds = require("./build");
44
//const poller=require("./poller.js")
5+
var get_build_info_count = 0;
56

67
function get_completed_build_info(lt_config, session_id, env) {
78
let options = {
@@ -66,6 +67,14 @@ function get_build_info(lt_config, session_id, env, update_status, callback) {
6667
error: 0,
6768
"lambda error": 0,
6869
failed: 0,
70+
completed: 0,
71+
queue_timeout : 0,
72+
idle_timeout : 0,
73+
stopped : 0,
74+
cancelled : 0,
75+
passed : 0,
76+
timeout : 0,
77+
inactive : 0,
6978
};
7079
let build_info = JSON.parse(body);
7180
if (build_info.Meta.result_set.count > 0) {
@@ -81,6 +90,27 @@ function get_build_info(lt_config, session_id, env, update_status, callback) {
8190
statsNew["pqueued"] ==
8291
0
8392
) {
93+
if (
94+
statsNew["error"] +
95+
statsNew["lambda error"] +
96+
statsNew["failed"] +
97+
statsNew["completed"] +
98+
statsNew["queue_timeout"] +
99+
statsNew["idle_timeout"] +
100+
statsNew["stopped"] +
101+
statsNew["cancelled"] +
102+
statsNew["passed"] +
103+
statsNew["timeout"] +
104+
statsNew["inactive"] ==
105+
0
106+
) {
107+
get_build_info_count = get_build_info_count + 1;
108+
if (get_build_info_count > 4) {
109+
update_status(false);
110+
return callback(null, JSON.parse(body));
111+
}
112+
return setTimeout(callback, 5000, null);
113+
}
84114
update_status(false);
85115
return callback(null, JSON.parse(body));
86116
}

commands/utils/poller/poller.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ function poll_build(lt_config, session_id, env) {
2424
build_stats
2525
.get_completed_build_info(lt_config, session_id, env)
2626
.then(function (build_info) {
27+
if (!build_info || build_info.data == null) {
28+
console.log("Build info not found");
29+
resolve(1);
30+
return;
31+
}
2732
let stats = {};
2833
let status = [];
2934
for (i = 0; i < build_info["data"].length; i++) {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lambdatest-cypress-cli",
3-
"version": "3.0.17",
3+
"version": "3.0.18",
44
"description": "The lambdatest-cypress-cli is LambdaTest's command-line interface (CLI) aimed to help you run your Cypress tests on LambdaTest platform.",
55
"homepage": "https://github.com/LambdaTest/lambdatest-cypress-cli",
66
"author": "LambdaTest <[email protected]>",

0 commit comments

Comments
 (0)