| 
									
										
										
										
											2024-06-26 17:02:30 +05:30
										 |  |  | /* | 
					
						
							|  |  |  |  *  Copyright 2024 Collate. | 
					
						
							|  |  |  |  *  Licensed under the Apache License, Version 2.0 (the "License"); | 
					
						
							|  |  |  |  *  you may not use this file except in compliance with the License. | 
					
						
							|  |  |  |  *  You may obtain a copy of the License at | 
					
						
							|  |  |  |  *  http://www.apache.org/licenses/LICENSE-2.0
 | 
					
						
							|  |  |  |  *  Unless required by applicable law or agreed to in writing, software | 
					
						
							|  |  |  |  *  distributed under the License is distributed on an "AS IS" BASIS, | 
					
						
							|  |  |  |  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
					
						
							|  |  |  |  *  See the License for the specific language governing permissions and | 
					
						
							|  |  |  |  *  limitations under the License. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2025-10-01 16:21:43 +05:30
										 |  |  | import { expect, Page, test as base } from '@playwright/test'; | 
					
						
							| 
									
										
										
										
											2024-06-26 17:02:30 +05:30
										 |  |  | import { TableClass } from '../../support/entity/TableClass'; | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  | import { PersonaClass } from '../../support/persona/PersonaClass'; | 
					
						
							| 
									
										
										
										
											2024-06-26 17:02:30 +05:30
										 |  |  | import { UserClass } from '../../support/user/UserClass'; | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  | import { REACTION_EMOJIS, reactOnFeed } from '../../utils/activityFeed'; | 
					
						
							| 
									
										
										
										
											2024-07-30 15:05:56 +05:30
										 |  |  | import { performAdminLogin } from '../../utils/admin'; | 
					
						
							| 
									
										
										
										
											2025-08-30 18:37:45 +05:30
										 |  |  | import { redirectToHomePage } from '../../utils/common'; | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  | import { | 
					
						
							|  |  |  |   navigateToCustomizeLandingPage, | 
					
						
							|  |  |  |   setUserDefaultPersona, | 
					
						
							|  |  |  | } from '../../utils/customizeLandingPage'; | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-01 16:21:43 +05:30
										 |  |  | const test = base; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-22 18:53:43 +05:30
										 |  |  | const adminUser = new UserClass(); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  | const user1 = new UserClass(); | 
					
						
							| 
									
										
										
										
											2025-10-01 16:21:43 +05:30
										 |  |  | const entity = new TableClass(); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  | const extraEntity = new TableClass(); | 
					
						
							|  |  |  | const testPersona = new PersonaClass(); | 
					
						
							| 
									
										
										
										
											2024-08-22 18:53:43 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  | test.describe('FeedWidget on landing page', () => { | 
					
						
							|  |  |  |   test.beforeAll( | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     'setup: seed entities, users, create persona, and customize widget', | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     async ({ browser }) => { | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |       test.slow(true); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |       const { apiContext, afterAction } = await performAdminLogin(browser); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |       try { | 
					
						
							|  |  |  |         // Create users and entities
 | 
					
						
							|  |  |  |         await adminUser.create(apiContext); | 
					
						
							|  |  |  |         await adminUser.setAdminRole(apiContext); | 
					
						
							|  |  |  |         await user1.create(apiContext); | 
					
						
							| 
									
										
										
										
											2025-10-01 16:21:43 +05:30
										 |  |  |         await entity.create(apiContext); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |         await extraEntity.create(apiContext); | 
					
						
							|  |  |  |         await testPersona.create(apiContext, [adminUser.responseData.id]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Set up widget in a separate page context
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |         const adminPage = await browser.newPage(); | 
					
						
							|  |  |  |         await adminUser.login(adminPage); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |         try { | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |           // Set persona as default
 | 
					
						
							|  |  |  |           await redirectToHomePage(adminPage); | 
					
						
							|  |  |  |           await setUserDefaultPersona(adminPage, testPersona.data.displayName); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           // Navigate to customize landing page
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |           await navigateToCustomizeLandingPage(adminPage, { | 
					
						
							|  |  |  |             personaName: testPersona.data.name, | 
					
						
							|  |  |  |           }); | 
					
						
							| 
									
										
										
										
											2024-06-26 17:02:30 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |           // Ensure Activity Feed widget is full size
 | 
					
						
							|  |  |  |           const activityFeedWidget = adminPage.getByTestId( | 
					
						
							|  |  |  |             'KnowledgePanel.ActivityFeed' | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |           ); | 
					
						
							| 
									
										
										
										
											2025-07-19 17:59:14 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |           await expect(activityFeedWidget).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2025-07-19 17:59:14 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |           const moreOptionsButton = activityFeedWidget.getByTestId( | 
					
						
							|  |  |  |             'more-options-button' | 
					
						
							|  |  |  |           ); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |           await moreOptionsButton.click(); | 
					
						
							|  |  |  |           await adminPage.getByRole('menuitem', { name: 'Full Size' }).click(); | 
					
						
							| 
									
										
										
										
											2025-07-19 17:59:14 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |           // Save the layout if save button is enabled
 | 
					
						
							|  |  |  |           const saveButton = adminPage.getByTestId('save-button'); | 
					
						
							|  |  |  |           if (await saveButton.isEnabled()) { | 
					
						
							|  |  |  |             const saveResponse = adminPage.waitForResponse('/api/v1/docStore*'); | 
					
						
							|  |  |  |             await saveButton.click(); | 
					
						
							|  |  |  |             await adminPage.waitForLoadState('networkidle'); | 
					
						
							|  |  |  |             await saveResponse; | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2024-06-26 17:02:30 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |           await redirectToHomePage(adminPage); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |           await adminPage.waitForLoadState('networkidle'); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |         } finally { | 
					
						
							|  |  |  |           await adminPage.close(); | 
					
						
							| 
									
										
										
										
											2025-07-19 17:59:14 +05:30
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |       } finally { | 
					
						
							|  |  |  |         await afterAction(); | 
					
						
							| 
									
										
										
										
											2025-07-19 17:59:14 +05:30
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     } | 
					
						
							|  |  |  |   ); | 
					
						
							| 
									
										
										
										
											2024-06-26 17:02:30 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |   test.afterAll( | 
					
						
							|  |  |  |     'cleanup: delete entities, users, and persona', | 
					
						
							|  |  |  |     async ({ browser }) => { | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |       const { apiContext, afterAction } = await performAdminLogin(browser); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |       try { | 
					
						
							| 
									
										
										
										
											2025-10-01 16:21:43 +05:30
										 |  |  |         await entity.delete(apiContext); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |         await extraEntity.delete(apiContext); | 
					
						
							|  |  |  |         await user1.delete(apiContext); | 
					
						
							|  |  |  |         await testPersona.delete(apiContext); | 
					
						
							|  |  |  |         await adminUser.delete(apiContext); | 
					
						
							|  |  |  |       } finally { | 
					
						
							|  |  |  |         await afterAction(); | 
					
						
							| 
									
										
										
										
											2025-07-19 17:59:14 +05:30
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |   ); | 
					
						
							| 
									
										
										
										
											2024-06-26 17:02:30 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |   test.beforeEach(async ({ page }) => { | 
					
						
							|  |  |  |     await adminUser.login(page); | 
					
						
							|  |  |  |     await redirectToHomePage(page); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     await page.waitForLoadState('networkidle'); | 
					
						
							| 
									
										
										
										
											2024-09-15 19:43:21 +05:30
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |   test('renders widget wrapper and header with sort dropdown', async ({ | 
					
						
							| 
									
										
										
										
											2025-07-19 17:59:14 +05:30
										 |  |  |     page, | 
					
						
							|  |  |  |   }) => { | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     const widget = page.getByTestId('KnowledgePanel.ActivityFeed'); | 
					
						
							| 
									
										
										
										
											2024-09-15 19:43:21 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(widget).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-09-15 19:43:21 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Header verification
 | 
					
						
							|  |  |  |     const header = widget.getByTestId('widget-header'); | 
					
						
							| 
									
										
										
										
											2024-09-15 19:43:21 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(header).toBeVisible(); | 
					
						
							|  |  |  |     await expect(header).toContainText('Activity Feed'); | 
					
						
							| 
									
										
										
										
											2024-09-15 19:43:21 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Sort dropdown verification
 | 
					
						
							|  |  |  |     const sortDropdown = header.getByTestId('widget-sort-by-dropdown'); | 
					
						
							| 
									
										
										
										
											2024-06-26 17:02:30 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(sortDropdown).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-06-26 17:02:30 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Test dropdown options
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await sortDropdown.click(); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     await page.waitForSelector('.ant-dropdown', { state: 'visible' }); | 
					
						
							| 
									
										
										
										
											2024-06-26 17:02:30 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |     await expect( | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |       page.getByRole('menuitem', { name: 'All Activity' }) | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     ).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     await expect(page.getByRole('menuitem', { name: 'My Data' })).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect( | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |       page.getByRole('menuitem', { name: 'Following' }) | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     ).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2025-06-12 23:14:02 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Close dropdown by clicking outside
 | 
					
						
							|  |  |  |     await widget.click(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     await expect(page.locator('.ant-dropdown')).not.toBeVisible(); | 
					
						
							| 
									
										
										
										
											2025-06-12 23:14:02 +05:30
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |   test('clicking title navigates to explore page', async ({ page }) => { | 
					
						
							|  |  |  |     const widget = page.getByTestId('KnowledgePanel.ActivityFeed'); | 
					
						
							| 
									
										
										
										
											2024-07-19 12:04:56 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(widget).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-07-19 12:04:56 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Click the title to navigate
 | 
					
						
							|  |  |  |     const titleLink = widget | 
					
						
							|  |  |  |       .getByTestId('widget-header') | 
					
						
							|  |  |  |       .getByText('Activity Feed'); | 
					
						
							|  |  |  |     await titleLink.click(); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await page.waitForLoadState('networkidle'); | 
					
						
							| 
									
										
										
										
											2024-07-19 12:04:56 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Verify navigation to explore
 | 
					
						
							|  |  |  |     await expect(page.url()).toContain('/explore'); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2024-08-22 18:53:43 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |   test('feed body renders content or empty state', async ({ page }) => { | 
					
						
							|  |  |  |     const widget = page.getByTestId('KnowledgePanel.ActivityFeed'); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(widget).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Wait for feed content to load
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     const container = page.locator('#feedWidgetData'); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(container).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Check for either content or empty state
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     const messageContainers = container.locator( | 
					
						
							|  |  |  |       '[data-testid="message-container"]' | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  |     ); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     const emptyState = container.locator( | 
					
						
							|  |  |  |       '[data-testid="no-data-placeholder-container"]' | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  |     ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     const hasMessages = (await messageContainers.count()) > 0; | 
					
						
							|  |  |  |     const hasEmpty = (await emptyState.count()) > 0; | 
					
						
							| 
									
										
										
										
											2024-09-25 23:57:59 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     expect(hasMessages || hasEmpty).toBe(true); | 
					
						
							| 
									
										
										
										
											2024-08-15 07:59:50 +05:30
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |   test('changing filter triggers feed reload', async ({ page }) => { | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     const widget = page.getByTestId('KnowledgePanel.ActivityFeed'); | 
					
						
							| 
									
										
										
										
											2025-06-09 11:22:18 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(widget).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2025-06-09 11:22:18 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     const sortDropdown = widget.getByTestId('widget-sort-by-dropdown'); | 
					
						
							| 
									
										
										
										
											2025-06-25 23:08:57 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(sortDropdown).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2025-06-09 11:22:18 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Switch to My Data filter
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await sortDropdown.click(); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     await page.waitForSelector('.ant-dropdown', { state: 'visible' }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const myDataOption = page.getByRole('menuitem', { name: 'My Data' }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const feedResponse = page.waitForResponse('/api/v1/feed*'); | 
					
						
							|  |  |  |     await myDataOption.click(); | 
					
						
							|  |  |  |     await page.waitForLoadState('networkidle'); | 
					
						
							|  |  |  |     await feedResponse; | 
					
						
							| 
									
										
										
										
											2025-06-09 11:22:18 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     // Switch back to All Activity
 | 
					
						
							|  |  |  |     await sortDropdown.click(); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     await page.waitForSelector('.ant-dropdown', { state: 'visible' }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const allActivityOption = page.getByRole('menuitem', { | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |       name: 'All Activity', | 
					
						
							| 
									
										
										
										
											2025-06-09 11:22:18 +05:30
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     if (await allActivityOption.isVisible()) { | 
					
						
							|  |  |  |       const feedResponse = page.waitForResponse('/api/v1/feed*'); | 
					
						
							|  |  |  |       await allActivityOption.click(); | 
					
						
							|  |  |  |       await page.waitForLoadState('networkidle'); | 
					
						
							|  |  |  |       await feedResponse; | 
					
						
							| 
									
										
										
										
											2025-06-09 11:22:18 +05:30
										 |  |  |     } | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |   test('footer shows view more link when applicable', async ({ page }) => { | 
					
						
							|  |  |  |     const widget = page.getByTestId('KnowledgePanel.ActivityFeed'); | 
					
						
							| 
									
										
										
										
											2024-08-15 07:59:50 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(widget).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-09-25 23:57:59 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Check if View More link exists
 | 
					
						
							|  |  |  |     const viewMoreLink = widget.getByRole('link', { name: /View More/i }); | 
					
						
							| 
									
										
										
										
											2024-08-15 07:59:50 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     await expect(viewMoreLink).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-08-15 07:59:50 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Click and verify navigation
 | 
					
						
							|  |  |  |     await viewMoreLink.click(); | 
					
						
							|  |  |  |     await page.waitForLoadState('networkidle'); | 
					
						
							| 
									
										
										
										
											2024-08-15 07:59:50 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Should navigate away from home page
 | 
					
						
							|  |  |  |     expect(page.url()).not.toMatch(/home|welcome/i); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2024-08-29 15:12:32 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |   test('feed cards render with proper structure when available', async ({ | 
					
						
							| 
									
										
										
										
											2024-08-29 15:12:32 +05:30
										 |  |  |     page, | 
					
						
							|  |  |  |   }) => { | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     const container = page.locator('#feedWidgetData'); | 
					
						
							| 
									
										
										
										
											2024-09-15 19:43:21 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(container).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-09-15 19:43:21 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     const messageContainers = container.locator( | 
					
						
							|  |  |  |       '[data-testid="message-container"]' | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const firstCard = messageContainers.first(); | 
					
						
							| 
									
										
										
										
											2024-09-15 19:43:21 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     await expect(firstCard).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-09-15 19:43:21 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Verify typical feed card elements
 | 
					
						
							|  |  |  |     const headerText = firstCard.locator('[data-testid="headerText"]'); | 
					
						
							|  |  |  |     const timestamp = firstCard.locator('[data-testid="timestamp"]'); | 
					
						
							| 
									
										
										
										
											2024-09-25 23:57:59 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Check elements exist if available
 | 
					
						
							|  |  |  |     if ((await headerText.count()) > 0) { | 
					
						
							|  |  |  |       await expect(headerText).toBeVisible(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if ((await timestamp.count()) > 0) { | 
					
						
							|  |  |  |       await expect(timestamp).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-09-15 19:43:21 +05:30
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2025-01-20 22:45:17 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |   test('emoji reactions can be added when feed messages exist', async ({ | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     page, | 
					
						
							| 
									
										
										
										
											2025-06-29 13:18:09 +05:30
										 |  |  |   }) => { | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     const messages = page.locator('[data-testid="message-container"]'); | 
					
						
							|  |  |  |     if ((await messages.count()) === 0) { | 
					
						
							|  |  |  |       // nothing to react to; skip gracefully
 | 
					
						
							|  |  |  |       return; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-01-20 22:45:17 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     const firstMessage = messages.first(); | 
					
						
							| 
									
										
										
										
											2025-03-23 12:13:56 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(firstMessage).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2025-01-20 22:45:17 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     // Add reactions using helper (acts on the first feed index 1)
 | 
					
						
							|  |  |  |     await reactOnFeed(page, 1); | 
					
						
							| 
									
										
										
										
											2025-05-21 19:52:43 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     // Verify reactions are visible
 | 
					
						
							|  |  |  |     const reactionContainer = firstMessage.locator( | 
					
						
							|  |  |  |       '[data-testid="feed-reaction-container"]' | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2025-05-21 19:52:43 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(reactionContainer).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     for (const emoji of REACTION_EMOJIS) { | 
					
						
							|  |  |  |       await expect(reactionContainer).toContainText(emoji); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     // Toggle off the same reactions
 | 
					
						
							|  |  |  |     await reactOnFeed(page, 1); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     // Container remains visible even if counts change
 | 
					
						
							|  |  |  |     await expect(reactionContainer).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |   test('thread drawer opens from reply count and allows posting a reply', async ({ | 
					
						
							|  |  |  |     page, | 
					
						
							|  |  |  |   }) => { | 
					
						
							|  |  |  |     const messages = page.locator('[data-testid="message-container"]'); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |     // Skip if no messages available
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     if ((await messages.count()) === 0) { | 
					
						
							|  |  |  |       return; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     const firstMessage = messages.first(); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(firstMessage).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Open thread drawer via reply count or clicking the card
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     const replyCountBtn = firstMessage.locator('[data-testid="reply-count"]'); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |     if ((await replyCountBtn.count()) > 0) { | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |       await replyCountBtn.click(); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       await firstMessage.click(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Wait for drawer to appear
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     const drawer = page.locator('.ant-drawer-content'); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     await expect(drawer).toBeVisible(); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |     // Try to post a reply if comment input is available
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     const commentInput = drawer.locator('[data-testid="comments-input-field"]'); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     if (await commentInput.count()) { | 
					
						
							| 
									
										
										
										
											2025-03-15 10:04:21 +05:30
										 |  |  |       await commentInput.click(); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |       await page.waitForLoadState('networkidle'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // Fill in the editor
 | 
					
						
							|  |  |  |       const editorField = page.locator( | 
					
						
							|  |  |  |         '[data-testid="editor-wrapper"] .ql-editor' | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  |       ); | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |       await editorField.fill('Widget thread automated reply'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // Wait for send button to be enabled and send reply
 | 
					
						
							|  |  |  |       const sendButton = page.getByTestId('send-button'); | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |       await expect(sendButton).toBeEnabled(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       const sendReply = page.waitForResponse('/api/v1/feed/*/posts'); | 
					
						
							|  |  |  |       await page.waitForLoadState('networkidle'); | 
					
						
							|  |  |  |       await sendButton.click(); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |       await sendReply; | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  |       // Verify reply appears
 | 
					
						
							| 
									
										
										
										
											2024-07-22 12:45:07 +05:30
										 |  |  |       await expect( | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |         drawer.locator('[data-testid="feed-replies"]') | 
					
						
							|  |  |  |       ).toContainText('Widget thread automated reply'); | 
					
						
							| 
									
										
										
										
											2025-07-19 17:59:14 +05:30
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-08-29 15:12:32 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |     // Close drawer
 | 
					
						
							|  |  |  |     const closeBtn = drawer.locator('[data-testid="closeDrawer"]'); | 
					
						
							|  |  |  |     if (await closeBtn.count()) { | 
					
						
							|  |  |  |       await closeBtn.click(); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       await page.keyboard.press('Escape'); | 
					
						
							| 
									
										
										
										
											2024-08-29 15:12:32 +05:30
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-09-09 12:05:20 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |     // Verify drawer is closed
 | 
					
						
							|  |  |  |     await expect(drawer).not.toBeVisible(); | 
					
						
							| 
									
										
										
										
											2025-08-28 11:10:18 +05:30
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2024-06-26 17:02:30 +05:30
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2025-10-01 16:21:43 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  | test.describe('Mention notifications in Notification Box', () => { | 
					
						
							|  |  |  |   const adminUser = new UserClass(); | 
					
						
							|  |  |  |   const user1 = new UserClass(); | 
					
						
							|  |  |  |   const entity = new TableClass(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const test = base.extend<{ | 
					
						
							|  |  |  |     adminPage: Page; | 
					
						
							|  |  |  |     user1Page: Page; | 
					
						
							|  |  |  |   }>({ | 
					
						
							|  |  |  |     adminPage: async ({ browser }, use) => { | 
					
						
							|  |  |  |       const page = await browser.newPage(); | 
					
						
							|  |  |  |       await adminUser.login(page); | 
					
						
							|  |  |  |       await use(page); | 
					
						
							|  |  |  |       await page.close(); | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     user1Page: async ({ browser }, use) => { | 
					
						
							|  |  |  |       const page = await browser.newPage(); | 
					
						
							|  |  |  |       await user1.login(page); | 
					
						
							|  |  |  |       await use(page); | 
					
						
							|  |  |  |       await page.close(); | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   test.beforeAll('Setup entities and users', async ({ browser }) => { | 
					
						
							|  |  |  |     const { apiContext, afterAction } = await performAdminLogin(browser); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     try { | 
					
						
							|  |  |  |       await adminUser.create(apiContext); | 
					
						
							|  |  |  |       await adminUser.setAdminRole(apiContext); | 
					
						
							|  |  |  |       await user1.create(apiContext); | 
					
						
							|  |  |  |       await entity.create(apiContext); | 
					
						
							|  |  |  |     } finally { | 
					
						
							|  |  |  |       await afterAction(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   test('Mention notification shows correct user details in Notification box', async ({ | 
					
						
							|  |  |  |     adminPage, | 
					
						
							|  |  |  |     user1Page, | 
					
						
							|  |  |  |   }) => { | 
					
						
							|  |  |  |     await test.step( | 
					
						
							|  |  |  |       'Admin user creates a conversation on an entity', | 
					
						
							|  |  |  |       async () => { | 
					
						
							|  |  |  |         await entity.visitEntityPage(adminPage); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         await adminPage.getByTestId('activity_feed').click(); | 
					
						
							|  |  |  |         await adminPage.waitForLoadState('networkidle'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         await adminPage.waitForSelector('[data-testid="loader"]', { | 
					
						
							|  |  |  |           state: 'detached', | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         await adminPage.getByTestId('comments-input-field').click(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         await adminPage | 
					
						
							|  |  |  |           .locator( | 
					
						
							|  |  |  |             '[data-testid="editor-wrapper"] [contenteditable="true"].ql-editor' | 
					
						
							|  |  |  |           ) | 
					
						
							|  |  |  |           .fill('Initial conversation thread for mention test'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         await expect( | 
					
						
							|  |  |  |           adminPage.locator('[data-testid="send-button"]') | 
					
						
							|  |  |  |         ).toBeVisible(); | 
					
						
							|  |  |  |         await expect( | 
					
						
							|  |  |  |           adminPage.locator('[data-testid="send-button"]') | 
					
						
							|  |  |  |         ).not.toBeDisabled(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const postConversation = adminPage.waitForResponse( | 
					
						
							|  |  |  |           (response) => | 
					
						
							|  |  |  |             response.url().includes('/api/v1/feed') && | 
					
						
							|  |  |  |             response.request().method() === 'POST' && | 
					
						
							|  |  |  |             response.url().includes('/posts') | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |         await adminPage.locator('[data-testid="send-button"]').click(); | 
					
						
							|  |  |  |         await postConversation; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     await test.step('User1 mentions admin user in a reply', async () => { | 
					
						
							|  |  |  |       await entity.visitEntityPage(user1Page); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       await user1Page.getByTestId('activity_feed').click(); | 
					
						
							|  |  |  |       await user1Page.waitForLoadState('networkidle'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       await user1Page.waitForSelector('[data-testid="loader"]', { | 
					
						
							|  |  |  |         state: 'detached', | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       await user1Page.getByTestId('comments-input-field').click(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       const editorLocator = user1Page.locator( | 
					
						
							|  |  |  |         '[data-testid="editor-wrapper"] [contenteditable="true"].ql-editor' | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       await editorLocator.fill('Hey '); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       const userSuggestionsResponse = user1Page.waitForResponse( | 
					
						
							|  |  |  |         `/api/v1/search/query?q=*${adminUser.responseData.name}***` | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       await editorLocator.pressSequentially(`@${adminUser.responseData.name}`); | 
					
						
							|  |  |  |       await userSuggestionsResponse; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       await user1Page | 
					
						
							|  |  |  |         .locator(`[data-value="@${adminUser.responseData.name}"]`) | 
					
						
							|  |  |  |         .first() | 
					
						
							|  |  |  |         .click(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       await editorLocator.type(', can you check this?'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       await expect( | 
					
						
							|  |  |  |         user1Page.locator('[data-testid="send-button"]') | 
					
						
							|  |  |  |       ).toBeVisible(); | 
					
						
							|  |  |  |       await expect( | 
					
						
							|  |  |  |         user1Page.locator('[data-testid="send-button"]') | 
					
						
							|  |  |  |       ).not.toBeDisabled(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       const postMentionResponse = user1Page.waitForResponse( | 
					
						
							|  |  |  |         '/api/v1/feed/*/posts' | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  |       await user1Page.locator('[data-testid="send-button"]').click(); | 
					
						
							|  |  |  |       await postMentionResponse; | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     await test.step( | 
					
						
							|  |  |  |       'Admin user checks notification for correct user and timestamp', | 
					
						
							|  |  |  |       async () => { | 
					
						
							|  |  |  |         await adminPage.reload(); | 
					
						
							|  |  |  |         await adminPage.waitForLoadState('networkidle'); | 
					
						
							|  |  |  |         const notificationBell = adminPage.getByTestId('task-notifications'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         await expect(notificationBell).toBeVisible(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const feedResponseForNotifications = | 
					
						
							|  |  |  |           adminPage.waitForResponse(`api/v1/feed?userId=*`); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         await notificationBell.click(); | 
					
						
							|  |  |  |         await feedResponseForNotifications; | 
					
						
							|  |  |  |         const notificationBox = adminPage.locator('.notification-box'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         await expect(notificationBox).toBeVisible(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const mentionsTab = adminPage | 
					
						
							|  |  |  |           .locator('.notification-box') | 
					
						
							|  |  |  |           .getByText('Mentions'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const mentionsFeedResponse = adminPage.waitForResponse( | 
					
						
							|  |  |  |           (response) => | 
					
						
							|  |  |  |             response.url().includes('/api/v1/feed') && | 
					
						
							|  |  |  |             response.url().includes('filterType=MENTIONS') && | 
					
						
							|  |  |  |             response.url().includes('type=Conversation') | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         await mentionsTab.click(); | 
					
						
							|  |  |  |         await mentionsFeedResponse; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const mentionsList = adminPage | 
					
						
							|  |  |  |           .getByRole('tabpanel', { name: 'Mentions' }) | 
					
						
							|  |  |  |           .getByRole('list'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         await expect(mentionsList).toBeVisible(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const firstNotificationItem = mentionsList | 
					
						
							|  |  |  |           .locator('li.ant-list-item.notification-dropdown-list-btn') | 
					
						
							|  |  |  |           .first(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const firstNotificationText = await firstNotificationItem.textContent(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         expect(firstNotificationText?.toLowerCase()).toContain( | 
					
						
							|  |  |  |           user1.responseData.name.toLowerCase() | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |         expect(firstNotificationText?.toLowerCase()).not.toContain( | 
					
						
							|  |  |  |           adminUser.responseData.name.toLowerCase() | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const mentionNotificationLink = firstNotificationItem.locator( | 
					
						
							|  |  |  |           '[data-testid^="notification-link-"]' | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const navigationPromise = adminPage.waitForURL(/activity_feed/); | 
					
						
							|  |  |  |         await mentionNotificationLink.click(); | 
					
						
							|  |  |  |         await navigationPromise; | 
					
						
							|  |  |  |         await adminPage.waitForLoadState('networkidle'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         expect(adminPage.url()).toContain('activity_feed'); | 
					
						
							|  |  |  |         expect(adminPage.url()).toContain('/all'); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); |