mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 10:45:57 +00:00
Remove unused speculative abstractions: - Delete material-helpers.ts (223 lines, zero usages) - Delete retry-helpers.ts (186 lines, zero usages) - Revert unused assertion helpers - Revert unused timeout constants Keep valuable changes: - applyPrefix() helper in BasePage (used 4x) - ProjectPage now uses applyPrefix() for DRY - Simplified utils/index.ts barrel export
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import { expect } from '@playwright/test';
|
|
import type { Page } from '@playwright/test';
|
|
import type { TaskPage } from '../pages/task.page';
|
|
import type { DialogPage } from '../pages/dialog.page';
|
|
|
|
/**
|
|
* Assert that the task list has the expected number of tasks.
|
|
*/
|
|
export const expectTaskCount = async (
|
|
taskPage: TaskPage,
|
|
count: number,
|
|
): Promise<void> => {
|
|
await expect(taskPage.getAllTasks()).toHaveCount(count);
|
|
};
|
|
|
|
/**
|
|
* Assert that a task with the given text is visible.
|
|
*/
|
|
export const expectTaskVisible = async (
|
|
taskPage: TaskPage,
|
|
text: string,
|
|
): Promise<void> => {
|
|
const task = taskPage.getTaskByText(text);
|
|
await expect(task).toBeVisible();
|
|
};
|
|
|
|
/**
|
|
* Assert that a dialog is currently visible.
|
|
*/
|
|
export const expectDialogVisible = async (dialogPage: DialogPage): Promise<void> => {
|
|
const dialog = await dialogPage.waitForDialog();
|
|
await expect(dialog).toBeVisible();
|
|
};
|
|
|
|
/**
|
|
* Assert that no global error alert is displayed.
|
|
*/
|
|
export const expectNoGlobalError = async (page: Page): Promise<void> => {
|
|
const error = page.locator('.global-error-alert');
|
|
await expect(error).not.toBeVisible();
|
|
};
|
|
|
|
/**
|
|
* Assert that a task is marked as done.
|
|
*/
|
|
export const expectTaskDone = async (taskPage: TaskPage, text: string): Promise<void> => {
|
|
const task = taskPage.getTaskByText(text);
|
|
await expect(task).toHaveClass(/isDone/);
|
|
};
|
|
|
|
/**
|
|
* Assert that the done task count matches expected.
|
|
*/
|
|
export const expectDoneTaskCount = async (
|
|
taskPage: TaskPage,
|
|
count: number,
|
|
): Promise<void> => {
|
|
await expect(taskPage.getDoneTasks()).toHaveCount(count);
|
|
};
|