PLAYWRIGHT: fix the flakiness around the tag.spec (#21920)

* fix the flakyness around the tag.spec

* fix the flaky test, as caused by using same tag for the delete and edit action
This commit is contained in:
Ashish Gupta 2025-06-25 14:28:50 +05:30 committed by GitHub
parent 89fcac6316
commit 9d6b86e5cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 11 deletions

View File

@ -158,7 +158,7 @@ test.describe('Tag Page with Admin Roles', () => {
const updateName = adminPage.waitForResponse(`/api/v1/tags/*`);
await adminPage.getByTestId('save-button').click();
updateName;
await updateName;
await expect(adminPage.getByText('TestDisplayName')).toBeVisible();
});
@ -181,7 +181,7 @@ test.describe('Tag Page with Admin Roles', () => {
const updateColor = adminPage.waitForResponse(`/api/v1/tags/*`);
await adminPage.locator('button[type="submit"]').click();
updateColor;
await updateColor;
await adminPage.waitForLoadState('networkidle');
@ -227,7 +227,7 @@ test.describe('Tag Page with Admin Roles', () => {
const deleteTag = adminPage.waitForResponse(`/api/v1/tags/*`);
await adminPage.getByTestId('confirm-button').click();
deleteTag;
await deleteTag;
await expect(
adminPage.getByText(classification.data.description)
@ -239,11 +239,11 @@ test.describe('Tag Page with Admin Roles', () => {
const { assets, assetCleanup } = await setupAssetsForTag(adminPage);
await test.step('Add Asset ', async () => {
await addAssetsToTag(adminPage, assets, tag);
await addAssetsToTag(adminPage, assets, tag1);
});
await test.step('Delete Asset', async () => {
await removeAssetsFromTag(adminPage, assets, tag);
await removeAssetsFromTag(adminPage, assets, tag1);
await assetCleanup();
});
});
@ -346,7 +346,7 @@ test.describe('Tag Page with Data Consumer Roles', () => {
test('Edit Tag Description for Data Consumer', async ({
dataConsumerPage,
}) => {
await editTagPageDescription(dataConsumerPage, tag);
await editTagPageDescription(dataConsumerPage, tag1);
});
test('Add and Remove Assets for Data Consumer', async ({
@ -381,7 +381,7 @@ test.describe('Tag Page with Data Steward Roles', () => {
});
test('Edit Tag Description for Data Steward', async ({ dataStewardPage }) => {
await editTagPageDescription(dataStewardPage, tag);
await editTagPageDescription(dataStewardPage, tag1);
});
test('Add and Remove Assets for Data Steward', async ({

View File

@ -69,9 +69,7 @@ export class TagClass {
this.responseData.classification.name,
this.responseData.classification.displayName
);
const res = page.waitForResponse(`/api/v1/tags/name/*`);
await page.getByTestId(this.data.name).click();
await res;
await page.waitForLoadState('networkidle');
}

View File

@ -24,6 +24,7 @@ import { TopicClass } from '../support/entity/TopicClass';
import { TagClass } from '../support/tag/TagClass';
import {
descriptionBox,
descriptionBoxReadOnly,
getApiContext,
NAME_MIN_MAX_LENGTH_VALIDATION_ERROR,
NAME_VALIDATION_ERROR,
@ -78,6 +79,7 @@ export const visitClassificationPage = async (
);
await fetchTags;
await page.waitForLoadState('networkidle');
await page.waitForSelector(
'[data-testid="tags-container"] [data-testid="loader"]',
{ state: 'detached' }
@ -342,7 +344,9 @@ export const verifyTagPageUI = async (
await expect(page.getByTestId('entity-header-name')).toContainText(
tag.data.name
);
await expect(page.getByText(tag.data.description)).toBeVisible();
await expect(page.locator(descriptionBoxReadOnly)).toContainText(
tag.data.description
);
await expect(
page.getByTestId('data-classification-add-button')
@ -357,7 +361,7 @@ export const verifyTagPageUI = async (
`/api/v1/classifications/name/*`
);
await page.getByRole('link', { name: classificationName }).click();
classificationTable;
await classificationTable;
const res = page.waitForResponse(`/api/v1/tags/name/*`);
await page.getByTestId(tag.data.name).click();