import { Page } from '@playwright/test'; import { CreateEventPage } from './CreateEventPage'; export class ModifyEventPage extends CreateEventPage { private readonly updateButton = 'input[name="community-event"][value="Update"]'; private readonly deleteButton = 'a:has-text("Delete Event")'; private readonly confirmDeleteButton = 'button:has-text("Yes, Delete")'; constructor(page: Page) { super(page); } async navigateToModifyEvent(eventId: string): Promise { await this.navigate(`/modify-event/?event_id=${eventId}`); } async updateEvent(): Promise { await this.click(this.updateButton); await this.waitForNavigation(); } async deleteEvent(confirm: boolean = true): Promise { await this.click(this.deleteButton); if (confirm) { await this.waitForElement(this.confirmDeleteButton); await this.click(this.confirmDeleteButton); await this.waitForNavigation(); } } async isUpdateButtonVisible(): Promise { return await this.isVisible(this.updateButton); } }