@nightwatch/browserstack
Advanced tools
Comparing version 3.2.1 to 3.2.2
@@ -37,3 +37,3 @@ const LocalTunnel = require('../src/local-tunnel'); | ||
const {args, uuid} = data; | ||
await testObservability.createScreenshotLogEvent(uuid, args.path, Date.now()); | ||
await testObservability.createScreenshotLogEvent(uuid, args.path, Date.now()); | ||
} catch (error) { | ||
@@ -106,3 +106,3 @@ CrashReporter.uploadCrashReport(error.message, error.stack); | ||
}); | ||
}); | ||
}); | ||
@@ -306,3 +306,3 @@ const testMetaData = { | ||
} | ||
} | ||
} | ||
} catch (error) { | ||
@@ -319,3 +319,5 @@ Logger.error(`Could not configure or launch test observability - ${error}`); | ||
process.env.BS_A11Y_TEST_RUN_ID = testRunId; | ||
accessibilityAutomation.setAccessibilityCapabilities(settings); | ||
if (helper.isAccessibilitySession()) { | ||
accessibilityAutomation.setAccessibilityCapabilities(settings); | ||
} | ||
} | ||
@@ -353,3 +355,3 @@ } | ||
} | ||
} | ||
@@ -363,3 +365,3 @@ }, | ||
}, | ||
// This will be run after each test suite is finished | ||
@@ -405,10 +407,10 @@ async afterEach(settings) { | ||
} | ||
startWorker(...args) { | ||
const workerData = super.startWorker(...args); | ||
workerList = this.workers; | ||
return workerData; | ||
} | ||
parseWorkerMessage(...args) { | ||
@@ -415,0 +417,0 @@ if ([EVENTS.LOG, EVENTS.LOG_INIT].includes(args[1]?.eventType)) {return} |
{ | ||
"name": "@nightwatch/browserstack", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "Nightwatch plugin for integration with browserstack.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -37,4 +37,4 @@ const path = require('path'); | ||
if (this._settings.accessibility || this._bstackOptions) { | ||
this._user = helper.getUserName(this._settings); | ||
this._key = helper.getAccessKey(this._settings); | ||
this._user = helper.getUserName(settings, this._settings); | ||
this._key = helper.getAccessKey(settings, this._settings); | ||
} | ||
@@ -103,2 +103,3 @@ } | ||
} catch (error) { | ||
process.env.BROWSERSTACK_ACCESSIBILITY = 'false'; | ||
if (error.response) { | ||
@@ -321,3 +322,3 @@ Logger.error( | ||
const deviceName = driver.capabilities.deviceName || (capabilityConfig['bstack:options'] ? capabilityConfig['bstack:options'].deviceName : capabilityConfig.device) || ''; | ||
if (deviceName !== '') { | ||
@@ -340,3 +341,3 @@ Logger.warn('Accessibility Automation will run only on Desktop browsers.'); | ||
} | ||
const chromeOptions = capabilityConfig.chromeOptions || capabilityConfig['goog:chromeOptions'] || {}; | ||
@@ -343,0 +344,0 @@ if (chromeOptions.args?.includes('--headless') || chromeOptions.args?.includes('headless')) { |
@@ -30,6 +30,12 @@ const os = require('os'); | ||
} | ||
if (this._settings.test_observability || this._bstackOptions) { | ||
this._user = helper.getObservabilityUser(this._settings.test_observability, this._bstackOptions); | ||
this._key = helper.getObservabilityKey(this._settings.test_observability, this._bstackOptions); | ||
if (!this._user || !this._key) { | ||
Logger.error('Could not start Test Observability : Missing authentication token'); | ||
process.env.BROWSERSTACK_TEST_OBSERVABILITY = 'false'; | ||
return; | ||
} | ||
CrashReporter.setCredentialsForCrashReportUpload(this._user, this._key); | ||
@@ -353,3 +359,3 @@ CrashReporter.setConfigDetails(settings); | ||
} | ||
if (eventType === 'TestRunStarted') { | ||
@@ -445,3 +451,3 @@ testData.type = 'test'; | ||
return false; | ||
} | ||
} | ||
@@ -448,0 +454,0 @@ return true; |
@@ -55,7 +55,7 @@ const os = require('os'); | ||
exports.getObservabilityUser = (config, bstackOptions={}) => { | ||
return process.env.BROWSERSTACK_USERNAME || config.user || bstackOptions.userName; | ||
return process.env.BROWSERSTACK_USERNAME || config?.user || bstackOptions?.userName; | ||
}; | ||
exports.getObservabilityKey = (config, bstackOptions={}) => { | ||
return process.env.BROWSERSTACK_ACCESS_KEY || config.key || bstackOptions.accessKey; | ||
return process.env.BROWSERSTACK_ACCESS_KEY || config?.key || bstackOptions?.accessKey; | ||
}; | ||
@@ -77,3 +77,3 @@ | ||
return ''; | ||
}; | ||
@@ -223,3 +223,3 @@ | ||
} | ||
// Azure CI | ||
// Azure CI | ||
if (env.AZURE_HTTP_USER_AGENT && env.TF_BUILD) { | ||
@@ -483,3 +483,3 @@ return { | ||
} | ||
if (process.env.BS_TESTOPS_BUILD_COMPLETED === 'true') { | ||
@@ -494,6 +494,6 @@ if (process.env.BS_TESTOPS_JWT === 'null') { | ||
}; | ||
} | ||
let data = eventData; | ||
} | ||
let data = eventData; | ||
let event_api_url = 'api/v1/event'; | ||
requestQueueHandler.start(); | ||
@@ -519,3 +519,3 @@ const { | ||
}; | ||
try { | ||
@@ -549,4 +549,8 @@ const response = await makeRequest('POST', event_api_url, data, config); | ||
exports.getAccessKey = (settings) => { | ||
let accessKey = null; | ||
exports.getAccessKey = (settings, nwConfig) => { | ||
let accessKey = process.env.BROWSERSTACK_ACCESS_KEY || nwConfig?.accessKey; | ||
if (!this.isUndefined(accessKey)) { | ||
return accessKey; | ||
} | ||
if (this.isObject(settings.desiredCapabilities)) { | ||
@@ -560,11 +564,11 @@ if (settings.desiredCapabilities['browserstack.key']) { | ||
if (this.isUndefined(accessKey)) { | ||
accessKey = process.env.BROWSERSTACK_ACCESS_KEY; | ||
} | ||
return accessKey; | ||
}; | ||
exports.getUserName = (settings) => { | ||
let userName = null; | ||
exports.getUserName = (settings, nwConfig) => { | ||
let userName = process.env.BROWSERSTACK_USERNAME || nwConfig?.userName; | ||
if (!this.isUndefined(userName)) { | ||
return userName; | ||
} | ||
if (this.isObject(settings.desiredCapabilities)) { | ||
@@ -578,6 +582,2 @@ if (settings.desiredCapabilities['browserstack.user']) { | ||
if (this.isUndefined(userName)) { | ||
userName = process.env.BROWSERSTACK_USERNAME; | ||
} | ||
return userName; | ||
@@ -636,3 +636,3 @@ }; | ||
waitTimeout = DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS, | ||
waitInterval = DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS | ||
waitInterval = DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS | ||
) => { | ||
@@ -639,0 +639,0 @@ if (requestQueueHandler.pending_test_uploads <= 0 || waitTimeout <= 0) { |
@@ -32,10 +32,10 @@ const Transport = require('winston-transport'); | ||
}; | ||
logToTestOps = (level = LOG_LEVELS.INFO, message = ['']) => { | ||
try { | ||
let eventType = EVENTS.LOG; | ||
if (!message[0].match(PID_MAPPING_REGEX)) { | ||
if (typeof message[0] === 'string' && message[0].match(PID_MAPPING_REGEX)) { | ||
eventType = EVENTS.LOG_INIT; | ||
} else { | ||
consoleHolder[level.toLowerCase()](...message); | ||
} else { | ||
eventType = EVENTS.LOG_INIT; | ||
} | ||
@@ -42,0 +42,0 @@ const pid = process.pid; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95807
2344
86