-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSocketNavigationPage.ts
More file actions
190 lines (156 loc) · 7.16 KB
/
SocketNavigationPage.ts
File metadata and controls
190 lines (156 loc) · 7.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
import { Page, expect } from '@playwright/test';
import { BasePage } from './BasePage';
/**
* Utility page object for navigating to detection pages with socket extensions
*
* Uses menu-based navigation to ensure reliability when URLs change.
*
* Supports testing Foundry extensions that appear in detection sockets:
* - activity.detections.details (Endpoint Detections)
* - xdr.detections.panel (XDR Detections)
* - ngsiem.workbench.details (NGSIEM Incidents)
*/
export class SocketNavigationPage extends BasePage {
constructor(page: Page) {
super(page, 'Socket Navigation');
}
protected getPagePath(): string {
throw new Error('Socket navigation does not have a direct path - use menu navigation');
}
protected async verifyPageLoaded(): Promise<void> {
}
/**
* Navigate to Endpoint Detections page (activity.detections.details socket)
* Uses menu navigation: Menu → Endpoint security → Monitor → Endpoint detections
*/
async navigateToEndpointDetections(): Promise<void> {
return this.withTiming(
async () => {
this.logger.info('Navigating to Endpoint Detections page');
// Navigate to Foundry home first to ensure menu is available
await this.navigateToPath('/foundry/home', 'Foundry home');
await this.page.waitForLoadState('networkidle');
// Open the hamburger menu
const menuButton = this.page.getByTestId('nav-trigger');
await menuButton.click();
await this.page.waitForLoadState('networkidle');
// Click "Endpoint security"
const navigation = this.page.getByRole('navigation');
const endpointSecurityButton = navigation.getByRole('button', { name: /Endpoint security/ });
await endpointSecurityButton.click();
await this.waiter.delay(500);
// Click "Monitor" to expand submenu (if not already expanded)
const monitorButton = navigation.getByRole('button', { name: 'Monitor', exact: true });
const isExpanded = await monitorButton.getAttribute('aria-expanded');
if (isExpanded !== 'true') {
await monitorButton.click();
await this.waiter.delay(500);
}
// Click "Endpoint detections" link
const endpointDetectionsLink = navigation.getByRole('link', { name: /Endpoint detections/ });
await endpointDetectionsLink.click();
// Wait for page to load
await this.page.waitForLoadState('networkidle');
// Verify we're on the detections page by looking for the page heading
const pageTitle = this.page.locator('h1, h2').filter({ hasText: /Detections/i }).first();
await expect(pageTitle).toBeVisible({ timeout: 10000 });
this.logger.success('Navigated to Endpoint Detections page');
},
'Navigate to Endpoint Detections'
);
}
/**
* Navigate to XDR Detections page (xdr.detections.panel socket)
* Uses menu navigation: Menu → Next-Gen SIEM → appropriate submenu → XDR detections
* Note: Requires XDR SKU - may not be available in all environments
*/
async navigateToXDRDetections(): Promise<void> {
return this.withTiming(
async () => {
this.logger.info('Navigating to XDR Detections page (Incidents)');
// Navigate to Foundry home first to ensure menu is available
await this.navigateToPath('/foundry/home', 'Foundry home');
await this.page.waitForLoadState('networkidle');
// Open the hamburger menu
const menuButton = this.page.getByTestId('nav-trigger');
await menuButton.click();
await this.page.waitForLoadState('networkidle');
// Click "Next-Gen SIEM" in the menu (not the home page card)
const ngsiemButton = this.page.getByTestId('popout-button').filter({ hasText: /Next-Gen SIEM/i });
await ngsiemButton.click();
await this.waiter.delay(500);
// Click "Incidents" - use section-link selector to avoid the learn card
const incidentsLink = this.page.getByTestId('section-link').filter({ hasText: /Incidents/i });
await incidentsLink.click();
await this.page.waitForLoadState('networkidle');
const pageTitle = this.page.locator('h1, [role="heading"]').first();
await expect(pageTitle).toBeVisible({ timeout: 10000 });
this.logger.success('Navigated to XDR Detections page (Incidents)');
},
'Navigate to XDR Detections'
);
}
/**
* Navigate to NGSIEM Incidents page (ngsiem.workbench.details socket)
* Uses menu navigation: Menu → Next-Gen SIEM → Incidents
*/
async navigateToNGSIEMIncidents(): Promise<void> {
return this.withTiming(
async () => {
this.logger.info('Navigating to NGSIEM Incidents page');
// Navigate to Foundry home first to ensure menu is available
await this.navigateToPath('/foundry/home', 'Foundry home');
await this.page.waitForLoadState('networkidle');
// Open the hamburger menu
const menuButton = this.page.getByTestId('nav-trigger');
await menuButton.click();
await this.page.waitForLoadState('networkidle');
// Click "Next-Gen SIEM" in the menu (not the home page card)
const ngsiemButton = this.page.getByTestId('popout-button').filter({ hasText: /Next-Gen SIEM/i });
await ngsiemButton.click();
await this.waiter.delay(500);
// Click "Incidents" - use section-link selector to avoid the learn card
const incidentsLink = this.page.getByTestId('section-link').filter({ hasText: /Incidents/i });
await incidentsLink.click();
await this.page.waitForLoadState('networkidle');
const pageTitle = this.page.locator('h1, [role="heading"]').first();
await expect(pageTitle).toBeVisible({ timeout: 10000 });
this.logger.success('Navigated to NGSIEM Incidents page');
},
'Navigate to NGSIEM Incidents'
);
}
async openFirstDetection(): Promise<void> {
return this.withTiming(
async () => {
await this.page.waitForLoadState('networkidle');
// In the new Endpoint Detections UI, detections are represented as buttons in the table
// Look for process/host information buttons
const firstDetectionButton = this.page.locator('[role="gridcell"] button').first();
await firstDetectionButton.waitFor({ state: 'visible', timeout: 10000 });
await firstDetectionButton.click();
// Wait for detection details to load
await this.page.waitForLoadState('networkidle');
},
'Open first detection'
);
}
async verifyExtensionInSocket(extensionName: string): Promise<void> {
return this.withTiming(
async () => {
const extension = this.page.getByRole('tab', { name: new RegExp(extensionName, 'i') });
await expect(extension).toBeVisible({ timeout: 10000 });
},
`Verify extension "${extensionName}" in socket`
);
}
async clickExtensionTab(extensionName: string): Promise<void> {
return this.withTiming(
async () => {
const extension = this.page.getByRole('tab', { name: new RegExp(extensionName, 'i') });
await extension.click({ force: true });
},
`Click extension tab "${extensionName}"`
);
}
}