mirror of
https://github.com/spliit-app/spliit.git
synced 2026-03-03 19:46:13 +01:00
Add expense creation to E2E tests using Page Object Model
This commit is contained in:
33
tests/pom/create-group-page.ts
Normal file
33
tests/pom/create-group-page.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Page } from '@playwright/test'
|
||||
|
||||
export class CreateGroupPage {
|
||||
constructor(private page: Page) {}
|
||||
|
||||
async navigate() {
|
||||
await this.page.goto('http://localhost:3002/groups/create')
|
||||
}
|
||||
|
||||
async fillGroupName(name: string) {
|
||||
await this.page.getByRole('textbox', { name: 'Group name' }).fill(name)
|
||||
}
|
||||
|
||||
async fillCurrency(currency: string) {
|
||||
await this.page.getByRole('textbox', { name: 'Currency' }).fill(currency)
|
||||
}
|
||||
|
||||
async fillAdditionalInfo(info: string) {
|
||||
await this.page
|
||||
.getByRole('textbox', { name: 'Group Information' })
|
||||
.fill(info)
|
||||
}
|
||||
|
||||
async addParticipant(participantName: string, index: number) {
|
||||
await this.page
|
||||
.locator(`input[name="participants.${index}.name"]`)
|
||||
.fill(participantName)
|
||||
}
|
||||
|
||||
async submit() {
|
||||
await this.page.getByRole('button', { name: 'Create' }).click()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user