feat: Implement Playwright testing setup

This commit is contained in:
gpt-engineer-app[bot]
2025-10-30 15:42:28 +00:00
parent 41ae88d1bc
commit 8ac61e01e3
16 changed files with 1700 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
/**
* Login Page Object Model
*
* Encapsulates interactions with the login page.
*/
import { Page, expect } from '@playwright/test';
export class LoginPage {
constructor(private page: Page) {}
async goto() {
await this.page.goto('/auth');
await this.page.waitForLoadState('networkidle');
}
async login(email: string, password: string) {
await this.page.fill('input[type="email"]', email);
await this.page.fill('input[type="password"]', password);
await this.page.click('button[type="submit"]');
}
async expectLoginSuccess() {
// Wait for navigation away from auth page
await this.page.waitForURL('**/', { timeout: 10000 });
// Verify we're on homepage or dashboard
await expect(this.page).not.toHaveURL(/\/auth/);
}
async expectLoginError(message?: string) {
// Check for error toast or message
if (message) {
await expect(this.page.getByText(message)).toBeVisible();
} else {
// Just verify we're still on auth page
await expect(this.page).toHaveURL(/\/auth/);
}
}
async clickSignUp() {
await this.page.click('text=Sign up');
}
async clickForgotPassword() {
await this.page.click('text=Forgot password');
}
}