debian-image-builder-frontend/playwright/fixtures/popupHandler.ts
Tom Koscielniak b499dfcf93 playwright: Add single login for all tests
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.
2025-06-19 14:26:03 +00:00

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 },
],
});