| import { Page, Locator } from '@playwright/test'; |
| import { clickElement } from '../core/interactions'; |
| import { waitForElement, waitForElementHidden } from '../core/waiting'; |
|
|
| |
| |
| |
| |
| |
| export async function dismissSandboxWarningIfVisible(page: Page): Promise<void> { |
| const sandboxAcceptBtn = page.locator('button:has-text("I Accept the Risks")'); |
| const sandboxVisible = await sandboxAcceptBtn |
| .waitFor({ state: 'visible', timeout: 2000 }) |
| .then(() => true) |
| .catch(() => false); |
| if (sandboxVisible) { |
| await sandboxAcceptBtn.click(); |
| await page |
| .locator('[role="dialog"][data-state="open"]') |
| .first() |
| .waitFor({ state: 'hidden', timeout: 3000 }) |
| .catch(() => {}); |
| } |
| } |
|
|
| |
| |
| |
| export async function isAddFeatureDialogVisible(page: Page): Promise<boolean> { |
| const dialog = page.locator('[data-testid="add-feature-dialog"]'); |
| return await dialog.isVisible().catch(() => false); |
| } |
|
|
| |
| |
| |
| export async function isAddContextDialogVisible(page: Page): Promise<boolean> { |
| const dialog = page.locator('[data-testid="add-context-dialog"]'); |
| return await dialog.isVisible().catch(() => false); |
| } |
|
|
| |
| |
| |
| export async function isEditFeatureDialogVisible(page: Page): Promise<boolean> { |
| const dialog = page.locator('[data-testid="edit-feature-dialog"]'); |
| return await dialog.isVisible().catch(() => false); |
| } |
|
|
| |
| |
| |
| export async function waitForEditFeatureDialog( |
| page: Page, |
| options?: { timeout?: number } |
| ): Promise<Locator> { |
| return await waitForElement(page, 'edit-feature-dialog', options); |
| } |
|
|
| |
| |
| |
| export async function getEditFeatureDescriptionInput(page: Page): Promise<Locator> { |
| return page.locator('[data-testid="edit-feature-description"]'); |
| } |
|
|
| |
| |
| |
| export async function isEditFeatureDescriptionTextarea(page: Page): Promise<boolean> { |
| const element = page.locator('[data-testid="edit-feature-description"]'); |
| const tagName = await element.evaluate((el) => el.tagName.toLowerCase()); |
| return tagName === 'textarea'; |
| } |
|
|
| |
| |
| |
| export async function openEditFeatureDialog(page: Page, featureId: string): Promise<void> { |
| await clickElement(page, `edit-feature-${featureId}`); |
| await waitForEditFeatureDialog(page); |
| } |
|
|
| |
| |
| |
| export async function fillEditFeatureDescription(page: Page, value: string): Promise<void> { |
| const input = await getEditFeatureDescriptionInput(page); |
| await input.fill(value); |
| } |
|
|
| |
| |
| |
| export async function confirmEditFeature(page: Page): Promise<void> { |
| await clickElement(page, 'confirm-edit-feature'); |
| } |
|
|
| |
| |
| |
| export async function getDeleteConfirmationDialog(page: Page): Promise<Locator> { |
| return page.locator('[data-testid="delete-confirmation-dialog"]'); |
| } |
|
|
| |
| |
| |
| export async function isDeleteConfirmationDialogVisible(page: Page): Promise<boolean> { |
| const dialog = page.locator('[data-testid="delete-confirmation-dialog"]'); |
| return await dialog.isVisible().catch(() => false); |
| } |
|
|
| |
| |
| |
| export async function waitForDeleteConfirmationDialog( |
| page: Page, |
| options?: { timeout?: number } |
| ): Promise<Locator> { |
| return await waitForElement(page, 'delete-confirmation-dialog', options); |
| } |
|
|
| |
| |
| |
| export async function waitForDeleteConfirmationDialogHidden( |
| page: Page, |
| options?: { timeout?: number } |
| ): Promise<void> { |
| await waitForElementHidden(page, 'delete-confirmation-dialog', options); |
| } |
|
|
| |
| |
| |
| export async function clickConfirmDeleteButton(page: Page): Promise<void> { |
| await clickElement(page, 'confirm-delete-button'); |
| } |
|
|
| |
| |
| |
| export async function clickCancelDeleteButton(page: Page): Promise<void> { |
| await clickElement(page, 'cancel-delete-button'); |
| } |
|
|
| |
| |
| |
| export async function isFollowUpDialogVisible(page: Page): Promise<boolean> { |
| const dialog = page.locator('[data-testid="follow-up-dialog"]'); |
| return await dialog.isVisible().catch(() => false); |
| } |
|
|
| |
| |
| |
| export async function waitForFollowUpDialog( |
| page: Page, |
| options?: { timeout?: number } |
| ): Promise<Locator> { |
| return await waitForElement(page, 'follow-up-dialog', options); |
| } |
|
|
| |
| |
| |
| export async function waitForFollowUpDialogHidden( |
| page: Page, |
| options?: { timeout?: number } |
| ): Promise<void> { |
| await waitForElementHidden(page, 'follow-up-dialog', options); |
| } |
|
|
| |
| |
| |
| export async function clickConfirmFollowUp(page: Page): Promise<void> { |
| await clickElement(page, 'confirm-follow-up'); |
| } |
|
|
| |
| |
| |
| export async function isProjectInitDialogVisible(page: Page): Promise<boolean> { |
| const dialog = page.locator('[data-testid="project-init-dialog"]'); |
| return await dialog.isVisible(); |
| } |
|
|
| |
| |
| |
| export async function waitForProjectInitDialog( |
| page: Page, |
| options?: { timeout?: number } |
| ): Promise<Locator> { |
| return await waitForElement(page, 'project-init-dialog', options); |
| } |
|
|
| |
| |
| |
| export async function closeProjectInitDialog(page: Page): Promise<void> { |
| const closeButton = page.locator('[data-testid="close-init-dialog"]'); |
| await closeButton.click(); |
| } |
|
|