mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 10:39:30 +00:00 
			
		
		
		
	PLAYWRIGHT: fix activity feed mention flaky test (#23823)
This commit is contained in:
		
							parent
							
								
									9d0a739c69
								
							
						
					
					
						commit
						8ccd879655
					
				| @ -21,7 +21,6 @@ import { | |||||||
|   navigateToCustomizeLandingPage, |   navigateToCustomizeLandingPage, | ||||||
|   setUserDefaultPersona, |   setUserDefaultPersona, | ||||||
| } from '../../utils/customizeLandingPage'; | } from '../../utils/customizeLandingPage'; | ||||||
| import { updateDescription } from '../../utils/entity'; |  | ||||||
| 
 | 
 | ||||||
| const test = base; | const test = base; | ||||||
| 
 | 
 | ||||||
| @ -382,7 +381,6 @@ test.describe('FeedWidget on landing page', () => { | |||||||
| test.describe('Mention notifications in Notification Box', () => { | test.describe('Mention notifications in Notification Box', () => { | ||||||
|   const adminUser = new UserClass(); |   const adminUser = new UserClass(); | ||||||
|   const user1 = new UserClass(); |   const user1 = new UserClass(); | ||||||
|   const entity = new TableClass(); |  | ||||||
| 
 | 
 | ||||||
|   const test = base.extend<{ |   const test = base.extend<{ | ||||||
|     adminPage: Page; |     adminPage: Page; | ||||||
| @ -405,14 +403,11 @@ test.describe('Mention notifications in Notification Box', () => { | |||||||
|   test.beforeAll('Setup entities and users', async ({ browser }) => { |   test.beforeAll('Setup entities and users', async ({ browser }) => { | ||||||
|     const { apiContext, afterAction } = await performAdminLogin(browser); |     const { apiContext, afterAction } = await performAdminLogin(browser); | ||||||
| 
 | 
 | ||||||
|     try { |     await adminUser.create(apiContext); | ||||||
|       await adminUser.create(apiContext); |     await adminUser.setAdminRole(apiContext); | ||||||
|       await adminUser.setAdminRole(apiContext); |     await user1.create(apiContext); | ||||||
|       await user1.create(apiContext); |     await entity.create(apiContext); | ||||||
|       await entity.create(apiContext); |     await afterAction(); | ||||||
|     } finally { |  | ||||||
|       await afterAction(); |  | ||||||
|     } |  | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   test('Mention notification shows correct user details in Notification box', async ({ |   test('Mention notification shows correct user details in Notification box', async ({ | ||||||
| @ -421,55 +416,18 @@ test.describe('Mention notifications in Notification Box', () => { | |||||||
|   }) => { |   }) => { | ||||||
|     test.slow(); |     test.slow(); | ||||||
| 
 | 
 | ||||||
|  |     const entityFQN = 'sample_data.ecommerce_db.shopify.performance_test_table'; | ||||||
|  | 
 | ||||||
|     await test.step( |     await test.step( | ||||||
|       'Admin user creates a conversation on an entity', |       'Admin user creates a conversation on an entity', | ||||||
|       async () => { |       async () => { | ||||||
|         await entity.visitEntityPage(adminPage); |         await adminPage.goto(`/table/${entityFQN}`); | ||||||
| 
 | 
 | ||||||
|         await adminPage.waitForLoadState('networkidle'); |         await adminPage.waitForLoadState('networkidle'); | ||||||
|         await adminPage.waitForSelector('[data-testid="loader"]', { |         await adminPage.waitForSelector('[data-testid="loader"]', { | ||||||
|           state: 'detached', |           state: 'detached', | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         await updateDescription( |  | ||||||
|           adminPage, |  | ||||||
|           'update the old description with new one' |  | ||||||
|         ); |  | ||||||
| 
 |  | ||||||
|         await adminPage.reload(); |  | ||||||
|         await adminPage.waitForLoadState('networkidle'); |  | ||||||
|         await adminPage.waitForSelector('[data-testid="loader"]', { |  | ||||||
|           state: 'detached', |  | ||||||
|         }); |  | ||||||
| 
 |  | ||||||
|         let count = 0; |  | ||||||
|         let iterations = 0; |  | ||||||
|         const maxIterations = 20; |  | ||||||
|         const delayMs = 5000; |  | ||||||
| 
 |  | ||||||
|         while (iterations < maxIterations) { |  | ||||||
|           const countElement = adminPage |  | ||||||
|             .getByTestId('activity_feed') |  | ||||||
|             .getByTestId('filter-count'); |  | ||||||
| 
 |  | ||||||
|           const countText = await countElement.textContent(); |  | ||||||
|           count = parseInt(countText ?? '0', 10); |  | ||||||
| 
 |  | ||||||
|           if (count > 0) { |  | ||||||
|             break; |  | ||||||
|           } |  | ||||||
| 
 |  | ||||||
|           iterations++; |  | ||||||
|           if (iterations < maxIterations) { |  | ||||||
|             await adminPage.waitForTimeout(delayMs); |  | ||||||
|             await adminPage.reload(); |  | ||||||
|             await adminPage.waitForLoadState('networkidle'); |  | ||||||
|             await adminPage.waitForSelector('[data-testid="loader"]', { |  | ||||||
|               state: 'detached', |  | ||||||
|             }); |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         await adminPage.getByTestId('activity_feed').click(); |         await adminPage.getByTestId('activity_feed').click(); | ||||||
|         await adminPage.waitForLoadState('networkidle'); |         await adminPage.waitForLoadState('networkidle'); | ||||||
| 
 | 
 | ||||||
| @ -504,7 +462,11 @@ test.describe('Mention notifications in Notification Box', () => { | |||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     await test.step('User1 mentions admin user in a reply', async () => { |     await test.step('User1 mentions admin user in a reply', async () => { | ||||||
|       await entity.visitEntityPage(user1Page); |       await user1Page.goto(`/table/${entityFQN}`); | ||||||
|  |       await user1Page.waitForLoadState('networkidle'); | ||||||
|  |       await user1Page.waitForSelector('[data-testid="loader"]', { | ||||||
|  |         state: 'detached', | ||||||
|  |       }); | ||||||
| 
 | 
 | ||||||
|       await user1Page.getByTestId('activity_feed').click(); |       await user1Page.getByTestId('activity_feed').click(); | ||||||
|       await user1Page.waitForLoadState('networkidle'); |       await user1Page.waitForLoadState('networkidle'); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ashish Gupta
						Ashish Gupta