Skip to content

Commit

Permalink
update the webdriver test file #1676
Browse files Browse the repository at this point in the history
  • Loading branch information
shunguoy committed Oct 20, 2023
1 parent 82bfc5a commit cdc36fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion accessibility-checker/.achecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ ignoreHTTPSErrors: true
# We are setting no policies because we want the unit test to run for all policies
policies:
- IBM_Accessibility
- WCAG_2_2

# optional - Specify one or many violation levels on which to fail the test
# i.e. If specified violation then the testcase will only fail if
Expand Down
4 changes: 2 additions & 2 deletions accessibility-checker/src-ts/lib/ACHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MyFS implements IAbstractAPI {

async function initialize() {
if (Config) return;
Config = await ACConfigManager.getConfigUnsupported(); console.log("Config=" + JSON.stringify(Config));
Config = await ACConfigManager.getConfigUnsupported();
await ACEngineManager.loadEngineLocal();
let absAPI = new MyFS();
let refactorMap : RefactorMap = {}
Expand Down Expand Up @@ -287,7 +287,7 @@ cb(e);


async function getComplianceHelperWebDriverIO(label, parsed, curPol) : Promise<ICheckerResult> {
try { console.log("label="+label +", curPol=" + JSON.stringify(curPol));
try {
const startScan = Date.now();
// NOTE: Engine should already be loaded
const page = parsed;
Expand Down
14 changes: 7 additions & 7 deletions accessibility-checker/test/webdriverio/test/specs/example.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ before(async function () {
policyMap[policy] = true;
});

let rulesets = checker.rulesets; console.log("rulesets=" +JSON.stringify(rulesets));
let rulesets = checker.rulesets;
rulesets.forEach(function (rs) {
if (rs.id in policyMap) {
for (const cp of rs.checkpoints) {
Expand All @@ -39,7 +39,7 @@ before(async function () {
}
});
});
console.log("validList=" +JSON.stringify(validList)); console.log("policyMap=" +JSON.stringify(policyMap));

after(async () => {
// await browser.close();
})
Expand Down Expand Up @@ -93,9 +93,9 @@ describe("Rule Unit Tests from WebdriverIO", function () {
var originalTimeout;
// let count = 10;
// Loop over all the unitTestcase html/htm files and perform a scan for them
for (var unitTestFile in unitTestcaseHTML) { if (!unitTestFile.includes("element_overlaid_visible_zindex")) continue;
for (var unitTestFile in unitTestcaseHTML) {
if (unitTestFile in skipMap) continue;
console.log("unitTestFile=" + unitTestFile);
console.log(unitTestFile);
// if (count-- < 0) continue;
// Get the extension of the file we are about to scan
var fileExtension = unitTestFile.substr(unitTestFile.lastIndexOf('.') + 1);
Expand Down Expand Up @@ -129,7 +129,7 @@ describe("Rule Unit Tests from WebdriverIO", function () {
console.error("\nWas unable to scan: " + unitTestFile);
return Promise.reject(e); }
}
report = result.report; console.log("report=" + JSON.stringify(report));
report = result.report;
let unitTestInfo = await browser.execute(() => ({
legacyExpectedInfo: (typeof ((window as any).OpenAjax) !== 'undefined' && (window as any).OpenAjax && (window as any).OpenAjax.a11y && (window as any).OpenAjax.a11y.ruleCoverage),
expectedInfo: (typeof ((window as any).UnitTest) !== 'undefined' && (window as any).UnitTest)
Expand All @@ -138,7 +138,7 @@ describe("Rule Unit Tests from WebdriverIO", function () {
// Extract the ruleCoverage object from the unit testcases that is loaded on to the iframe.
let expectedInfo = unitTestInfo.expectedInfo;
let legacyExpectedInfo = unitTestInfo.legacyExpectedInfo;
console.log('expectedInfo=' + JSON.stringify(expectedInfo) + ', legacyExpectedInfo=' + legacyExpectedInfo);

if (expectedInfo && expectedInfo.ruleIds) {
let filtReport = [];
for (const issue of report.results) {
Expand All @@ -165,7 +165,7 @@ describe("Rule Unit Tests from WebdriverIO", function () {
if (pc !== 0) return pc;
return b.ruleId.localeCompare(a.ruleId);
})
console.log("filtReport=" + JSON.stringify(filtReport));

expect(filtReport).toEqual(expectedInfo.results);
} else if (legacyExpectedInfo) {
let expectedInfo = {}
Expand Down

0 comments on commit cdc36fa

Please sign in to comment.