mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-14 18:03:38 +00:00
test: improve Playwright test reliability with timeouts and race condition fixes
- Fix race condition in subdomain creation test using Promise.all - Add 15-second timeouts to element visibility checks across domain tests - Add timeouts to tab clicks and count verification functions - Prevent flaky test failures in CI/CD environments 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f093042245
commit
3967e56c5c
@ -440,12 +440,13 @@ test.describe('Domains', () => {
|
|||||||
await sidebarClick(page, SidebarItem.DOMAIN);
|
await sidebarClick(page, SidebarItem.DOMAIN);
|
||||||
await selectDomain(page, domain.data);
|
await selectDomain(page, domain.data);
|
||||||
|
|
||||||
const subDomainApiRes = page.waitForResponse(
|
// Create sub domain and wait for auto-navigation to subdomains tab
|
||||||
'/api/v1/search/query?q=&index=domain_search_index&from=0&size=9&deleted=false*'
|
await Promise.all([
|
||||||
);
|
createSubDomain(page, subDomain.data),
|
||||||
// Create sub domain
|
page.waitForResponse(
|
||||||
await createSubDomain(page, subDomain.data);
|
'/api/v1/search/query?q=&index=domain_search_index&from=0&size=9&deleted=false*'
|
||||||
await subDomainApiRes;
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
await page.waitForSelector('[data-testid="loader"]', {
|
await page.waitForSelector('[data-testid="loader"]', {
|
||||||
state: 'detached',
|
state: 'detached',
|
||||||
@ -466,10 +467,10 @@ test.describe('Domains', () => {
|
|||||||
// Check that the followed domain is shown in the following widget
|
// Check that the followed domain is shown in the following widget
|
||||||
await expect(
|
await expect(
|
||||||
page.locator('[data-testid="following-widget"]')
|
page.locator('[data-testid="following-widget"]')
|
||||||
).toBeVisible();
|
).toBeVisible({ timeout: 15000 });
|
||||||
await expect(
|
await expect(
|
||||||
page.locator('[data-testid="following-widget"]')
|
page.locator('[data-testid="following-widget"]')
|
||||||
).toContainText(subDomain.data.displayName);
|
).toContainText(subDomain.data.displayName, { timeout: 15000 });
|
||||||
|
|
||||||
const subDomainRes = page.waitForResponse('/api/v1/domains/name/*');
|
const subDomainRes = page.waitForResponse('/api/v1/domains/name/*');
|
||||||
await page
|
await page
|
||||||
@ -486,10 +487,10 @@ test.describe('Domains', () => {
|
|||||||
// Check that the domain is not shown in the following widget
|
// Check that the domain is not shown in the following widget
|
||||||
await expect(
|
await expect(
|
||||||
page.locator('[data-testid="following-widget"]')
|
page.locator('[data-testid="following-widget"]')
|
||||||
).toBeVisible();
|
).toBeVisible({ timeout: 15000 });
|
||||||
await expect(
|
await expect(
|
||||||
page.locator('[data-testid="following-widget"]')
|
page.locator('[data-testid="following-widget"]')
|
||||||
).not.toContainText(subDomain.data.displayName);
|
).not.toContainText(subDomain.data.displayName, { timeout: 15000 });
|
||||||
|
|
||||||
await sidebarClick(page, SidebarItem.DOMAIN);
|
await sidebarClick(page, SidebarItem.DOMAIN);
|
||||||
|
|
||||||
|
|||||||
@ -77,9 +77,9 @@ test.describe('SubDomain Pagination', () => {
|
|||||||
await test.step('Verify subdomain count in tab label', async () => {
|
await test.step('Verify subdomain count in tab label', async () => {
|
||||||
const subDomainsTab = page.getByTestId('subdomains');
|
const subDomainsTab = page.getByTestId('subdomains');
|
||||||
|
|
||||||
await expect(subDomainsTab).toBeVisible();
|
await expect(subDomainsTab).toBeVisible({ timeout: 15000 });
|
||||||
|
|
||||||
await expect(subDomainsTab).toContainText('60');
|
await expect(subDomainsTab).toContainText('60', { timeout: 15000 });
|
||||||
});
|
});
|
||||||
|
|
||||||
await test.step(
|
await test.step(
|
||||||
|
|||||||
@ -242,7 +242,7 @@ const goToAssetsTab = async (page: Page, domain: Domain['data']) => {
|
|||||||
await checkDomainDisplayName(page, domain.displayName);
|
await checkDomainDisplayName(page, domain.displayName);
|
||||||
|
|
||||||
const assetRes = page.waitForResponse('/api/v1/search/query?q=&index=all*');
|
const assetRes = page.waitForResponse('/api/v1/search/query?q=&index=all*');
|
||||||
await page.getByTestId('assets').click();
|
await page.getByTestId('assets').click({ timeout: 15000 });
|
||||||
await assetRes;
|
await assetRes;
|
||||||
|
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('networkidle');
|
||||||
@ -286,20 +286,22 @@ export const checkDomainDisplayName = async (
|
|||||||
displayName: string
|
displayName: string
|
||||||
) => {
|
) => {
|
||||||
await expect(page.getByTestId('entity-header-display-name')).toHaveText(
|
await expect(page.getByTestId('entity-header-display-name')).toHaveText(
|
||||||
displayName
|
displayName,
|
||||||
|
{ timeout: 15000 }
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const checkAssetsCount = async (page: Page, count: number) => {
|
export const checkAssetsCount = async (page: Page, count: number) => {
|
||||||
await expect(page.getByTestId('assets').getByTestId('count')).toContainText(
|
await expect(page.getByTestId('assets').getByTestId('count')).toContainText(
|
||||||
count.toString()
|
count.toString(),
|
||||||
|
{ timeout: 15000 }
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const checkDataProductCount = async (page: Page, count: number) => {
|
export const checkDataProductCount = async (page: Page, count: number) => {
|
||||||
await expect(
|
await expect(
|
||||||
page.getByTestId('data_products').getByTestId('count')
|
page.getByTestId('data_products').getByTestId('count')
|
||||||
).toContainText(count.toString());
|
).toContainText(count.toString(), { timeout: 15000 });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const verifyDomain = async (
|
export const verifyDomain = async (
|
||||||
@ -489,7 +491,7 @@ export const addAssetsToDataProduct = async (
|
|||||||
dataProductFqn: string,
|
dataProductFqn: string,
|
||||||
assets: EntityClass[]
|
assets: EntityClass[]
|
||||||
) => {
|
) => {
|
||||||
await page.getByTestId('assets').click();
|
await page.getByTestId('assets').click({ timeout: 15000 });
|
||||||
await checkAssetsCount(page, 0);
|
await checkAssetsCount(page, 0);
|
||||||
|
|
||||||
await expect(page.getByTestId('no-data-placeholder')).toContainText(
|
await expect(page.getByTestId('no-data-placeholder')).toContainText(
|
||||||
@ -547,7 +549,7 @@ export const removeAssetsFromDataProduct = async (
|
|||||||
dataProduct: DataProduct['data'],
|
dataProduct: DataProduct['data'],
|
||||||
assets: EntityClass[]
|
assets: EntityClass[]
|
||||||
) => {
|
) => {
|
||||||
await page.getByTestId('assets').click();
|
await page.getByTestId('assets').click({ timeout: 15000 });
|
||||||
for (const asset of assets) {
|
for (const asset of assets) {
|
||||||
const fqn = get(asset, 'entityResponseData.fullyQualifiedName');
|
const fqn = get(asset, 'entityResponseData.fullyQualifiedName');
|
||||||
await page.locator(`[data-testid="table-data-card_${fqn}"] input`).check();
|
await page.locator(`[data-testid="table-data-card_${fqn}"] input`).check();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user