Skip to content

Commit f9ba18f

Browse files
add cypress commands to visit
1 parent 7d0d8cf commit f9ba18f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

accessibility/scanner/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const commandsToOverride = [
1010
'blur', 'focus', 'go', 'reload', 'submit', 'viewport', 'origin'
1111
];
1212

13+
const commandsToWrap = ['visit', 'click', 'type', 'request', 'dblclick', 'rightclick', 'clear', 'check', 'uncheck', 'select', 'trigger', 'selectFile', 'scrollIntoView', 'scroll', 'scrollTo', 'blur', 'focus', 'go', 'reload', 'submit', 'viewport', 'origin'];
14+
1315
let currentWindow = null;
1416
Cypress.Commands.add('storeWindowObject', () => {
1517
cy.window().then(win => {
@@ -216,8 +218,13 @@ function oldprocessAccessibilityReport(win){
216218
});
217219
}
218220

219-
const overRideCommands = Cypress.env("ACCESSIBILITY_OVERIDE_COMMANDS");
221+
const overRideCommands = Cypress.env("ACCESSIBILITY_OVERIDE_COMMANDS") || false;
220222
if (overRideCommands) {
223+
let isAccessibilityLoaded = Cypress.env("ACCESSIBILITY") || false;
224+
if (!isAccessibilityLoaded){
225+
console.log('log', "accessibility not enabled " + isAccessibilityLoaded);
226+
return ;
227+
}
221228
commandsToOverride.forEach((command) => {
222229
Cypress.Commands.overwrite(command, (originalFn, url, options) => {
223230
let isAccessibilityLoaded = Cypress.env("ACCESSIBILITY") || false;

0 commit comments

Comments
 (0)