-
Couldn't load subscription status.
- Fork 22
Test Orchestration Integration For Nightwatch SDK #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
149854d
feat: Implement Nightwatch Test Orchestration Module
harshit-bstack fd1a87e
feat: Enhance test file collection and orchestration logic with impro…
harshit-bstack 7e7615e
feat: Refactor test orchestration logic to apply specific feature pat…
harshit-bstack 3633265
feat: Update cucumber feature path for API tests in Nightwatch globals
harshit-bstack 3b1ceac
feat: Update cucumber feature path handling to use ordered files
harshit-bstack 37873fa
feat: Add framework name to build data payload in OrchestrationUtils
harshit-bstack 7eab4c8
feat: Remove unused helper functions and debug logs from orchestratio…
harshit-bstack 1b98318
feat: Update framework name comment in build data payload and enhance…
harshit-bstack b8f963a
feat: Remove unused orchestration files and refactor helper functions…
harshit-bstack df2b1c8
style: eslint update
harshit-bstack c69da11
feat: Remove framework name from build data payload in OrchestrationU…
harshit-bstack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| const path = require('path'); | ||
| const { performance } = require('perf_hooks'); | ||
| const Logger = require('../utils/logger'); | ||
| const TestOrchestrationHandler = require('./testOrchestrationHandler'); | ||
|
|
||
| /** | ||
| * Applies test orchestration to the Nightwatch test run | ||
| * This function is the main entry point for the orchestration integration | ||
| */ | ||
| async function applyOrchestrationIfEnabled(specs, config) { | ||
| // Initialize orchestration handler | ||
| const orchestrationHandler = TestOrchestrationHandler.getInstance(config); | ||
| Logger.info('Orchestration handler is initialized'); | ||
|
|
||
| if (!orchestrationHandler) { | ||
| Logger.warn('Orchestration handler is not initialized. Skipping orchestration.'); | ||
| return specs; | ||
| } | ||
|
|
||
| // Check if runSmartSelection is enabled in config | ||
| const testOrchOptions = config.testOrchestrationOptions || config['@nightwatch/browserstack']?.testOrchestrationOptions || {}; | ||
| const runSmartSelectionEnabled = Boolean(testOrchOptions?.runSmartSelection?.enabled); | ||
|
|
||
| if (!runSmartSelectionEnabled) { | ||
| Logger.info('runSmartSelection is not enabled in config. Skipping orchestration.'); | ||
| return specs; | ||
| } | ||
|
|
||
| // Check if orchestration is enabled | ||
| let testOrderingApplied = false; | ||
| orchestrationHandler.addToOrderingInstrumentationData('enabled', orchestrationHandler.testOrderingEnabled()); | ||
|
|
||
| const startTime = performance.now(); | ||
|
|
||
| Logger.info('Test orchestration is enabled. Attempting to reorder test files.'); | ||
|
|
||
| // Get the test files from the specs | ||
| const testFiles = specs; | ||
| testOrderingApplied = true; | ||
| Logger.info(`Test files to be reordered: ${testFiles.join(', ')}`); | ||
|
|
||
| // Reorder the test files | ||
| const orderedFiles = await orchestrationHandler.reorderTestFiles(testFiles); | ||
|
|
||
| if (orderedFiles && orderedFiles.length > 0) { | ||
| orchestrationHandler.setTestOrderingApplied(testOrderingApplied); | ||
| Logger.info(`Tests reordered using orchestration: ${orderedFiles.join(', ')}`); | ||
|
|
||
| // Return the ordered files as the new specs | ||
| orchestrationHandler.addToOrderingInstrumentationData( | ||
| 'timeTakenToApply', | ||
| Math.floor(performance.now() - startTime) // Time in milliseconds | ||
| ); | ||
|
|
||
| return orderedFiles; | ||
| } else { | ||
| Logger.info('No test files were reordered by orchestration.'); | ||
| orchestrationHandler.addToOrderingInstrumentationData( | ||
| 'timeTakenToApply', | ||
| Math.floor(performance.now() - startTime) // Time in milliseconds | ||
| ); | ||
| } | ||
|
|
||
| return specs; | ||
| } | ||
|
|
||
| module.exports = { | ||
| applyOrchestrationIfEnabled | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change this log lines to debug