Skip to content

Commit 6cb2616

Browse files
committed
review changes
1 parent cab99db commit 6cb2616

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

bin/accessibility-automation/helper.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ exports.setAccessibilityCypressCapabilities = async (user_config, accessibilityR
3434

3535
exports.createAccessibilityTestRun = async (user_config, framework) => {
3636

37-
const userName = user_config["auth"]["username"];
38-
const accessKey = user_config["auth"]["access_key"];
39-
4037
try {
38+
const userName = user_config["auth"]["username"];
39+
const accessKey = user_config["auth"]["access_key"];
4140
let settings = user_config.run_settings.accessibilityOptions;
4241

4342
const {
@@ -83,14 +82,15 @@ exports.createAccessibilityTestRun = async (user_config, framework) => {
8382
'POST', 'test_runs', data, config
8483
);
8584
logger.info("response in createAccessibilityTestRun", response);
86-
process.env.BROWSERSTACK_TEST_ACCESSIBILITY = 'true';
87-
process.env.BS_A11Y_JWT = response.data.data.accessibilityToken;
88-
process.env.BS_A11Y_TEST_RUN_ID = response.data.data.id;
89-
85+
process.env.BS_A11Y_JWT = response?.data?.data?.accessibilityToken;
86+
process.env.BS_A11Y_TEST_RUN_ID = response?.data?.data?.id;
87+
88+
if (process.env.BS_A11Y_JWT) {
89+
process.env.BROWSERSTACK_TEST_ACCESSIBILITY = 'true';
90+
}
91+
9092
this.setAccessibilityCypressCapabilities(user_config, response.data);
9193
setAccessibilityEventListeners();
92-
// setEventListeners();
93-
9494

9595
} catch (error) {
9696
if (error.response) {
@@ -100,7 +100,7 @@ exports.createAccessibilityTestRun = async (user_config, framework) => {
100100
} ${error.response.statusText} ${JSON.stringify(error.response.data)}`
101101
);
102102
} else {
103-
if(error.message == 'Invalid configuration passed.') {
103+
if(error.message === 'Invalid configuration passed.') {
104104
logger.error(
105105
`Exception while creating test run for BrowserStack Accessibility Automation: ${
106106
error.message || error.stack

bin/helpers/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,4 @@ exports.getCiInfo = () => {
264264
}
265265
// if no matches, return null
266266
return null;
267-
}
267+
}

0 commit comments

Comments
 (0)