Skip to content

Commit 55c1cad

Browse files
committed
SDK-1884: resolved reviews.
1 parent ccde61e commit 55c1cad

File tree

3 files changed

+9
-28
lines changed

3 files changed

+9
-28
lines changed

bin/accessibility-automation/cypress/index.js

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,12 @@ const performModifiedScan = (originalFn, Subject, stateType, ...args) => {
1717
}
1818
function runCutomizedCommand() {
1919
if (!Subject) {
20-
let orgS1, orgS2, cypressCommandSubject;
21-
if((orgS2 = (orgS1 = cy).subject) !==null && orgS2 !== void 0){
22-
cypressCommandSubject = orgS2.call(orgS1);
23-
}
24-
else{
25-
cypressCommandSubject = null;
26-
}
27-
customChaining.then(()=> cypressCommandSubject).then(() => {originalFn(...args)});
28-
}
29-
else {
30-
let orgSC1, orgSC2, timeO1, cypressCommandChain, setTimeout;
31-
if((timeO1 = args.find(arg => arg !== null && arg !== void 0 ? arg.timeout : null)) !== null && timeO1 !== void 0) {
32-
setTimeout = timeO1.timeout;
33-
}
34-
else {
35-
setTimeout = null;
36-
}
37-
if((orgSC1 = (orgSC2 = cy).subjectChain) !== null && orgSC1 !== void 0){
38-
cypressCommandChain = orgSC1.call(orgSC2);
39-
}
40-
else {
41-
cypressCommandChain = null;
42-
}
43-
customChaining.performScanSubjectQuery(cypressCommandChain, setTimeout).then({timeout: 30000}, (newSubject) => originalFn(...changeSub(args, stateType, newSubject)));
20+
let cypressCommandSubject = (cy.subject?.call(cy)) ?? null;
21+
customChaining.then(() => cypressCommandSubject).then(() => { originalFn(...args); });
22+
} else {
23+
let setTimeout = args.find(arg => arg?.timeout)?.timeout ?? null;
24+
let cypressCommandChain = (cy.subjectChain?.call(cy)) ?? null;
25+
customChaining.performScanSubjectQuery(cypressCommandChain, setTimeout).then({ timeout: 30000 }, newSubject => originalFn(...changeSub(args, stateType, newSubject)));
4426
}
4527
}
4628
runCutomizedCommand();

bin/accessibility-automation/plugin/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const browserstackAccessibility = (on, config) => {
3232
}
3333
if (browser_validation) {
3434
const ally_path = path.dirname(process.env.ACCESSIBILITY_EXTENSION_PATH)
35-
const {_, payload} = decodeJWTToken(process.env.ACCESSIBILITY_AUTH);
35+
const payload = decodeJWTToken(process.env.ACCESSIBILITY_AUTH);
3636
launchOptions.extensions.push(ally_path);
3737
if(!utils.isUndefined(payload) && !utils.isUndefined(payload.a11y_core_config) && payload.a11y_core_config.domForge === true) {
3838
launchOptions.args.push("--auto-open-devtools-for-tabs");

bin/helpers/utils.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,11 +1788,10 @@ exports.decodeJWTToken = (token) => {
17881788
if (parts.length < 2) {
17891789
throw new Error('Invalid JWT token');
17901790
}
1791-
const header = JSON.parse(base64UrlDecode(parts[0]));
17921791
const payload = JSON.parse(base64UrlDecode(parts[1]));
1793-
return { header, payload };
1792+
return payload
17941793
} catch (error) {
17951794
logger.err(error.message);
1796-
return {undefined, undefined};
1795+
return undefined;
17971796
}
17981797
}

0 commit comments

Comments
 (0)