Skip to content

Commit bb64349

Browse files
authored
fix(playwright): replace flaky toast assertion with search-based deletion verification in teams & teams drag drop spec (#27341)
* fix(playwright): replace flaky toast assertion with search-based deletion verification in teams & teams drag drop spec * address gitar * address comments
1 parent 64e254d commit bb64349

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/TeamsDragAndDrop.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ test.describe(
216216

217217
await waitForAllLoadersToDisappear(page);
218218

219-
await hardDeleteTeam(page);
219+
await hardDeleteTeam(page, teamName);
220220

221221
// Validate the deleted team
222222
await expect(

openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Teams.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ test.describe('Teams Page', () => {
387387
teamDetails?.updatedName ?? ''
388388
);
389389

390-
await hardDeleteTeam(page);
390+
await hardDeleteTeam(page, teamDetails?.updatedName ?? teamDetails.name);
391391
});
392392
});
393393

@@ -501,7 +501,10 @@ test.describe('Teams Page', () => {
501501
team.responseData?.['displayName']
502502
);
503503

504-
await hardDeleteTeam(page);
504+
await hardDeleteTeam(
505+
page,
506+
team.responseData?.['displayName'] ?? team.data.name
507+
);
505508
await afterAction();
506509
});
507510

@@ -765,7 +768,7 @@ test.describe('Teams Page', () => {
765768
page.getByTestId('team-hierarchy-table').getByRole('link')
766769
).toContainText(team2Details.displayName);
767770

768-
await hardDeleteTeam(page);
771+
await hardDeleteTeam(page, team1Details.name);
769772
});
770773

771774
test('Total User Count should be rendered', async ({ page }) => {

openmetadata-ui/src/main/resources/ui/playwright/utils/team.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
assignDomain,
2222
descriptionBox,
2323
redirectToHomePage,
24-
toastNotification,
2524
uuid,
2625
} from './common';
2726
import {
@@ -133,12 +132,11 @@ export const softDeleteTeam = async (page: Page) => {
133132

134133
await page.click('[data-testid="confirm-button"]');
135134

136-
await deleteResponse;
137-
138-
await toastNotification(page, /deleted successfully!/);
135+
const response = await deleteResponse;
136+
expect(response.status()).toBe(200);
139137
};
140138

141-
export const hardDeleteTeam = async (page: Page) => {
139+
export const hardDeleteTeam = async (page: Page, teamName: string) => {
142140
await page
143141
.getByTestId('team-details-collapse')
144142
.getByTestId('manage-button')
@@ -159,9 +157,10 @@ export const hardDeleteTeam = async (page: Page) => {
159157

160158
await page.click('[data-testid="confirm-button"]');
161159

162-
await deleteResponse;
160+
const response = await deleteResponse;
161+
expect(response.status()).toBe(200);
163162

164-
await toastNotification(page, /deleted successfully!/);
163+
await searchTeam(page, teamName, { expectEmptyResults: true });
165164
};
166165

167166
export const getNewTeamDetails = (teamName: string) => {

0 commit comments

Comments
 (0)