Skip to content

Commit 9ff2fea

Browse files
mraibleclaude
andcommitted
Fix navigation reliability by scoping selectors to navigation context
- WorkflowsPage: Use exact match for 'Fusion SOAR' button to avoid conflicts with content cards - SocketNavigationPage: Scope all navigation selectors to navigation element - Remove waitForTimeout anti-patterns and unnecessary loader checks - Use regex patterns for dynamic button text (e.g., 'Endpoint security') These fixes resolve selector ambiguity issues where multiple elements contained similar text, causing tests to click wrong buttons. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 667ac77 commit 9ff2fea

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

e2e/src/pages/SocketNavigationPage.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,21 @@ export class SocketNavigationPage extends BasePage {
4242
await this.page.waitForLoadState('networkidle');
4343

4444
// Click "Endpoint security"
45-
const endpointSecurityButton = this.page.getByRole('button', { name: /Endpoint security/i });
45+
const navigation = this.page.getByRole('navigation');
46+
const endpointSecurityButton = navigation.getByRole('button', { name: /Endpoint security/ });
4647
await endpointSecurityButton.click();
4748
await this.waiter.delay(500);
4849

4950
// Click "Monitor" to expand submenu (if not already expanded)
50-
const monitorButton = this.page.getByRole('button', { name: /^Monitor$/i });
51+
const monitorButton = navigation.getByRole('button', { name: 'Monitor', exact: true });
5152
const isExpanded = await monitorButton.getAttribute('aria-expanded');
5253
if (isExpanded !== 'true') {
5354
await monitorButton.click();
5455
await this.waiter.delay(500);
5556
}
5657

5758
// Click "Endpoint detections" link
58-
const endpointDetectionsLink = this.page.getByRole('link', { name: /Endpoint detections/i });
59+
const endpointDetectionsLink = navigation.getByRole('link', { name: /Endpoint detections/ });
5960
await endpointDetectionsLink.click();
6061

6162
// Wait for page to load

e2e/src/pages/WorkflowsPage.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ export class WorkflowsPage extends BasePage {
3636
await menuButton.click();
3737
await this.page.waitForLoadState('networkidle');
3838

39-
// Click Fusion SOAR in the navigation menu (not the home page cards)
40-
const navigation = this.page.locator('nav, [role="navigation"]');
41-
const fusionSoarButton = navigation.getByRole('button', { name: 'Fusion SOAR' });
39+
// Click Fusion SOAR button in the navigation menu (not the content buttons)
40+
// Look for the navigation and find the exact "Fusion SOAR" button (not content that mentions Fusion SOAR)
41+
const navigation = this.page.getByRole('navigation');
42+
const fusionSoarButton = navigation.getByRole('button', { name: 'Fusion SOAR', exact: true });
4243
await fusionSoarButton.click();
43-
await this.page.waitForTimeout(500);
4444

4545
// Click Workflows link
4646
const workflowsLink = this.page.getByRole('link', { name: 'Workflows' });
@@ -164,17 +164,9 @@ export class WorkflowsPage extends BasePage {
164164
// Ensure we're on the workflows list page, not an individual workflow page
165165
await this.navigateToWorkflows();
166166

167-
// Wait for any loading overlays to disappear
168-
await this.page.waitForLoadState('networkidle');
169-
const loader = this.page.locator('[data-test-selector="falcon-overlay-loader"]');
170-
if (await loader.isVisible().catch(() => false)) {
171-
await loader.waitFor({ state: 'detached', timeout: 10000 });
172-
}
173-
174167
// Click "Open menu" button for the specific workflow row
175168
const workflowRow = this.page.getByRole('row', { name: new RegExp(workflowName, 'i') });
176169
const openMenuButton = workflowRow.getByRole('button', { name: /open menu/i });
177-
await openMenuButton.waitFor({ state: 'visible', timeout: 5000 });
178170
await openMenuButton.click();
179171

180172
// Click "Execute workflow" option

0 commit comments

Comments
 (0)