Skip to content

Commit

Permalink
Merge pull request #267 from LambdaTest/dev
Browse files Browse the repository at this point in the history
Release 3 Sep
  • Loading branch information
HRanjan-11 authored Sep 3, 2023
2 parents 0a220d1 + 27e9160 commit e2b16ed
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
4 changes: 2 additions & 2 deletions commands/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ module.exports = {
DEFAULT_TEST_PATH: ".",
LAMBDA_CONFIG: "./lambdatest-config.json",
SUPPORTED_CYPRESS_VERSIONS: ["5", "6"],
WHITELISTED_ENV_VARS: ["CI_BUILD_ID", "PERCY_TOKEN"],
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"],
BUILD_END_STATES:
"&status=running,queued,created,initiated,pqueued,error,lambda error,failed",
"&status=running,queued,created,initiated,pqueued,error,lambda error,failed,completed,queue_timeout,idle_timeout,stopped,cancelled,passed,timeout,inactive",
BUILD_ERROR_STATES: "&status=error,lambda error,failed",
CYPRESS_ENV_FILE_PATH: "cypress.env.json",
ENVS: ["stage", "beta", "prod", "preprod", "stage_new"],
Expand Down
30 changes: 30 additions & 0 deletions commands/utils/poller/build_stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const constants = require("../constants");
const request = require("request");
const builds = require("./build");
//const poller=require("./poller.js")
var get_build_info_count = 0;

function get_completed_build_info(lt_config, session_id, env) {
let options = {
Expand Down Expand Up @@ -66,6 +67,14 @@ function get_build_info(lt_config, session_id, env, update_status, callback) {
error: 0,
"lambda error": 0,
failed: 0,
completed: 0,
queue_timeout : 0,
idle_timeout : 0,
stopped : 0,
cancelled : 0,
passed : 0,
timeout : 0,
inactive : 0,
};
let build_info = JSON.parse(body);
if (build_info.Meta.result_set.count > 0) {
Expand All @@ -81,6 +90,27 @@ function get_build_info(lt_config, session_id, env, update_status, callback) {
statsNew["pqueued"] ==
0
) {
if (
statsNew["error"] +
statsNew["lambda error"] +
statsNew["failed"] +
statsNew["completed"] +
statsNew["queue_timeout"] +
statsNew["idle_timeout"] +
statsNew["stopped"] +
statsNew["cancelled"] +
statsNew["passed"] +
statsNew["timeout"] +
statsNew["inactive"] ==
0
) {
get_build_info_count = get_build_info_count + 1;
if (get_build_info_count > 4) {
update_status(false);
return callback(null, JSON.parse(body));
}
return setTimeout(callback, 5000, null);
}
update_status(false);
return callback(null, JSON.parse(body));
}
Expand Down
5 changes: 5 additions & 0 deletions commands/utils/poller/poller.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ function poll_build(lt_config, session_id, env) {
build_stats
.get_completed_build_info(lt_config, session_id, env)
.then(function (build_info) {
if (!build_info || build_info.data == null) {
console.log("Build info not found");
resolve(1);
return;
}
let stats = {};
let status = [];
for (i = 0; i < build_info["data"].length; i++) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lambdatest-cypress-cli",
"version": "3.0.17",
"version": "3.0.18",
"description": "The lambdatest-cypress-cli is LambdaTest's command-line interface (CLI) aimed to help you run your Cypress tests on LambdaTest platform.",
"homepage": "https://github.com/LambdaTest/lambdatest-cypress-cli",
"author": "LambdaTest <[email protected]>",
Expand Down

0 comments on commit e2b16ed

Please sign in to comment.