Skip to content

Commit 292a8ee

Browse files
authored
Use configurable extensionTimeout instead of hardcoded values (#134)
Replace hardcoded 10s/15s timeouts with config.extensionTimeout (30s CI / 20s local, overridable via EXTENSION_TIMEOUT). Also removes a waitForTimeout(1000) anti-pattern.
1 parent 704c6cc commit 292a8ee

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

e2e/src/pages/HostPanelExtensionPage.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Page, expect, FrameLocator } from '@playwright/test';
2-
import { SocketNavigationPage } from '@crowdstrike/foundry-playwright';
2+
import { SocketNavigationPage, config } from '@crowdstrike/foundry-playwright';
33

44
/**
55
* Base page object for testing UI extensions in hosts.host.panel socket
@@ -17,14 +17,14 @@ export abstract class HostPanelExtensionPage extends SocketNavigationPage {
1717

1818
// Click second column to avoid checkbox in first column
1919
const firstRowCell = this.page.locator('table tbody tr:first-child td:nth-child(2)');
20-
await firstRowCell.waitFor({ state: 'visible', timeout: 10000 });
20+
await firstRowCell.waitFor({ state: 'visible', timeout: config.extensionTimeout });
2121
await firstRowCell.click();
2222

2323
this.logger.info('Clicked on first row to open Host Information panel');
2424
await this.page.waitForLoadState('networkidle');
2525

2626
const sidePanelHeader = this.page.locator('h2:has-text("Host information")').first();
27-
await sidePanelHeader.waitFor({ state: 'visible', timeout: 10000 });
27+
await sidePanelHeader.waitFor({ state: 'visible', timeout: config.extensionTimeout });
2828

2929
this.logger.success(`Navigated to host with ${this.extensionName} extension`);
3030
},
@@ -39,24 +39,22 @@ export abstract class HostPanelExtensionPage extends SocketNavigationPage {
3939
await this.page.waitForLoadState('networkidle');
4040

4141
const hostInfoPanel = this.page.locator('h2:has-text("Host information")').first();
42-
await hostInfoPanel.waitFor({ state: 'visible', timeout: 10000 });
42+
await hostInfoPanel.waitFor({ state: 'visible', timeout: config.extensionTimeout });
4343
this.logger.info('Host Information panel is visible');
4444

4545
// Scroll to bottom to reveal extensions
4646
await this.page.keyboard.press('End');
4747
await this.page.keyboard.press('End');
4848
this.logger.info('Scrolled to bottom of page');
4949

50-
await this.page.waitForTimeout(1000);
51-
5250
const extensionHeading = this.page.locator(`h1:has-text("${this.extensionName}")`).first();
53-
await extensionHeading.waitFor({ state: 'visible', timeout: 15000 });
51+
await extensionHeading.waitFor({ state: 'visible', timeout: config.extensionTimeout });
5452
this.logger.info(`Found ${this.extensionName} heading`);
5553

5654
await extensionHeading.click();
5755
this.logger.info(`Clicked to expand ${this.extensionName} extension`);
5856

59-
await expect(this.page.locator('iframe[name="portal"]')).toBeVisible({ timeout: 15000 });
57+
await expect(this.page.locator('iframe[name="portal"]')).toBeVisible({ timeout: config.extensionTimeout });
6058
this.logger.info('Extension iframe loaded');
6159

6260
const iframe: FrameLocator = this.page.frameLocator('iframe[name="portal"]');

0 commit comments

Comments
 (0)