Skip to content

Commit

Permalink
test: finish fixing the test failures for the wdio suite
Browse files Browse the repository at this point in the history
Tests are passing now
  • Loading branch information
jasonschroeder-sfdc committed Sep 9, 2022
1 parent 9cc9925 commit 468c19e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/wdio/__tests__/wdio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
htmlFileWithNoA11yIssues,
shadowDomID,
} from '@sa11y/test-utils';
import { AxeResults, axeVersion } from '@sa11y/common';
import { AxeResults, axeVersion, WdioOptions } from '@sa11y/common';

/**
* Test util function to get violations from given html file
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('integration test @sa11y/wdio with WebdriverIO', () => {
it('should not throw error for html with no a11y issues in sync mode', async () => {
await browser.url(htmlFileWithNoA11yIssues);
expect(() => assertAccessibleSync()).not.toThrow();
await checkA11yErrorWdio(assertAccessibleSync);
await checkA11yErrorWdio(assertAccessible);
});

it('should throw error for non-existent element', async () => {
Expand All @@ -102,8 +102,12 @@ describe('integration test @sa11y/wdio with WebdriverIO', () => {
const opts = { exceptionList: exceptionList };

await browser.url(htmlFileWithA11yIssues);
expect(() => assertAccessibleSync(opts)).toThrow();
await checkA11yErrorWdio(assertAccessibleSync, a11yIssuesCountFiltered, opts);
await expect(assertAccessible(opts)).rejects.toThrow();
await checkA11yErrorWdio(
async (_opts: Partial<WdioOptions>) => await assertAccessible(_opts),
a11yIssuesCountFiltered,
opts
);
});
/* eslint-enable @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call */
});
1 change: 1 addition & 0 deletions packages/wdio/src/wdio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export async function assertAccessible(opts: Partial<WdioOptions> = {}): Promise
* Verify that the currently loaded page in the browser is accessible.
* Throw an error with the accessibility issues found if it is not accessible.
* Synchronous version of {@link assertAccessible}
* @deprecated Please update to using async method.
*/
export function assertAccessibleSync(opts: Partial<WdioOptions> = {}): void {
const options = setDefaultOptions(opts);
Expand Down

0 comments on commit 468c19e

Please sign in to comment.