fix user and activityFeed flaky playwright test (#18324)

This commit is contained in:
Ashish Gupta 2024-10-21 18:23:27 +05:30 committed by GitHub
parent dcf71aa0ea
commit c7a466b674
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 0 deletions

View File

@ -845,6 +845,10 @@ base.describe('Activity feed with Data Consumer User', () => {
page2.locator('[data-testid="edit-accept-task-dropdown"]') page2.locator('[data-testid="edit-accept-task-dropdown"]')
).not.toBeVisible(); ).not.toBeVisible();
await page2.waitForSelector('.ant-skeleton-element', {
state: 'detached',
});
const tagsSuggestionResponse = page2.waitForResponse( const tagsSuggestionResponse = page2.waitForResponse(
'/api/v1/search/query?q=***' '/api/v1/search/query?q=***'
); );

View File

@ -361,6 +361,9 @@ export const softDeleteUser = async (
await toastNotification(page, `"${displayName}" deleted successfully!`); await toastNotification(page, `"${displayName}" deleted successfully!`);
// Wait for the loader to disappear
await page.waitForSelector('[data-testid="loader"]', { state: 'hidden' });
// Search soft deleted user in non-deleted mode // Search soft deleted user in non-deleted mode
const searchSoftDeletedUserResponse = page.waitForResponse( const searchSoftDeletedUserResponse = page.waitForResponse(
'/api/v1/search/query*' '/api/v1/search/query*'
@ -382,7 +385,14 @@ export const restoreUser = async (
editedUserName: string editedUserName: string
) => { ) => {
// Click on deleted user toggle // Click on deleted user toggle
const fetchDeletedUsers = page.waitForResponse(
'/api/v1/users?**include=deleted'
);
await page.click('[data-testid="show-deleted"]'); await page.click('[data-testid="show-deleted"]');
await fetchDeletedUsers;
// Wait for the loader to disappear
await page.waitForSelector('[data-testid="loader"]', { state: 'hidden' });
const searchUsers = page.waitForResponse('/api/v1/search/query*'); const searchUsers = page.waitForResponse('/api/v1/search/query*');
await page.fill('[data-testid="searchbar"]', username); await page.fill('[data-testid="searchbar"]', username);
@ -414,7 +424,14 @@ export const permanentDeleteUser = async (
) => { ) => {
if (isUserSoftDeleted) { if (isUserSoftDeleted) {
// Click on deleted user toggle to off it // Click on deleted user toggle to off it
const fetchDeletedUsers = page.waitForResponse(
'/api/v1/users?**include=non-deleted'
);
await page.click('[data-testid="show-deleted"]'); await page.click('[data-testid="show-deleted"]');
await fetchDeletedUsers;
// Wait for the loader to disappear
await page.waitForSelector('[data-testid="loader"]', { state: 'hidden' });
} }
// Search the user // Search the user
@ -429,14 +446,21 @@ export const permanentDeleteUser = async (
await page.click('[data-testid="hard-delete"]'); await page.click('[data-testid="hard-delete"]');
await page.fill('[data-testid="confirmation-text-input"]', 'DELETE'); await page.fill('[data-testid="confirmation-text-input"]', 'DELETE');
const reFetchUsers = page.waitForResponse(
'/api/v1/users?**include=non-deleted'
);
const hardDeleteUserResponse = page.waitForResponse( const hardDeleteUserResponse = page.waitForResponse(
'api/v1/users/*?hardDelete=true&recursive=false' 'api/v1/users/*?hardDelete=true&recursive=false'
); );
await page.click('[data-testid="confirm-button"]'); await page.click('[data-testid="confirm-button"]');
await hardDeleteUserResponse; await hardDeleteUserResponse;
await reFetchUsers;
await toastNotification(page, `"${displayName}" deleted successfully!`); await toastNotification(page, `"${displayName}" deleted successfully!`);
// Wait for the loader to disappear
await page.waitForSelector('[data-testid="loader"]', { state: 'hidden' });
// Search the user again // Search the user again
const searchUserAfterDeleteResponse = page.waitForResponse( const searchUserAfterDeleteResponse = page.waitForResponse(
'/api/v1/search/query*' '/api/v1/search/query*'