Skip to content

Fix flaky extension installed UI test#250

Merged
robstryker merged 1 commit into
masterfrom
issue-249-fix-flaky-ui-test
May 14, 2026
Merged

Fix flaky extension installed UI test#250
robstryker merged 1 commit into
masterfrom
issue-249-fix-flaky-ui-test

Conversation

@robstryker
Copy link
Copy Markdown
Collaborator

Fixes #249

Summary

  • Add retry logic to handle StaleElementReferenceError in extension UI test
  • Eliminates ~50% failure rate on Ubuntu CI builds

Problem

The extension installed UI test was flaky, failing approximately 50% of the time with:

StaleElementReferenceError: stale element reference: stale element not found in the current frame
  at async ExtensionsViewItem.getTitle()
  at async ExtensionsViewSection.findItem()

Root cause: Between finding the extension item and calling getTitle(), VS Code refreshes the extensions list DOM, making the element reference stale.

Solution

Added retry logic that:

  • Wraps the find + getTitle operations in a try/catch retry loop
  • Catches StaleElementReferenceError specifically
  • Retries up to 3 times with 500ms delay between attempts
  • Re-throws other errors immediately
  • Re-throws on final retry if still failing

This handles the timing issue without making the test less strict - it still validates the extension is installed and has the correct name.

Test plan

  • Run the UI tests multiple times to verify they no longer fail intermittently
  • CI should now have consistently green builds on Ubuntu

🤖 Generated with Claude Code

The extension installed UI test was failing ~50% of the time with
StaleElementReferenceError when trying to get the extension title.

Root cause: Between finding the extension item and calling getTitle(),
VS Code can refresh the extensions list DOM, making the element reference
stale.

Solution: Add retry logic that:
- Catches StaleElementReferenceError
- Retries the entire operation (find + getTitle) up to 3 times
- Waits 500ms between retries to allow DOM to stabilize
- Re-throws if it's a different error or retries are exhausted

This should eliminate the flakiness while maintaining test reliability.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@robstryker robstryker merged commit 1b7b4db into master May 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky UI test: StaleElementReferenceError in extension installed test

1 participant