Skip to content

fix(playwright): deflake metric definition editor and export tray open - #34914

Merged
karanh37 merged 2 commits into
mainfrom
karanh37/flaky-metric-entity-tests
Oct 8, 2026
Merged

karanh37 merged 2 commits into
mainfrom
karanh37/flaky-metric-entity-tests

Conversation

@karanh37

@karanh37 karanh37 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

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 Update
expect(getByTestId('metric-definition-edit-dialog')).toBeVisible() timed out with "element(s) not found". The edit button is a React Aria Button (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. updateRelatedMetric in the same file already handles the same issue. openMetricDefinitionEditor now uses clickUntilVisible(trigger, dialog), then waitForAriaOverlayToSettle so 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 listing
The 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, CsvJobsTray auto-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:

  • Bug fix

High-level design:

N/A — small change.

Tests:

Use cases covered

  • Metric definition fields (type, unit of measurement, granularity) can be updated and cleared from the entity page
  • Exporting metrics from the listing starts exactly one async job and it shows in the CSV jobs tray

Playwright

Ran locally against an OSS server on :8585 with --repeat-each=3 --retries=0:

  • Verify Granularity Update (Basic project): 3/3 passed
  • Admin starts exactly one async export job from the metrics listing (chromium project): 3/3 passed
  • Verify Metric Type Update, Verify Unit of Measurement Update (share the changed helper): passed

Checklist:

  • I have read the CONTRIBUTING document.
  • ESLint / Prettier / tsc clean on changed files.

🤖 Generated with Claude Code

- 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.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 09:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 852 → 852
- 0 added, 0 removed, 5 changed spec-list

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/support/entity/BundleTestSuiteClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/waitHelpers.ts
  openmetadata-ui/src/main/resources/ui/src/components/Database/Profiler/DataQualityTab/DataQualityTab.tsx
  openmetadata-ui/src/main/resources/ui/src/components/common/TabsLabel/TabsLabel.component.tsx
  openmetadata-ui/src/main/resources/ui/src/generated/entity/services/ingestionPipelines/ingestionPipeline.ts

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 getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

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

Copilot AI balanced review requested due to automatic review settings October 8, 2026 09:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@gitar-bot

gitar-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown
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: openMetricDefinitionEditor now uses clickUntilVisible with overlay settle logic to handle grid re-layout, and the export tray launcher click is bounded with clickUntilVisible to handle async job state transitions. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@karanh37
karanh37 added this pull request to the merge queue Oct 8, 2026
Merged via the queue into main with commit 31835ec Oct 8, 2026
77 of 78 checks passed
@karanh37
karanh37 deleted the karanh37/flaky-metric-entity-tests branch October 8, 2026 14:43
ShaileshParmar11 added a commit that referenced this pull request Nov 23, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants