test: fix Playwright test timeouts in domain and data product selection

- Wait for initial page load before searching in selectDomain
- Wait for initial page load before searching in selectDataProduct
- Use data-testid selector instead of text filter in selectDataProduct
- Add 15s timeout to data product click action

Prevents race conditions where search interferes with initial page load,
fixing "Target page, context or browser has been closed" timeout errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Satish 2025-10-01 15:38:26 +05:30
parent adf6967c40
commit c86fe01f59

View File

@ -130,6 +130,10 @@ export const selectDomain = async (page: Page, domain: Domain['data']) => {
.getByTestId('page-layout-v1')
.getByPlaceholder('Search');
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
await Promise.all([
searchBox.fill(domain.name),
page.waitForResponse('/api/v1/search/query?q=*&index=domain_search_index*'),
@ -217,6 +221,10 @@ export const selectDataProduct = async (
.getByTestId('page-layout-v1')
.getByPlaceholder('Search');
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
await Promise.all([
searchBox.fill(dataProduct.name),
page.waitForResponse(
@ -229,7 +237,7 @@ export const selectDataProduct = async (
});
await Promise.all([
page.locator('td').filter({ hasText: dataProduct.displayName }).click(),
page.getByTestId(dataProduct.name).click({ timeout: 15000 }),
page.waitForResponse('/api/v1/dataProducts/name/*'),
]);