// import playwright dependencies const { test, expect } = require('../helpers/axe-test.js'); const { chromium } = require('playwright'); const { injectAxe, checkA11y } = require('axe-playwright'); class PlaywrightService { #domain; // domain of the site to be tested #allyTest; // ally test object #url; // constructor constructor(domain) { this.#domain = domain; this.#url = `https://${domain}`; } /** * */ async runAccessibilityTest() { const browser = await chromium.launch(); const page = await browser.newPage(); try { await page.goto(this.#url); await injectAxe(page); const results = await page.evaluate(async () => { return await window.axe.run(); }); return results.violations; } finally { await browser.close(); } return results; } /** * */ } module.exports = PlaywrightService;