refactor: restructure test utilities and enhance context view tests

- Refactored test utilities by consolidating and organizing helper functions into dedicated modules for better maintainability and clarity.
- Introduced new utility functions for interactions, waiting, and element retrieval, improving the readability of test cases.
- Updated context view tests to utilize the new utility functions, enhancing test reliability and reducing code duplication.
- Removed deprecated utility functions and ensured all tests are aligned with the new structure.
This commit is contained in:
Kacper
2025-12-15 02:40:09 +01:00
parent a412f5d0fb
commit 0b1123e3ce
29 changed files with 3478 additions and 3191 deletions

View File

@@ -0,0 +1,40 @@
import { Page, Locator } from "@playwright/test";
/**
* Get an element by its data-testid attribute
*/
export async function getByTestId(
page: Page,
testId: string
): Promise<Locator> {
return page.locator(`[data-testid="${testId}"]`);
}
/**
* Get a button by its text content
*/
export async function getButtonByText(
page: Page,
text: string
): Promise<Locator> {
return page.locator(`button:has-text("${text}")`);
}
/**
* Get the category autocomplete input element
*/
export async function getCategoryAutocompleteInput(
page: Page,
testId: string = "feature-category-input"
): Promise<Locator> {
return page.locator(`[data-testid="${testId}"]`);
}
/**
* Get the category autocomplete dropdown list
*/
export async function getCategoryAutocompleteList(
page: Page
): Promise<Locator> {
return page.locator('[data-testid="category-autocomplete-list"]');
}