I'm trying to run playwright axe test cases on azure pipeline, but getting error at global-teardown.js file in azure pipeline, but this run perfectly in local. Below are the respective files. I m trying to publish a HTML report in azure pipeline after running test cases.
//globalTeardown.js
const exec = require('child_process').execSync;
async function globalSetup() {
> 5 | await exec(
| ^
6 | "npx xunit-viewer -r playwrightResults.xml -o playwrightResults.html "
7 | );
8 | }
//playwright.config.js
const config = {
globalSetup: "src/utils/globalSetup.js",
testDir: "./a11ytests",
globalTeardown: "src/utils/globalTeardown.js",
use: {
screenshot: "only-on-failure"
},
reporter: [["junit", { outputFile: "playwrightResults.xml" }]],
.
.
.
.}
//a11y.spec.js
const axeOption = {
axeOptions: {
runOnly: {
type: "tag",
values: ["best-practice"]
}
},
detailedReport: true,
detailedReportOptions: { html: true }
};
let browser;
let page;
test.describe("Playwright web page accessibility test for landing page", () => {
test.beforeEach(async () => {
browser = await chromium.launch();
page = await browser.newPage();
await page.goto(ENV.BASE_URL);
await injectAxe(page);
});
test("simple accessibility run for landing page", async () => {
await checkA11y(page, null, axeOption);
});
});