akshayp7/playwright-typescript-playwright-test

test.beforeEach not getting called by running npx cross-env ENV=qa npm run test

asit-till opened this issue · 2 comments

In below example on running " npx cross-env ENV=qa npm run test" beforeEach /afterEach not getting called. Is there any way ?

import test from "../../lib/BaseTest";

test.beforeEach(async ({ page }) => {
  // Go to the starting url before each test.
  console.log("In BEFORE");
});

test(`Login to PHP travels.`, async ({ loginPage, myAccountPage }) => {
  await loginPage.navigateToURL();
  await loginPage.loginToApplication();
  await myAccountPage.verifyMyAccountHeader();
});

It was the issue in global config and I managed to fix it.

anyone wants to run test.beforeEach/After need to fix the global config