Skip to content

Improve Firefox test reliability for VS Code command palette interactions #1442

@coderabbitai

Description

@coderabbitai

Problem Description

Firefox browser tests intermittently fail in the executeCommandViaMenus() method when interacting with VS Code's command palette. Elements become invisible right before click actions, causing test timeouts.

Root Cause

VS Code's command palette dynamically updates during filtering, and Firefox is more sensitive to these DOM timing variations than other browsers.

Current Error Pattern

Test timeout of 30000ms exceeded.
Error: page.click: Test timeout of 30000ms exceeded.
- element is visible, enabled and stable
- element is not visible (race condition)

Recommended Solution

Add retry logic with explicit waits to the executeCommandViaMenus() method:

async executeCommandViaMenus(command: string): Promise<void> {
    await this.navigateItems(['View', 'Command Palette...'])
    await this.page.fill('.quick-input-filter input', command)
    
    // Retry click with explicit visibility checks
    const maxRetries = 3
    for (let i = 0; i < maxRetries; i++) {
        try {
            const locator = this.page.locator(`text=${command}`).first()
            await locator.waitFor({ state: 'visible', timeout: 5000 })
            await locator.waitFor({ state: 'stable', timeout: 1000 })
            await locator.hover()
            await locator.click({ timeout: 5000 })
            return
        } catch (error) {
            if (i === maxRetries - 1) throw error
            await this.page.waitForTimeout(500)
        }
    }
}

Files to Update

  • tests/browser/tests/models/codeserver.ts (line 87)
  • tests/browser/tests/codeserver.spec.ts (validation)

Acceptance Criteria

  • Firefox tests pass consistently (>95% success rate)
  • Cross-browser compatibility maintained
  • No significant performance impact

Context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

📋 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions