mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
27 lines
897 B
TypeScript
27 lines
897 B
TypeScript
import type { Page, Locator } from "@playwright/test";
|
|
|
|
export class LoginPage {
|
|
//Locators as fields
|
|
private readonly usernameInput: Locator;
|
|
private readonly passwordInput: Locator;
|
|
private readonly loginSubmit: Locator;
|
|
|
|
//Initialize locators in constructor
|
|
constructor(private readonly page: Page) {
|
|
this.usernameInput = this.page.getByRole("textbox", { name: "Username:" });
|
|
this.passwordInput = this.page.getByRole("textbox", { name: "Password:" });
|
|
this.loginSubmit = this.page.getByRole("button", { name: "Submit" });
|
|
}
|
|
|
|
async goto() {
|
|
await this.page.goto("/ui");
|
|
}
|
|
|
|
async login(username: string, password: string) {
|
|
await this.usernameInput.click();
|
|
await this.usernameInput.fill(username);
|
|
await this.passwordInput.click();
|
|
await this.passwordInput.fill(password);
|
|
await this.loginSubmit.click();
|
|
}
|
|
}
|