Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
149854d
feat: Implement Nightwatch Test Orchestration Module
harshit-bstack Oct 15, 2025
fd1a87e
feat: Enhance test file collection and orchestration logic with impro…
harshit-bstack Oct 15, 2025
7e7615e
feat: Refactor test orchestration logic to apply specific feature pat…
harshit-bstack Oct 15, 2025
3633265
feat: Update cucumber feature path for API tests in Nightwatch globals
harshit-bstack Oct 15, 2025
3b1ceac
feat: Update cucumber feature path handling to use ordered files
harshit-bstack Oct 15, 2025
37873fa
feat: Add framework name to build data payload in OrchestrationUtils
harshit-bstack Oct 16, 2025
7eab4c8
feat: Remove unused helper functions and debug logs from orchestratio…
harshit-bstack Oct 23, 2025
1b98318
feat: Update framework name comment in build data payload and enhance…
harshit-bstack Oct 23, 2025
b8f963a
feat: Remove unused orchestration files and refactor helper functions…
harshit-bstack Oct 23, 2025
df2b1c8
style: eslint update
harshit-bstack Oct 28, 2025
c69da11
feat: Remove framework name from build data payload in OrchestrationU…
harshit-bstack Oct 28, 2025
093a7b4
Merge branch 'main' into to_integration
harshit-bstack Oct 28, 2025
ee4fbc1
feat: Enhance build details extraction by adding observability options
harshit-bstack Oct 28, 2025
e235cf7
feat: Add test observability options to project and build name retrieval
harshit-bstack Oct 28, 2025
f56a9f4
feat: Enhance test orchestration by adding observability session chec…
harshit-bstack Oct 29, 2025
7b0784d
feat: Add test observability session check to build data collection i…
harshit-bstack Oct 29, 2025
32eac85
feat: Refactor test orchestration logic to improve readability and ma…
harshit-bstack Oct 29, 2025
7c16d67
feat: Validate smart selection mode in run smart selection settings
harshit-bstack Oct 30, 2025
37627bf
fix: Corrected base branch retrieval by updating the string replaceme…
harshit-bstack Oct 30, 2025
b84700f
refactor: Change log level from info to debug for test orchestration …
harshit-bstack Oct 30, 2025
badf8ac
feat: Integrate orchestration data retrieval into test observability …
harshit-bstack Oct 30, 2025
6c86c9c
fix: Correct syntax by adding missing semicolon in testObservability.js
harshit-bstack Oct 30, 2025
9dfd387
Merge pull request #2 from nightwatchjs/main
harshit-bstack Oct 31, 2025
7973604
fix: Update test_orchestration data retrieval to use parent settings
harshit-bstack Oct 31, 2025
513c50c
fix: Enhance feature branch validation in OrchestrationUtils
harshit-bstack Nov 3, 2025
ecdd133
fix: Correct base branch retrieval by adjusting symbolic ref path
harshit-bstack Nov 4, 2025
91e2851
fix: Validate repository URL to ensure it is not empty or whitespace
harshit-bstack Nov 4, 2025
a6805e5
fix: Enhance feature branch retrieval by adding null and type checks
harshit-bstack Nov 5, 2025
21d5e35
fix: eslint fix
harshit-bstack Nov 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/testObservability.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {makeRequest} = require('./utils/requestHelper');
const CrashReporter = require('./utils/crashReporter');
const Logger = require('./utils/logger');
const {API_URL, TAKE_SCREENSHOT_REGEX} = require('./utils/constants');
const OrchestrationUtils = require('./testorchestration/orchestrationUtils');
const hooksMap = {};

class TestObservability {
Expand Down Expand Up @@ -111,7 +112,8 @@ class TestObservability {
frameworkName: helper.getFrameworkName(this._testRunner),
frameworkVersion: helper.getPackageVersion('nightwatch'),
sdkVersion: helper.getAgentVersion()
}
},
test_orchestration: this.getTestOrchestrationBuildStartData(this._parentSettings)
};

const config = {
Expand Down Expand Up @@ -151,6 +153,11 @@ class TestObservability {
process.env.BROWSERSTACK_TEST_REPORTING = false;
}
}
getTestOrchestrationBuildStartData(settings) {
const orchestrationUtils = OrchestrationUtils.getInstance(settings);

return orchestrationUtils.getBuildStartData();
}

async stopBuildUpstream () {
if (!process.env.BS_TESTOPS_BUILD_COMPLETED) {
Expand Down
21 changes: 12 additions & 9 deletions src/testorchestration/orchestrationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const path = require('path');
const fs = require('fs');
const {tmpdir} = require('os');
const Logger = require('../utils/logger');
const {getHostInfo} = require('../utils/helper');
const RequestUtils = require('./requestUtils');
const helper = require('../utils/helper');
// Constants
Expand Down Expand Up @@ -307,12 +306,16 @@ class OrchestrationUtils {

const getFeatureBranch = (name, repoInfo) => {
// 1. Check in environment variable map
if (featureBranchEnvMap[name]) {
return featureBranchEnvMap[name];
if (featureBranchEnvMap && featureBranchEnvMap[name]) {
const val = featureBranchEnvMap[name];

return typeof val === 'string' ? val.trim() : val;
}
// 2. Check in repo_info
if (repoInfo.featureBranch) {
return repoInfo.featureBranch;
if (repoInfo && repoInfo.featureBranch) {
const val = repoInfo.featureBranch;

return typeof val === 'string' ? val.trim() : val;
}

return null;
Expand All @@ -327,7 +330,7 @@ class OrchestrationUtils {
continue;
}

if (!repoInfo.url) {
if (!repoInfo.url || String(repoInfo.url).trim() === '') {
this.logger.warn(`Repository URL is missing for source '${name}': ${JSON.stringify(repoInfo)}`);
continue;
}
Expand All @@ -348,7 +351,7 @@ class OrchestrationUtils {
repoInfoCopy.name = name;
repoInfoCopy.featureBranch = getFeatureBranch(name, repoInfo);

if (!repoInfoCopy.featureBranch) {
if (!repoInfoCopy.featureBranch || repoInfoCopy.featureBranch === '') {
this.logger.warn(`Feature branch not specified for source '${name}': ${JSON.stringify(repoInfo)}`);
continue;
}
Expand Down Expand Up @@ -414,7 +417,7 @@ class OrchestrationUtils {
/**
* Get build start data
*/
getBuildStartData(config) {
getBuildStartData() {
const testOrchestrationData = {};

testOrchestrationData['run_smart_selection'] = {
Expand Down Expand Up @@ -442,7 +445,7 @@ class OrchestrationUtils {
buildRunIdentifier: this.getBuildIdentifier(),
nodeIndex: parseInt(process.env.BROWSERSTACK_NODE_INDEX || '0', 10),
totalNodes: parseInt(process.env.BROWSERSTACK_TOTAL_NODE_COUNT || '1', 10),
hostInfo: getHostInfo()
hostInfo: helper.getHostInfo()
};

this.logger.debug(`[collectBuildData] Sending build data payload: ${JSON.stringify(payload)}`);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ function getBaseBranch() {
try {
const originHeadOutput = execSync('git symbolic-ref refs/remotes/origin/HEAD').toString().trim();
if (originHeadOutput.startsWith('refs/remotes/origin/')) {
return originHeadOutput.replace('refs/remotes/origin/', '');
return originHeadOutput.replace('refs/remotes/', '');
}
} catch (e) {
// Symbolic ref might not exist
Expand Down