Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Heuristic:DevExpress Testcafe CDP Performance Monitoring

From Leeroopedia
Knowledge Sources
Domains Performance, Browser_Automation
Last Updated 2026-02-12 03:30 GMT

Overview

Chrome DevTools Protocol method calls exceeding 30 seconds trigger performance drop warnings, indicating potential browser or system resource issues.

Description

TestCafe's CDP client monitors the execution time of three critical Chrome DevTools Protocol methods: `Page.enable`, `Emulation.SetDeviceMetricsOverride`, and `Emulation.SetVisibleSize`. Each has a 30-second upper bound. When any CDP method exceeds its threshold, a performance drop warning is emitted to help diagnose slow browser responsiveness. This is particularly relevant in resource-constrained CI environments or when running multiple concurrent browser instances.

Usage

Use this knowledge when debugging slow test execution or browser responsiveness issues. If you see performance drop warnings in test output, it indicates the Chrome browser is struggling to respond to DevTools Protocol commands. This can be caused by insufficient CPU/memory, too many concurrent browser instances, or a heavily loaded CI runner.

The Insight (Rule of Thumb)

  • Action: Monitor test output for `browserProviderDropOfPerformance` warnings. If seen, reduce concurrency, allocate more resources, or switch to headless mode.
  • Value: 30-second threshold for all three monitored CDP methods (PageEnable, SetDeviceMetricsOverride, SetVisibleSize).
  • Trade-off: The 30-second threshold is generous — in normal operation, these calls complete in under 1 second. Exceeding 30 seconds indicates severe resource starvation.

Reasoning

CDP method calls are typically fast (sub-second). When they take over 30 seconds, the browser is either frozen, swapping memory, or competing with other processes for CPU time. The 30-second threshold was chosen to avoid false positives from brief system load spikes while still detecting genuine performance degradation. Monitoring these specific methods covers the critical path: page initialization (PageEnable) and viewport setup (SetDeviceMetricsOverride, SetVisibleSize).

Code Evidence

CDP method thresholds from `src/browser/provider/built-in/dedicated/chrome/elapsed-upperbounds.ts:1-12`:

export enum CheckedCDPMethod {
    PageEnable = 'PageEnable',
    SetDeviceMetricsOverride = 'Emulation.SetDeviceMetricsOverride',
    SetVisibleSize = 'Emulation.SetVisibleSize'
}

// NOTE: CDP calls heuristic time upperbounds in seconds
export const ELAPSED_TIME_UPPERBOUNDS = {
    [CheckedCDPMethod.PageEnable]:               30,
    [CheckedCDPMethod.SetDeviceMetricsOverride]: 30,
    [CheckedCDPMethod.SetVisibleSize]:           30,
};

Performance check implementation from `src/browser/provider/built-in/dedicated/chrome/cdp-client/index.ts`:

private _checkDropOfPerformance (method: CheckedCDPMethod, elapsedTime: [number, number]): void {
    this.debugLogger(`CDP method '${method}' took ${prettyTime(elapsedTime)}`);

    const [ elapsedSeconds ] = elapsedTime;

    if (elapsedSeconds > ELAPSED_TIME_UPPERBOUNDS[method]) {
        this._runtimeInfo.providerMethods.reportWarning(
            WARNING_MESSAGE.browserProviderDropOfPerformance,
            this._runtimeInfo.browserName
        );
    }
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment