Skip to content

Simplify e2e: deterministic waits and locale-agnostic selectors#32

Draft
Copilot wants to merge 1 commit intofeature/simplify-e2e-testsfrom
copilot/sub-pr-30
Draft

Simplify e2e: deterministic waits and locale-agnostic selectors#32
Copilot wants to merge 1 commit intofeature/simplify-e2e-testsfrom
copilot/sub-pr-30

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 20, 2026

E2E helpers relied on waitForTimeout fixed delays and locale-sensitive text selectors (has-text("Save"), has-text("Cancel")), causing flaky tests in non-English locales and under variable load.

Changes

  • Deterministic loading guards (navigateToFolder, navigateToRoot, clearSearch): wait for .media-library-loading to disappear before returning instead of assuming the grid is ready.

  • Locale-agnostic TinyMCE button selectors: replace text-based matching with CSS class structure:

    • Primary action: .tox-button:not(.tox-button--secondary):not(.tox-button--naked)
    • Cancel/dismiss: .tox-button--secondary with text-based fallbacks retained as safety net
    • Both paths add an Escape/Enter keyboard fallback and wait for dialog hidden state.
  • Tighter nav click target in idevices-import-regression.spec.ts: use .node-text-span instead of .nav-element-text (the container also holds dropdown buttons).

  • Replaced waitForTimeout(200) in the regression spec with a two-phase data-ready attribute poll on #node-content:

    // Wait for load to start (transition away from ready)
    await page.waitForFunction(
        () => document.querySelector('#node-content')?.getAttribute('data-ready') !== 'true',
        undefined, { timeout: 1000 }
    ).catch(() => {});
    // Then wait for load to complete
    await page.waitForFunction(
        () => document.querySelector('#node-content')?.getAttribute('data-ready') === 'true',
        undefined, { timeout: 10000 }
    ).catch(() => {});

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI mentioned this pull request Mar 20, 2026
Copilot AI changed the title [WIP] Simplify e2e Simplify e2e: deterministic waits and locale-agnostic selectors Mar 20, 2026
Copilot AI requested a review from erseco March 20, 2026 11:28
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.

2 participants