mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-26 06:17:21 +02:00
33 lines
734 B
TypeScript
33 lines
734 B
TypeScript
import type { Page } from '@playwright/test';
|
|
|
|
import { FloatingUiHelper } from './FloatingUiHelper';
|
|
|
|
/**
|
|
* Base modal component for handling modal dialogs.
|
|
*/
|
|
export class BaseModal extends FloatingUiHelper {
|
|
constructor(protected readonly page: Page) {
|
|
super(page);
|
|
}
|
|
|
|
get container() {
|
|
return this.page.getByRole('dialog');
|
|
}
|
|
|
|
getCloseButton() {
|
|
return this.container.getByRole('button', { name: /close/i });
|
|
}
|
|
|
|
async waitForModal() {
|
|
await this.container.waitFor({ state: 'visible' });
|
|
}
|
|
|
|
async fillInput(text: string) {
|
|
await this.container.getByRole('textbox').fill(text);
|
|
}
|
|
|
|
async clickButton(buttonText: string | RegExp) {
|
|
await this.container.getByRole('button', { name: buttonText }).click();
|
|
}
|
|
}
|