Skip to content

Commit 8cd4c38

Browse files
addressed review comments
1 parent 6c03dde commit 8cd4c38

File tree

4 files changed

+25
-37
lines changed

4 files changed

+25
-37
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
11
exports.API_URL = 'https://accessibility.browserstack.com/api';
2+
3+
exports.ACCESSIBILITY_ENV_VARS = [
4+
"BROWSERSTACK_TEST_ACCESSIBILITY",
5+
"ACCESSIBILITY_AUTH",
6+
"ACCESSIBILITY_SCANNERVERSION",
7+
"ACCESSIBILITY_COMMANDS_TO_WRAP",
8+
"ACCESSIBILITY_BUILD_END_ONLY",
9+
"ACCESSIBILITY_SCRIPTS_TO_RUN",
10+
"ACCESSIBILITY_EXTENSION_PATH",
11+
"ACCESSIBILITY_INCLUDETAGSINTESTINGSCOPE",
12+
"ACCESSIBILITY_EXCLUDETAGSINTESTINGSCOPE",
13+
"BS_A11Y_JWT",
14+
"BS_A11Y_TEST_RUN_ID",
15+
"BROWSERSTACK_ACCESSIBILITY_DEBUG"
16+
];

bin/accessibility-automation/cypress/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,12 @@ new Promise(async (resolve, reject) => {
129129

130130
win.addEventListener("A11Y_SCAN_FINISHED", onScanComplete);
131131

132-
// Enhanced event with mode information and server scripts
132+
// Enhanced event with mode information
133133
const scanEvent = new CustomEvent("A11Y_SCAN", {
134134
detail: {
135135
...payloadToSend,
136136
scanMode: isBuildEndOnlyMode ? "comprehensive-build-end" : "incremental",
137-
timestamp: Date.now(),
138-
serverScripts: Cypress.env('ACCESSIBILITY_SCRIPTS') || null
137+
timestamp: Date.now()
139138
}
140139
});
141140

bin/accessibility-automation/helper.js

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,6 @@ exports.processServerAccessibilityConfig = (responseData) => {
325325
scriptsMap[script.name] = script.command;
326326
});
327327

328-
// Store server scripts for Cypress to read
329-
process.env.ACCESSIBILITY_SCRIPTS = JSON.stringify(scriptsMap);
330-
331328
logger.debug(`[A11Y] Server provided accessibility scripts: ${Object.keys(scriptsMap).join(', ')}`, { scriptsMap });
332329
} else {
333330
logger.debug('[A11Y] No server scripts provided, using default scripts');
@@ -410,35 +407,5 @@ exports.shouldWrapCommand = (commandName) => {
410407
}
411408
};
412409

413-
// Get accessibility script by name
414-
exports.getAccessibilityScript = (scriptName) => {
415-
try {
416-
// Try to get script from Scripts class first
417-
const script = scripts.getScript(scriptName);
418-
419-
if (script) {
420-
logger.debug(`[A11Y] Retrieved script '${scriptName}' from Scripts class`, { scriptName, source: 'scripts-class' });
421-
return script;
422-
}
423-
424-
// Fallback to environment variable
425-
if (process.env.ACCESSIBILITY_SCRIPTS) {
426-
const serverScripts = JSON.parse(process.env.ACCESSIBILITY_SCRIPTS);
427-
const envScript = serverScripts[scriptName] || serverScripts[scriptName.toLowerCase()];
428-
429-
if (envScript) {
430-
logger.debug(`[A11Y] Retrieved script '${scriptName}' from environment`, { scriptName, source: 'environment' });
431-
return envScript;
432-
}
433-
}
434-
435-
logger.debug(`[A11Y] Script '${scriptName}' not found`, { scriptName });
436-
return null;
437-
} catch (error) {
438-
logger.error(`[A11Y] Error retrieving script '${scriptName}': ${error.message}`);
439-
return null;
440-
}
441-
};
442-
443410
// Export the Scripts instance for direct access
444411
exports.scripts = scripts;

bin/helpers/utils.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ const usageReporting = require("./usageReporting"),
2424
pkg = require('../../package.json'),
2525
transports = require('./logger').transports,
2626
o11yHelpers = require('../testObservability/helper/helper'),
27-
{ OBSERVABILITY_ENV_VARS, TEST_OBSERVABILITY_REPORTER } = require('../testObservability/helper/constants');
27+
{ OBSERVABILITY_ENV_VARS, TEST_OBSERVABILITY_REPORTER } = require('../testObservability/helper/constants'),
28+
{ ACCESSIBILITY_ENV_VARS } = require('../accessibility-automation/constants');
2829

2930
const { default: axios } = require("axios");
3031
const { shouldProcessEventForTesthub } = require("../testhub/utils");
@@ -603,6 +604,12 @@ exports.setSystemEnvs = (bsConfig) => {
603604
}
604605
} catch(e){}
605606

607+
try {
608+
ACCESSIBILITY_ENV_VARS.forEach(key => {
609+
envKeys[key] = process.env[key];
610+
});
611+
} catch(e){}
612+
606613
if (Object.keys(envKeys).length === 0) {
607614
bsConfig.run_settings.system_env_vars = null;
608615
} else {

0 commit comments

Comments
 (0)