Skip to content

playwright(ui): deflake Teams private-team profile test — assert the team chip instead of blind-clicking it - #31594

Merged
harsh-vador merged 2 commits into
mainfrom
deflake-teams-private-team-profile
Aug 18, 2026
Merged

harsh-vador merged 2 commits into
mainfrom
deflake-teams-private-team-profile

Conversation

@harsh-vador

@harsh-vador harsh-vador commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Problem

Teams.spec.ts:458 › Teams Page › Create a new private team and check if its visible to admin
  in teams selection dropdown on user profile
Test timeout of 180000ms exceeded.
Error: locator.click: Target page, context or browser has been closed
Call log: - waiting for getByTestId('user-profile-teams').getByText('PW Private 79457ba9')
  at Teams.spec.ts:519

Fails on 2.0, green on main.

Is a cherry-pick missing? No.

Why only 2.0 — submodule pin lag, not code

Between those two pins AppRouter.tsx and AuthProvider.tsx changed substantially (#31301, #31316, #31335, #31369, #31103). AppRouter gained an isModeRoutesPending gate that renders <Loader fullScreen /> inside AuthenticatedApp while a non-default app mode's plugin routes are still registering. So the 2.0 AUT ran a shell that can legitimately swap the whole route subtree for a loader; the main AUT snapshot predates it. main is not immune — it is stale. Once collate main bumps its OpenMetadata pin past 2026-08-13, expect the same failure there.

The trace agrees: the failure screenshots show the profile content replaced by a centered spinner with a different left sidebar (two extra entries, AskCollate active) — i.e. the route tree remounted under a different shell after the teams PATCH, taking /users/admin with it. The same shard also flaked ClassicAskCollateNavigation.spec.ts ("does not redirect /my-data in Classic mode"), which is the same app-mode churn surfacing elsewhere.

Ruled out as the mechanism: redirectToStoredPath() in PermissionProvider. setUrlPathnameExpiryAfterRoute (utils/AuthProvider.util.ts) stamps the REDIRECT_PATHNAME cookie with a 1-second expiry, so it is long dead by this point in the test.

Why the test turns a transient re-render into a 3-minute hang

The tail of the test was:

await page
  .getByTestId('user-profile-teams')
  .getByText(privateTeam.responseData.displayName ?? privateTeam.data.displayName)
  .click();

Fix

  • Hold name and displayName separately; locate the chip by getByTestId(${teamName}-link).
  • waitForAllLoadersToDisappear(page) after the PATCH, so a stalled profile fails fast and legibly.
  • Expand plus-more-count before asserting, so the overflow cutoff can't hide the new team.
  • Make the trailing navigation assertive: wait for GET /api/v1/teams/name/, assert status 200, then assert team-heading contains the display name.

Same wait-then-assert shape already used elsewhere in this file ("Join team should work properly", "Permanently deleting a team…").

Type of change:

  • Bug fix

High-level design:

N/A — single-file test change.

Tests:

Use cases covered

  • Admin creates a private (isJoinable: false) team via API and it is offered in the teams dropdown on their own profile.
  • Saving the team selection PATCHes the user and the team appears as a chip on the profile card.
  • Clicking that chip navigates to the team's settings page and renders the team heading.

Unit tests

Not applicable — Playwright-only change, no product code touched.

Backend integration tests

Not applicable — no backend API changes.

Ingestion integration tests

Not applicable — no ingestion changes.

Playwright (UI) tests

Files updated:

  • openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Teams.spec.ts — test at L458.

Manual testing performed

Static gates run locally from openmetadata-ui/src/main/resources/ui:

  1. yarn lint:playwright → 0 errors, 270 warnings. Teams.spec.ts's 4 warnings are pre-existing browser.newPage() fixture notes; no new warning introduced.
  2. npx prettier --check playwright/e2e/Pages/Teams.spec.ts → "All matched files use Prettier code style!"
  3. npx tsc --noEmit -p playwright/tsconfig.json → no errors in Teams.spec.ts (the repo has pre-existing errors in other specs).

The E2E itself was not run locally — no OpenMetadata server available in this environment. Requesting a CI run to validate. Repro command for a reviewer with a local stack:

cd openmetadata-ui/src/main/resources/ui
PLAYWRIGHT_TEST_BASE_URL=http://localhost:8585 yarn playwright:run \
  playwright/e2e/Pages/Teams.spec.ts \
  -g "Create a new private team and check if its visible to admin" --repeat-each=5

UI screen recording / screenshots:

Not applicable — no UI code changed.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation> — N/A, no issue (nightly flake, matching playwright(ui): deflake Teams private-team profile test — drop racy user-refetch wait #29085).
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above — N/A, see above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: N/A — no schema changes.
  • For UI changes: N/A — no UI code changed.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

Follow-ups (not in this PR)

  • Bump collate main's OpenMetadata submodule pin past 0d64622448 and re-run this shard — that either reproduces the failure on main (confirming pin lag is the sole branch difference) or narrows the cause to something 2.0-only in the Collate tree.
  • PermissionProvider.tsx keys its effect on [currentUser?.teams, currentUser?.roles], comparing array identity, so every user edit re-runs the full permission bootstrap. Worth comparing by id list instead — wider blast radius, own PR.

🤖 Generated with Claude Code

Greptile Summary

The PR updates one Playwright scenario to synchronize explicitly with the private-team profile and navigation flow.

  • Stores the created team's name and display name separately for stable selectors and assertions.
  • Expands overflowed team chips before asserting the new chip is visible.
  • Waits for the team API response and verifies the destination heading after navigation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Teams.spec.ts Replaces a blind team-chip click with loader synchronization, overflow expansion, a stable test-id selector, and destination assertions.

Reviews (2): Last reviewed commit: "Merge branch 'main' into deflake-teams-p..." | Re-trigger Greptile

…team chip instead of blind-clicking it

The tail of `Teams Page › Create a new private team and check if its visible
to admin in teams selection dropdown on user profile` ended with a bare
`getByText(displayName).click()` inside `user-profile-teams`: no visibility
assertion before it, no assertion after it, and no wait for the profile to
settle after the teams PATCH. Any transient re-render of the user page
therefore consumed the full 180s test budget and surfaced as
"Target page, context or browser has been closed" instead of the real cause.

Changes:
- Locate the chip by `data-testid="${name}-link"` (rendered by `Chip`)
  instead of by visible text, and hold `name` / `displayName` separately
  since the chip's testid uses `name` while the label uses `displayName`.
- Wait for loaders to disappear after the PATCH so a stalled profile fails
  fast and legibly.
- Expand the `plus-more-count` overflow before asserting — `Chip` only
  renders the first `USER_DATA_SIZE` teams, so on a polluted environment the
  new team may not be in the DOM at all.
- Make the trailing navigation meaningful: wait for the team GET, assert its
  status, and assert `team-heading` contains the team's display name.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

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 the UI UI specific issues label Aug 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

github-actions Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 8cb4c38047b4813f5505ef5ad994223c50d0cd36 in Playwright run 32017351810, attempt 1.

✅ 65 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 37m 46s

⏱️ Max setup 1m 46s · max shard execution 6m 54s · max shard-job elapsed before upload 10m 33s · reporting 2s

🌐 169.48 requests/attempt · 1.97 app boots/UI scenario · 0.00% common-shard skew

Optimization targets still in progress:

  • Application boot ratio was 1.97 per UI scenario (134 boots / 68 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 65 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@harsh-vador harsh-vador self-assigned this Aug 17, 2026
@harsh-vador harsh-vador added safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch labels Aug 17, 2026
@harsh-vador
harsh-vador enabled auto-merge August 17, 2026 08:22
@harsh-vador
harsh-vador added this pull request to the merge queue Aug 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 17, 2026
@harsh-vador
harsh-vador added this pull request to the merge queue Aug 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-08-17T20:54:29Z)

Blocked the queue: playwright-summary

@harsh-vador
harsh-vador added this pull request to the merge queue Aug 18, 2026
Merged via the queue into main with commit c2938e3 Aug 18, 2026
76 of 80 checks passed
@harsh-vador
harsh-vador deleted the deflake-teams-private-team-profile branch August 18, 2026 06:32
@github-actions

Copy link
Copy Markdown
Contributor

Changes have been cherry-picked to the 2.0 branch.

github-actions Bot pushed a commit that referenced this pull request Aug 18, 2026
…team chip instead of blind-clicking it (#31594)

The tail of `Teams Page › Create a new private team and check if its visible
to admin in teams selection dropdown on user profile` ended with a bare
`getByText(displayName).click()` inside `user-profile-teams`: no visibility
assertion before it, no assertion after it, and no wait for the profile to
settle after the teams PATCH. Any transient re-render of the user page
therefore consumed the full 180s test budget and surfaced as
"Target page, context or browser has been closed" instead of the real cause.

Changes:
- Locate the chip by `data-testid="${name}-link"` (rendered by `Chip`)
  instead of by visible text, and hold `name` / `displayName` separately
  since the chip's testid uses `name` while the label uses `displayName`.
- Wait for loaders to disappear after the PATCH so a stalled profile fails
  fast and legibly.
- Expand the `plus-more-count` overflow before asserting — `Chip` only
  renders the first `USER_DATA_SIZE` teams, so on a polluted environment the
  new team may not be in the DOM at all.
- Make the trailing navigation meaningful: wait for the team GET, assert its
  status, and assert `team-heading` contains the team's display name.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit c2938e3)
@github-actions

Copy link
Copy Markdown
Contributor

Changes have been cherry-picked to the 1.13 branch.

github-actions Bot pushed a commit that referenced this pull request Aug 18, 2026
…team chip instead of blind-clicking it (#31594)

The tail of `Teams Page › Create a new private team and check if its visible
to admin in teams selection dropdown on user profile` ended with a bare
`getByText(displayName).click()` inside `user-profile-teams`: no visibility
assertion before it, no assertion after it, and no wait for the profile to
settle after the teams PATCH. Any transient re-render of the user page
therefore consumed the full 180s test budget and surfaced as
"Target page, context or browser has been closed" instead of the real cause.

Changes:
- Locate the chip by `data-testid="${name}-link"` (rendered by `Chip`)
  instead of by visible text, and hold `name` / `displayName` separately
  since the chip's testid uses `name` while the label uses `displayName`.
- Wait for loaders to disappear after the PATCH so a stalled profile fails
  fast and legibly.
- Expand the `plus-more-count` overflow before asserting — `Chip` only
  renders the first `USER_DATA_SIZE` teams, so on a polluted environment the
  new team may not be in the DOM at all.
- Make the trailing navigation meaningful: wait for the team GET, assert its
  status, and assert `team-heading` contains the team's display name.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit c2938e3)
@gitar-bot

gitar-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Deflakes the Teams private-team profile Playwright test by replacing blind text clicks with explicit testid chip locators, loader waits, and assertive navigation checks. No issues found.

Options

Display: compact → Showing less information.

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

This branch was previously deployed

1 inactive deployment
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 To release Will cherry-pick this PR into the release branch UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants