mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-02 03:29:03 +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 selectDomain(page, domain.data);
|
||||
|
||||
const subDomainApiRes = page.waitForResponse(
|
||||
'/api/v1/search/query?q=&index=domain_search_index&from=0&size=9&deleted=false*'
|
||||
);
|
||||
// Create sub domain
|
||||
await createSubDomain(page, subDomain.data);
|
||||
await subDomainApiRes;
|
||||
// Create sub domain and wait for auto-navigation to subdomains tab
|
||||
await Promise.all([
|
||||
createSubDomain(page, subDomain.data),
|
||||
page.waitForResponse(
|
||||
'/api/v1/search/query?q=&index=domain_search_index&from=0&size=9&deleted=false*'
|
||||
),
|
||||
]);
|
||||
|
||||
await page.waitForSelector('[data-testid="loader"]', {
|
||||
state: 'detached',
|
||||
@ -466,10 +467,10 @@ test.describe('Domains', () => {
|
||||
// Check that the followed domain is shown in the following widget
|
||||
await expect(
|
||||
page.locator('[data-testid="following-widget"]')
|
||||
).toBeVisible();
|
||||
).toBeVisible({ timeout: 15000 });
|
||||
await expect(
|
||||
page.locator('[data-testid="following-widget"]')
|
||||
).toContainText(subDomain.data.displayName);
|
||||
).toContainText(subDomain.data.displayName, { timeout: 15000 });
|
||||
|
||||
const subDomainRes = page.waitForResponse('/api/v1/domains/name/*');
|
||||
await page
|
||||
@ -486,10 +487,10 @@ test.describe('Domains', () => {
|
||||
// Check that the domain is not shown in the following widget
|
||||
await expect(
|
||||
page.locator('[data-testid="following-widget"]')
|
||||
).toBeVisible();
|
||||
).toBeVisible({ timeout: 15000 });
|
||||
await expect(
|
||||
page.locator('[data-testid="following-widget"]')
|
||||
).not.toContainText(subDomain.data.displayName);
|
||||
).not.toContainText(subDomain.data.displayName, { timeout: 15000 });
|
||||
|
||||
await sidebarClick(page, SidebarItem.DOMAIN);
|
||||
|
||||
|
||||
@ -77,9 +77,9 @@ test.describe('SubDomain Pagination', () => {
|
||||
await test.step('Verify subdomain count in tab label', async () => {
|
||||
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(
|
||||
|
||||
@ -242,7 +242,7 @@ const goToAssetsTab = async (page: Page, domain: Domain['data']) => {
|
||||
await checkDomainDisplayName(page, domain.displayName);
|
||||
|
||||
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 page.waitForLoadState('networkidle');
|
||||
@ -286,20 +286,22 @@ export const checkDomainDisplayName = async (
|
||||
displayName: string
|
||||
) => {
|
||||
await expect(page.getByTestId('entity-header-display-name')).toHaveText(
|
||||
displayName
|
||||
displayName,
|
||||
{ timeout: 15000 }
|
||||
);
|
||||
};
|
||||
|
||||
export const checkAssetsCount = async (page: Page, count: number) => {
|
||||
await expect(page.getByTestId('assets').getByTestId('count')).toContainText(
|
||||
count.toString()
|
||||
count.toString(),
|
||||
{ timeout: 15000 }
|
||||
);
|
||||
};
|
||||
|
||||
export const checkDataProductCount = async (page: Page, count: number) => {
|
||||
await expect(
|
||||
page.getByTestId('data_products').getByTestId('count')
|
||||
).toContainText(count.toString());
|
||||
).toContainText(count.toString(), { timeout: 15000 });
|
||||
};
|
||||
|
||||
export const verifyDomain = async (
|
||||
@ -489,7 +491,7 @@ export const addAssetsToDataProduct = async (
|
||||
dataProductFqn: string,
|
||||
assets: EntityClass[]
|
||||
) => {
|
||||
await page.getByTestId('assets').click();
|
||||
await page.getByTestId('assets').click({ timeout: 15000 });
|
||||
await checkAssetsCount(page, 0);
|
||||
|
||||
await expect(page.getByTestId('no-data-placeholder')).toContainText(
|
||||
@ -547,7 +549,7 @@ export const removeAssetsFromDataProduct = async (
|
||||
dataProduct: DataProduct['data'],
|
||||
assets: EntityClass[]
|
||||
) => {
|
||||
await page.getByTestId('assets').click();
|
||||
await page.getByTestId('assets').click({ timeout: 15000 });
|
||||
for (const asset of assets) {
|
||||
const fqn = get(asset, 'entityResponseData.fullyQualifiedName');
|
||||
await page.locator(`[data-testid="table-data-card_${fqn}"] input`).check();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user