Skip to content

Commit 37aecd2

Browse files
committed
Use menu-based navigation instead of direct URLs
- Replace direct URL navigation with menu-based navigation for reliability - Menu structure is stable while URLs can change (e.g., /activity/detections → /activity-v2/detections) - Remove sensitive test data from comments
1 parent 10d2451 commit 37aecd2

File tree

1 file changed

+71
-12
lines changed

1 file changed

+71
-12
lines changed

e2e/src/pages/SocketNavigationPage.ts

Lines changed: 71 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { BasePage } from './BasePage';
44
/**
55
* Utility page object for navigating to detection pages with socket extensions
66
*
7+
* Uses menu-based navigation to ensure reliability when URLs change.
8+
*
79
* Supports testing Foundry extensions that appear in detection sockets:
810
* - activity.detections.details (Endpoint Detections)
911
* - xdr.detections.panel (XDR Detections)
@@ -15,26 +17,48 @@ export class SocketNavigationPage extends BasePage {
1517
}
1618

1719
protected getPagePath(): string {
18-
throw new Error('Socket navigation does not have a direct path');
20+
throw new Error('Socket navigation does not have a direct path - use menu navigation');
1921
}
2022

2123
protected async verifyPageLoaded(): Promise<void> {
2224
}
2325

24-
/** Navigate to Endpoint Detections page (activity.detections.details socket) */
26+
/**
27+
* Navigate to Endpoint Detections page (activity.detections.details socket)
28+
* Uses menu navigation: Menu → Endpoint security → Monitor → Endpoint detections
29+
*/
2530
async navigateToEndpointDetections(): Promise<void> {
2631
return this.withTiming(
2732
async () => {
2833
this.logger.info('Navigating to Endpoint Detections page');
2934

30-
// Navigate to endpoint detections
31-
await this.navigateToPath('/activity/detections', 'Endpoint Detections page');
35+
// Open the hamburger menu
36+
const menuButton = this.page.getByRole('button', { name: 'Menu' });
37+
await menuButton.click();
38+
await this.page.waitForLoadState('networkidle');
39+
40+
// Click "Endpoint security"
41+
const endpointSecurityButton = this.page.getByRole('button', { name: /Endpoint security/i });
42+
await endpointSecurityButton.click();
43+
await this.waiter.delay(500);
44+
45+
// Click "Monitor" to expand submenu (if not already expanded)
46+
const monitorButton = this.page.getByRole('button', { name: /^Monitor$/i });
47+
const isExpanded = await monitorButton.getAttribute('aria-expanded');
48+
if (isExpanded !== 'true') {
49+
await monitorButton.click();
50+
await this.waiter.delay(500);
51+
}
52+
53+
// Click "Endpoint detections" link
54+
const endpointDetectionsLink = this.page.getByRole('link', { name: /Endpoint detections/i });
55+
await endpointDetectionsLink.click();
3256

3357
// Wait for page to load
3458
await this.page.waitForLoadState('networkidle');
3559

36-
// Verify we're on the detections page
37-
const pageTitle = this.page.locator('h1, [role="heading"]').first();
60+
// Verify we're on the detections page by looking for the page heading
61+
const pageTitle = this.page.locator('h1, h2').filter({ hasText: /Detections/i }).first();
3862
await expect(pageTitle).toBeVisible({ timeout: 10000 });
3963

4064
this.logger.success('Navigated to Endpoint Detections page');
@@ -43,13 +67,31 @@ export class SocketNavigationPage extends BasePage {
4367
);
4468
}
4569

46-
/** Navigate to XDR Detections page (xdr.detections.panel socket) */
70+
/**
71+
* Navigate to XDR Detections page (xdr.detections.panel socket)
72+
* Uses menu navigation: Menu → Next-Gen SIEM → appropriate submenu → XDR detections
73+
* Note: Requires XDR SKU - may not be available in all environments
74+
*/
4775
async navigateToXDRDetections(): Promise<void> {
4876
return this.withTiming(
4977
async () => {
5078
this.logger.info('Navigating to XDR Detections page');
5179

52-
await this.navigateToPath('/ngsiem/detections', 'XDR Detections page');
80+
// Open the hamburger menu
81+
const menuButton = this.page.getByRole('button', { name: 'Menu' });
82+
await menuButton.click();
83+
await this.page.waitForLoadState('networkidle');
84+
85+
// Click "Next-Gen SIEM"
86+
const ngsiemButton = this.page.getByRole('button', { name: /Next-Gen SIEM/i });
87+
await ngsiemButton.click();
88+
await this.waiter.delay(500);
89+
90+
// Look for XDR-related navigation items
91+
// Note: This may vary based on environment configuration
92+
const xdrLink = this.page.getByRole('link', { name: /XDR.*[Dd]etections?/i });
93+
await xdrLink.click();
94+
5395
await this.page.waitForLoadState('networkidle');
5496

5597
const pageTitle = this.page.locator('h1, [role="heading"]').first();
@@ -61,13 +103,30 @@ export class SocketNavigationPage extends BasePage {
61103
);
62104
}
63105

64-
/** Navigate to NGSIEM Incidents page (ngsiem.workbench.details socket) */
106+
/**
107+
* Navigate to NGSIEM Incidents page (ngsiem.workbench.details socket)
108+
* Uses menu navigation: Menu → Next-Gen SIEM → appropriate submenu → Incidents
109+
* Note: Requires NGSIEM SKU - may not be available in all environments
110+
*/
65111
async navigateToNGSIEMIncidents(): Promise<void> {
66112
return this.withTiming(
67113
async () => {
68114
this.logger.info('Navigating to NGSIEM Incidents page');
69115

70-
await this.navigateToPath('/ngsiem/workbench/incidents', 'NGSIEM Incidents page');
116+
// Open the hamburger menu
117+
const menuButton = this.page.getByRole('button', { name: 'Menu' });
118+
await menuButton.click();
119+
await this.page.waitForLoadState('networkidle');
120+
121+
// Click "Next-Gen SIEM"
122+
const ngsiemButton = this.page.getByRole('button', { name: /Next-Gen SIEM/i });
123+
await ngsiemButton.click();
124+
await this.waiter.delay(500);
125+
126+
// Look for Incidents navigation
127+
const incidentsLink = this.page.getByRole('link', { name: /Incidents/i });
128+
await incidentsLink.click();
129+
71130
await this.page.waitForLoadState('networkidle');
72131

73132
const pageTitle = this.page.locator('h1, [role="heading"]').first();
@@ -84,8 +143,8 @@ export class SocketNavigationPage extends BasePage {
84143
async () => {
85144
await this.page.waitForLoadState('networkidle');
86145

87-
// Click on the first detection - look for buttons with process/host information
88-
// Based on the structure seen: gridcell with buttons like "REVIL.EXE on SE-MRA-WIN10-BL by demo"
146+
// In the new Endpoint Detections UI, detections are represented as buttons in the table
147+
// Look for process/host information buttons
89148
const firstDetectionButton = this.page.locator('[role="gridcell"] button').first();
90149
await firstDetectionButton.waitFor({ state: 'visible', timeout: 10000 });
91150
await firstDetectionButton.click();

0 commit comments

Comments
 (0)