Files
spliit/tests/pom/expense-page.ts
Sebastien Castiel 4d58ff9946 Complete E2E test implementation with comprehensive reliability fixes
- Implement Priority 1 E2E test coverage for critical user journeys:
  * Group lifecycle management (creation, navigation, editing)
  * Basic expense management (create, view, edit, delete)
  * Balance calculation and verification
  * Multiple expense scenarios and split calculations

- Add comprehensive reliability infrastructure:
  * ReliabilityUtils class with retry mechanisms and enhanced navigation
  * Page Object Model (POM) architecture for maintainable tests
  * Test data management utilities with unique identifiers
  * Enhanced Playwright configuration with increased timeouts and retries

- Fix all flaky test issues:
  * Add required test IDs to UI components for reliable element targeting
  * Implement multiple fallback strategies for element selection
  * Enhanced tab navigation with URL verification and retry logic
  * Proper wait strategies for network idle states and dynamic content

- Test results: 39/39 tests passing (100% success rate) across all browsers

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 22:04:18 -04:00

48 lines
1.3 KiB
TypeScript

import { Page } from '@playwright/test'
export class ExpensePage {
constructor(private page: Page) {}
async navigateToGroupExpenses(groupId: string) {
await this.page.goto(`http://localhost:3002/groups/${groupId}/expenses`)
}
async fillTitle(expenseTitle: string) {
await this.page
.getByRole('textbox', { name: 'Expense title' })
.fill(expenseTitle)
}
async fillAmount(expenseAmount: string) {
await this.page.getByRole('textbox', { name: 'Amount' }).fill(expenseAmount)
}
async selectPayer(payer: string) {
await this.page
.getByRole('combobox')
.filter({ hasText: 'Select a participant' })
.click()
await this.page.getByRole('option', { name: payer, exact: true }).click()
}
async submit() {
// Look for either Create or Save button
const createButton = this.page.getByRole('button', { name: 'Create' })
const saveButton = this.page.getByRole('button', { name: 'Save' })
if (await createButton.isVisible()) {
await createButton.click()
} else {
await saveButton.click()
}
// Wait for navigation to complete
await this.page.waitForLoadState('networkidle')
}
async waitForPageLoad() {
// Wait for the expense form to be fully loaded
await this.page.waitForLoadState('networkidle')
}
}