Skip to content

Commit

Permalink
playwright: fixed flakiness in tags spec (#17972)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaileshParmar11 authored Sep 24, 2024
1 parent 62ced79 commit 8b2894a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: '!@#$%^&*()',
};

Expand Down Expand Up @@ -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();
}

0 comments on commit 8b2894a

Please sign in to comment.