From 8b2894a5c9f838945d3a524f71d70e4c46080bd5 Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Tue, 24 Sep 2024 22:15:03 +0530 Subject: [PATCH] playwright: fixed flakiness in tags spec (#17972) --- .../main/resources/ui/playwright/utils/tag.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts index a834a852115e..713cd7f02983 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts @@ -21,7 +21,8 @@ import { sidebarClick } from './sidebar'; export const TAG_INVALID_NAMES = { MIN_LENGTH: 'c', - MAX_LENGTH: 'a87439625b1c2d3e4f5061728394a5b6c7d8e90a1b2c3d4e5f67890ab', + MAX_LENGTH: + 'a87439625b1c2d3e4f5061728394a5b6c7d8e90a1b2c3d4e5f67890aba87439625b1c2d3e4f5061728394a5', WITH_SPECIAL_CHARS: '!@#$%^&*()', }; @@ -64,26 +65,27 @@ export async function validateForm(page: Page) { await page.locator('[data-testid="name"]').scrollIntoViewIfNeeded(); await page.locator('[data-testid="name"]').clear(); await page.locator('[data-testid="name"]').fill(TAG_INVALID_NAMES.MIN_LENGTH); + await page.waitForLoadState('domcontentloaded'); - await expect(page.locator('#tags_name_help')).toContainText( - NAME_MIN_MAX_LENGTH_VALIDATION_ERROR - ); + await expect( + page.getByText(NAME_MIN_MAX_LENGTH_VALIDATION_ERROR) + ).toBeVisible(); // max length validation await page.locator('[data-testid="name"]').clear(); await page.locator('[data-testid="name"]').fill(TAG_INVALID_NAMES.MAX_LENGTH); + await page.waitForLoadState('domcontentloaded'); - await expect(page.locator('#tags_name_help')).toContainText( - NAME_MIN_MAX_LENGTH_VALIDATION_ERROR - ); + await expect( + page.getByText(NAME_MIN_MAX_LENGTH_VALIDATION_ERROR) + ).toBeVisible(); // with special char validation await page.locator('[data-testid="name"]').clear(); await page .locator('[data-testid="name"]') .fill(TAG_INVALID_NAMES.WITH_SPECIAL_CHARS); + await page.waitForLoadState('domcontentloaded'); - await expect(page.locator('#tags_name_help')).toContainText( - NAME_VALIDATION_ERROR - ); + await expect(page.getByText(NAME_VALIDATION_ERROR)).toBeVisible(); }