Repository navigation
fix(playwright): deflake metric definition editor and export tray open - #34914
Conversation
- openMetricDefinitionEditor: the edit button sits in the details grid that re-lays out after load, so the React Aria press can be dropped and the dialog never opens. Use clickUntilVisible + waitForAriaOverlayToSettle, same as the related-metrics trigger in the same file. - Metric export tray: the job can finish between isVisible() and click(), auto-opening the tray and unmounting the launcher mid-click; the unbounded click then hung until the test timeout. Use clickUntilVisible.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
🔄 Playwright impact map auto-refreshedThis PR touched specs or UI source that changed the source→spec routing map. I regenerated What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit: python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit # or a separate commit |
Code Review ✅ Approved🟢 Low risk · The changes only adjust Playwright test interactions and generated impact metadata, so they do not alter application runtime behavior. Fixes two Playwright test flakes by adding proper wait logic to handle UI race conditions: OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Fixes the four flaky tests in the 2.0 nightly #199 Playwright runs: - LargeGlossaryPerformance drag and drop: wait for both rows to stop moving before dragTo (waitForStableBox, from main 7860a3f / #32631). - MetricBulkImportExportEdit async export: accept an auto-opened tray and retry the launcher click (clickUntilVisible, from main 31835ec / #34914). - PersonaAIContext entity-type picks: retry through the expanded trigger (selectOptionWithRetry, from main 451b972 / #34119 and 320f44b / #37423). - TableConstraint composite tooltip: scope the tooltip locator by name so a leftover tooltip cannot make the role match ambiguous.
Describe your changes:
Fixes two Playwright flakes that keep failing PR runs. Both are test-only changes.
1.
Flow/Metric.spec.ts› Metric Entity Special Test Cases › Verify Granularity Updateexpect(getByTestId('metric-definition-edit-dialog')).toBeVisible()timed out with "element(s) not found". The edit button is a React AriaButton(onPress) in the metric details grid. That grid is still re-laying out its widgets after load, so the button can move between pointerdown and pointerup and the press is dropped.updateRelatedMetricin the same file already handles the same issue.openMetricDefinitionEditornow usesclickUntilVisible(trigger, dialog), thenwaitForAriaOverlayToSettleso the select click inside the modal doesn't land mid-animation. This covers every metric-definition update and clear (type, unit of measurement, granularity).2.
Features/MetricBulkImportExportEdit.spec.ts› Admin starts exactly one async export job from the metrics listingThe test timed out at 60s on
trayLauncher.click(), with the log showing "element is not stable" and then "element was detached from the DOM". This is a check-then-act race:isVisible()returned true, then the export job reached a terminal state,CsvJobsTrayauto-opened (setOpen(true)), and the launcher, which only renders while!open, unmounted mid-click. The unbounded click waited for a button that would never return.clickUntilVisible(trayLauncher, trayPopover)checks the popover first and bounds each click to 5s, so it handles both outcomes.Type of change:
High-level design:
N/A — small change.
Tests:
Use cases covered
Playwright
Ran locally against an OSS server on :8585 with
--repeat-each=3 --retries=0:Verify Granularity Update(Basic project): 3/3 passedAdmin starts exactly one async export job from the metrics listing(chromium project): 3/3 passedVerify Metric Type Update,Verify Unit of Measurement Update(share the changed helper): passedChecklist:
🤖 Generated with Claude Code