axe-core-npm
axe-core-npm copied to clipboard
Depend on playwright-core rather on playwright
Currently axe playwright depends on playwright. This means that if you install axe playwright, that all browsers get automatically downloaded, since we download the browsers in the postinstall step.
Since around half a year or so, playwright depends on playwright-core and @playwright/test depends on playwright-core.
I'd recommend to also depend on playwright-core instead, which will give you the correct types, but keep the flexibility up to the user which browser he wants to install. Also @playwright/test does not install all the browsers anymore, you need to explicitly call npx playwright install to install them or just one of them.
See here: https://github.com/dequelabs/axe-core-npm/blob/develop/packages/playwright/package.json
Hey @mxschmitt
Thank you for submitting the recommendation we will discuss this and update the package as needed.
@mxschmitt did you find a work around for this? Unable to install @axe-core/playwright due to this issue.
Validated this using @axe-core/playwright-4.4.5-alpha.313
Here while validating, instead of installing playwright, installed playwright-core_1.25.2 (so playwright- not exists in the dependencies list)
Run the js script
const AxeBuilder = require('@axe-core/playwright').default;
const playwright = require('playwright-core');
(async () => {
const browser = await playwright.chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://dequeuniversity.com/demo/mars/');
try {
const results = await new AxeBuilder({ page }).analyze();
console.log(results);
} catch (e) {
// do something with the error
}
await browser.close();
})();
and it is giving expected results holding axe-core_4.4.3

Also @playwright/test package is working with playwright

@michael-siek , But here observed one thing:
Even If I pass const playwright = require('playwright'); instead of const playwright = require('playwright-core'); seeing the expected results.