dequelabs / axe-core-npm

Mozilla Public License 2.0
594 stars 68 forks source link

@axe-core/webdriverio expects object but get's proxy object #705

Closed yarinsa closed 1 year ago

yarinsa commented 1 year ago

Product: webdriverio

Expectation: Client should be initialised after running "new AxeBuilder"

Actual:

AssertionError [ERR_ASSERTION]: An instantiated WebdriverIO client greater than v5 is required
    at new AxeBuilder

@axe-core/webdriverio: 4.6.1
- WDIO: 8.6.9
- Node version: 18.5.0
- Platform:  Mac

Description

I am trying to run WDIO accessibility test with axe builder. Using the simple example online.

describe("Accessibility Test", () => {
  it("should get the accessibility results from a page", async () => {
    await browser.url("/iframe.html?id=design-system-button--playground");
 // using AxeBuilder.default() as a workaround until ESM are supported 
 // https://github.com/dequelabs/axe-core-npm/issues/703#issuecomment-1499146493
    const builder = new AxeBuilder.default({ client: browser });
    const result = await builder.analyze();
    console.log("Acessibility Results:", result);
  });
});

After running I am getting an error. I debugged the error and the issue is because axe is expecting object and WDIO 8 provides a proxy object. I tried to reverse the browser proxy to object before sending it but it doesn't work . Screenshot 2023-04-09 at 15 52 42 Screenshot 2023-04-09 at 15 52 32

straker commented 1 year ago

Thanks for the issue. At this time I believe @axe-core/webdriverio does not support WDIO v8. It's at least not one of our allowed peer dependencies. We probably will look into WDIO v8 support once #695 is completed.

singhMo007 commented 1 year ago

Thanks for the issue. At this time I believe @axe-core/webdriverio does not support WDIO v8. It's at least not one of our allowed peer dependencies. We probably will look into WDIO v8 support once #695 is completed.

Any idea by when it will be taken care in future?

straker commented 1 year ago

@singhMo007 Sorry, I don't have a timeframe for it. We're preparing for the axe-core 4.7 release next week, but I'm not sure WDIO v8 support would make it into the 4.7 api releases which would be happening shortly afterwards (it really depends on how complex it would be).

singhMo007 commented 1 year ago

Hope it will be taken soon, that will really help who are willing to use axe-core with WDIO V8

padmavemulapati commented 1 year ago

Validated with the latest axe-core/webdriverio_4.7.1-alpha.383 , with WDIO version 8.6.7 and node version 18.7.0 - .js tests and APIs are working fine