Add a single login for all tests in the form of a global setup. This commit also removes the login from all tests and replaces it with navigation to landing page and revamps the popup closing logic from being applied in logging step into a separate fixture.
19 lines
525 B
TypeScript
19 lines
525 B
TypeScript
import { test as base } from '@playwright/test';
|
|
|
|
import { closePopupsIfExist } from '../helpers/helpers';
|
|
|
|
export interface PopupHandlerFixture {
|
|
popupHandler: void;
|
|
}
|
|
|
|
// This fixture will close any popups that might get opened during the test execution
|
|
export const test = base.extend<PopupHandlerFixture>({
|
|
popupHandler: [
|
|
async ({ page }, use) => {
|
|
await closePopupsIfExist(page);
|
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
await use(undefined);
|
|
},
|
|
{ auto: true },
|
|
],
|
|
});
|