playwright
playwright
POM (Page Object Model)
import type { Locator, Page } from '@playwright/test';
import { BrowserContext, expect} from '@playwright/test';
export class BaseHelper {
readonly page: Page;
readonly context: BrowserContext;
readonly baseUrl: string;
constructor(page: Page, context: BrowserContext) {
this.page = page;
this.context = context;
this.baseUrl = process.env.NEXT_PUBLIC_WEB_BASE_URL;
}
async downloadImage() {
await this.page.getByRole('button', { name: 'download' }).click();
await expect(this.page.getByText('success')).toBeVisible();
}
async signIn(authorization: string) {
await this.context.addCookies([
{
name: 'authorization',
value: authorization,
url: this.baseUrl,
},
]);
}
}ETC
꿀팁
Last updated