Skip to content

Fixes #37220, #37221: Migrate entity, custom-property and advanced-search specs to browser tests; run only affected browser tests - #36198

Merged
chirag-madlani merged 105 commits into
mainfrom
poc/browser-tests-entity-matrix
Nov 23, 2026
Merged

chirag-madlani merged 105 commits into
mainfrom
poc/browser-tests-entity-matrix

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Draft, stacked on #35623 (the Vitest browser-mode POC). Base is poc/ui-integration-tests, so this diff shows only the migration work.

This follows the testing-strategy plan. Playwright keeps genuine end-to-end flows. UI checks become browser tests: the real page and its real children, with only the network mocked. API behaviour becomes Java integration tests (#36327).

What moved

Playwright spec Browser tests
EntityDataSteward.spec.ts entity-matrix/EntityDataSteward.*.browser.test.tsx (per entity type)
EntityDataConsumer.spec.ts entity-matrix/EntityDataConsumer.*
Entity.spec.ts entity-matrix/EntityAdmin.*, EntityColumnPanel.*, EntityTableTabs
ServiceEntity.spec.ts entity-matrix/ServiceEntity.*
CustomProperties.spec.ts custom-properties/*
AdvancedSearch.spec.ts advanced-search/*
  • 852 Playwright tests are tagged @migrated-browser, across 9 files.
  • 191 tests in 33 API-only specs are tagged @migrated-java-it, each naming the IT method that covers it. All the references resolve, some to the ITs added in Fixes #36326: Java ITs for API behaviour only Playwright tested #36327.
  • Test bodies are unchanged. A marked test keeps running until its replacement is validated, then it is deleted (playwright/constant/migration.ts: migratedTo.browser / .javaIT / .split).
  • Left unmarked on purpose: tests that depend on the real search index or on cross-page state, such as followed-assets on the home page or Explore filtering after a PATCH. These stay genuine flows.

Harness (src/test/browser/fixtures/):

  • Personas (Admin, Data Steward, Data Consumer) are built from the seeded policies. They mirror CompiledRule.matchOperation, including ViewAll/EditAll expansion, notAllow vs deny, and isOwner()/noOwner() returning conditionalAllow on resource-level lookups.
  • Entity server: GET by name and id. PATCH applies the JSON patch. Also serves votes, followers, async delete and restore.
  • Search: by index alias. Typed factories cover 15 entity types, plus tags, tiers, glossary and custom properties.

Product bugs the migration found (each has a regression test):

  • SearchBar: a debounced search fired after unmount and leaked into whatever rendered next. It is now cancelled on unmount only.
  • OMFieldSelect: after a null commit, the Field box went blank even though a field was still held.
  • Core TreeSelect (staged mode): the draft reset whenever value changed identity. An entity refetch rebuilds the tags array, so a glossary term or tag picked just before the refetch was lost on Apply. It now resyncs on the selected nodes' content (id, label, data), so an equal rebuilt value keeps the draft and a renamed selection still updates.

CI (ui-browser-tests.yml)

  • Pull requests run only the affected test files (scripts/select-browser-tests.mjs). Full runs record which source files each test file executes (coverage counters, src/test/browser/impact.ts). A PR selects:

    • the test files that executed its changed code;
    • tests reaching changed test helpers or direct imports of executed files (constants, styles, assets);
    • tests whose code names a changed en-us.json key;
    • the test whose screenshot baseline changed; a deleted source file still selects the tests that loaded it.

    It runs everything for changes to test setup, the Vite/Vitest config, dependencies, global styles (src/styles/), or when no map exists yet. Manual runs always run everything. Replayed over 60 recent main commits it averaged about 48% of a full run before core components stopped forcing full runs.

  • Core components are treated like a library on pull requests: a core-only change runs core's own tests and build (the core components job), not the browser tests.

  • The policy is recorded in ADR:2026-11-23-browser-tests-run-by-impact-on-pull-requests-and-in-full-in-the-merge-queue (Proposed).

  • The merge queue runs every test file whenever the queued change touches the UI or core components (merge_group has no paths filter, so the select job diffs the queue entry). A selection miss, or a core change that breaks the app, therefore cannot reach main. If selection itself fails, the report check fails rather than being skipped. Its passing run publishes the impact map as an artifact that PRs download; queue caches are not readable from PRs.

  • PR comment:

    • what ran and why;
    • the result, with failed test names;
    • changed-code coverage: of the PR's changed lines, how many the tests that ran executed, per file;
    • the changed files no browser test loads;
    • when nothing ran, why.

    This replaces an overall coverage percentage, which only reflects whichever tests were selected.

  • Up to 5 shards (fewer when few files are selected), with blob reports merged by a report job.

  • No test retries; the one exception is pickOption's confirm-then-repick for a dropped combobox click, documented in the code and the rule. The shuffled stability matrix was removed once it showed no flakes (3,210/3,210). A nightly shuffled run replaces it as follow-up openmetadata-collate#8349.

  • The setup action caches Chromium per Playwright version (no apt deps), installs the ANTLR CLI from a cached jar with a pinned checksum, and retries yarn install.

  • Timeouts: 30 s per test and a 10 s expect.poll default. Long cold-load waits use scaled() / suiteTimeout(), which double under coverage instrumentation.

Results

  • About 1,070 browser tests; each full run takes 8–13 min per shard on 5 shards, with no Playwright stack.
  • The impact map from the last full run covers all 130 test files.

Review tip: Prettier re-indented each marked Playwright test. Hide whitespace to see the real change.

Type of change:

  • Improvement

Tests:

Browser tests, and unit tests for the three product fixes. The Playwright tests keep running unchanged until the migration is validated.

Checklist:

🤖 Generated with Claude Code


Summary by Gitar

  • Java backend:
    • Added BulkCreateConflictPolicy and BulkCreateResult handling to EntityRepository
    • Wired WorkflowEventConsumer and MutationOp into EntityRepository for change requests
  • Search bar:
    • Cancels a pending debounced search when Searchbar unmounts, so closed pickers don't fire stale requests
    • Shows the held field again in OMFieldSelect when a Field box is left unpicked
  • TreeSelect:
    • Keeps a staged pick when a parent re-renders with an equal value array, keyed by selected ids
  • CI:
    • Caches Playwright Chromium and skips its apt dependencies in the browser-test setup action
    • Installs the ANTLR CLI from a cached pinned jar in the browser-test setup action
    • Selects only the browser tests a change affects, using an impact map from select-browser-tests.mjs
  • Test timeout:
    • Sets a 45 s timeout for the instrumented test:ui:coverage run
    • Adds EntityAdmin, EntityColumnPanel, ServiceEntity, AdvancedSearch and CustomProperties browser suites beyond the Data Steward matrix
  • Announcements:
    • Retries announcement card actions that a late refetch closes

This will update automatically on new commits.

RetriggerView in GreptileConfidence Score: 5/5

The latest changes appear safe to merge.

Summary

Moves entity, custom-property, and advanced-search checks into browser tests while keeping the marked Playwright tests running. Pull requests select affected browser tests; the merge queue runs the full suite.

  • Entity-page, custom-property, and advanced-search checks run in a shared browser harness, with selected Playwright cases marked as migrated.
  • Pull requests run browser tests selected from a map of code each test reaches.
  • SearchBar cancels pending searches when its component unmounts.
  • Staged TreeSelect picks survive parent updates that keep the same selected items.
  • OMFieldSelect keeps showing its held field after a null commit.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Workflow starts] --> B{Event}
  B -->|Pull request| C[Select affected browser tests]
  B -->|Merge queue| D{UI or core changed?}
  B -->|Manual| E[Run every browser test]
  D -->|Yes| E
  D -->|No| F[Skip browser tests]
  C -->|Tests selected| G[Run selected tests]
  C -->|None selected| H[Publish no-test explanation]
  C -->|Selection fails| I[Fail reporting check]
  E --> J[Merge reports]
  G --> J
  J --> K[Report results]
Loading

Reviews (12) · Last reviewed commit: "ci(ui): run the full browser suite in th..." · Reviewed by Greptile

…lure

vitest-browser-react unmounts in the next test's beforeEach, so the global
afterEach reset handlers and the URL under a still-mounted page, which then
refetched and got wrong-shaped responses (unhandled paging/permission errors).
Also write lcov when a test fails so one flake can't drop Sonar coverage.
…nd stability runs

Runs the browser suite with istanbul coverage and posts a Jest-style coverage
and JUnit comment, plus five shuffled no-retry runs whose failures are
summarized in a second comment. Drops the duplicate patch file.
…s on failure

main now calls /metadata/types/workflows/approvalEnforcedEntityTypes and
/changeRequests from entity pages, which the strict unmocked-API check caught.
The workflow now records wall time and uploads screenshots even when tests fail.
# Conflicts:
#	openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Pagination.spec.ts
#	openmetadata-ui/src/main/resources/ui/yarn.lock
…rker

Adds a Data Steward persona built from the seeded policies (server-accurate
ViewAll/EditAll expansion and notAllow), an entity server that applies the
page's JSON patches, a search fixture keyed by index alias, and the first
migrated flow: owners add/replace/clear on the table page. Drops the
AntDConfigProvider main removed. migratedTo.browser/javaIT tags Playwright
tests whose coverage moved, with the replacement in an annotation.
…ity type

Vitest runs a file in one worker, so the 195 cases ran serially (6m18s
locally). The flows now live in entityDataSteward.contract.tsx and each
entity type has a thin file, so workers run types in parallel (4m25s on
3 workers). The Playwright marker points at the new files.
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ SSO Login Nightly — PASSED

View workflow run · Commit 851f523

Provider Status Pass Fail Flaky Skip Duration
basic ✅ pass 28 0 0 0 6m 51s
ldap ✅ pass 7 0 0 0 1m 02s
keycloak-oidc-confidential ✅ pass 12 0 0 0 1m 47s
keycloak-oidc-public ✅ pass 11 0 0 0 1m 32s
msal-mock ✅ pass 7 0 0 0 0m 48s
auth0-mock ✅ pass 6 0 0 0 0m 57s
okta ✅ pass 24 0 0 0 6m 07s
keycloak-azure-saml ✅ pass 23 0 0 0 6m 32s
keycloak-azure-saml-crosssite ⏩ skipped - - - - -

Totals: 118 passed · 0 failed · 0 flaky · 0 skipped · duration 25m 39s

chirag-madlani and others added 7 commits November 20, 2026 15:41
…contract

settle() slept 300 ms. The contract now waits until MSW has nothing in
flight and no new request for a short quiet window, which is what a
request count needs to be final; render waits poll for the row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Data Models and Stored Procedures: their browser tests are pinned failing
  by a product bug (#38295), so their Playwright tests stay untagged;
  double fetch filed as #38296. Migration doc counts and rows updated.
- Decision record is Proposed until the team signs off.
- No Sonar claims (it does not read browser coverage yet); no unused JUnit.
- The workflow also runs on setup-action changes; the setup action caches
  Chromium and the ANTLR CLI.
- setup.ts resets the app-wide zustand stores between tests.
- networkIdle counts /api requests only and notes its quiet-window limit.
- Screenshot comparison runs on Linux only (its baseline's platform).
- Contract: two-page assumption checked, empty-record guard, isListPage
  shared, search mock scope documented; msw resolutions dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rowser-migration

# Conflicts:
#	.github/workflows/ui-browser-tests.yml
#	openmetadata-ui/src/main/resources/ui/src/test/browser/setup.ts
Base automatically changed from poc/ui-integration-tests to main November 23, 2026 11:02
# Conflicts:
#	.claude/rules/frontend-browser-tests.md
#	.github/playwright/impact-map.generated.json
#	.github/workflows/ui-browser-tests.yml
#	.gitignore
#	openmetadata-ui/src/main/resources/ui/package.json
#	openmetadata-ui/src/main/resources/ui/src/components/LineageTable/ImpactAnalysisPagination.browser.test.tsx
#	openmetadata-ui/src/main/resources/ui/src/pages/MetricsPage/MetricListPage/MetricListPage.browser.test.tsx
#	openmetadata-ui/src/main/resources/ui/src/pages/ServiceDetailsPage/DriveServiceFiles.browser.test.tsx
#	openmetadata-ui/src/main/resources/ui/src/test/browser/README.md
#	openmetadata-ui/src/main/resources/ui/src/test/browser/fixtures/table.ts
#	openmetadata-ui/src/main/resources/ui/src/test/browser/paginationContract.ts
#	openmetadata-ui/src/main/resources/ui/src/test/browser/renderWithApp.tsx
#	openmetadata-ui/src/main/resources/ui/src/test/browser/setup.ts
#	openmetadata-ui/src/main/resources/ui/vitest.browser.config.ts
Copilot AI balanced review requested due to automatic review settings November 23, 2026 11:25

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 insufficient remaining quota. Try requesting a review at a lower effort level.

- SearchBar: one debounced search per typingInterval reading the latest
  onSearch, so a rerender then unmount leaves no old timer running.
- TreeSelect: resync on the selected nodes' content (id, label, data), so a
  renamed selection updates while an equal rebuilt value keeps the draft.
- Selection: a changed screenshot baseline runs its test, global styles run
  everything, and a deleted source file still selects its tests.
- Workflow: manual runs always run in full; a run that selects nothing
  still updates the PR comment with why.
- Tests: no as-unknown-as casts (typed EntityLike children, generic column
  fixtures); setup.ts store reset and the Bots fixture now type-check.
- pickOption keeps its confirm-then-repick, documented as the one sanctioned
  re-attempt, and the rule now says when that is allowed.
- Decision record for the selection policy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 12:28

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 insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 23, 2026 12:41

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 insufficient remaining quota. Try requesting a review at a lower effort level.

Comment thread .github/workflows/ui-browser-tests.yml Resolved
Comment thread .github/workflows/ui-browser-tests.yml Resolved
…l when selection fails

A core-only pull request still runs core's own tests, but the merge queue
now runs every browser test for it, so a core change that breaks the app
cannot reach main. If test selection fails, the report check fails instead
of being skipped (a skipped required check passes).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 12:47

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 insufficient remaining quota. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 3 closed / 3 findings

Selective browser-test CI and UI fixes change test coverage and bounded interactions; a selection miss could leave affected PR checks unrun before merge-queue validation.

Migrates entity, custom-property and advanced-search checks from Playwright into browser tests and runs only affected browser tests on pull requests. Resolved stuck poll handler leak, screenshot baseline selection gap, and missing ADR documentation. No issues found.

✅ 3 closed
✅ Edge Case: A stuck in-flight poll skips handler reset and leaks into later tests

📄 openmetadata-ui/src/main/resources/ui/src/test/browser/setup.ts:46-60
In afterEach, await expect.poll(() => inFlight.size, { timeout: 5000 }).toBe(0) throws if a request never settles. Everything after it is then skipped: worker.resetHandlers(), the history.replaceState back to the runner URL, localStorage.clear(), and the unhandled-call check. The next test starts with the previous test's MSW handlers, URL and storage still in place. One hung request can therefore fail several unrelated tests, and the unhandled-call report for the original test is lost. Wrap the wait in try/finally so the reset always runs, and fail on the leftover in-flight requests after the reset.

✅ Bug: Changed screenshot baselines select no test, so visual checks never run

📄 openmetadata-ui/src/main/resources/ui/scripts/select-browser-tests.mjs:159-173 📄 openmetadata-ui/src/main/resources/ui/scripts/select-browser-tests.mjs:55-56
Visual baselines live next to the test file, e.g. src/components/Database/SchemaTable/__screenshots__/SchemaTable.browser.test.tsx/schema-table-page-1-chromium-linux.png. When a PR changes one, the path starts with src/. No footprint contains it, isTestSide is false (it is not under src/test/ and does not end in .browser.test.tsx), and it is not a stylesheet. So it lands in uncovered and the result is mode: 'none'. The test that compares against the new baseline never runs, and a broken or mismatched baseline merges green. Fix: map any __screenshots__/<test file>/… path back to <dir>/<test file> and select that test, or run everything.

✅ Quality: Impact-based browser-test selection policy is not recorded in docs/decisions

📄 openmetadata-ui/src/main/resources/ui/scripts/select-browser-tests.mjs:14-26 📄 openmetadata-ui/src/main/resources/ui/scripts/select-browser-tests.mjs:36-48 📄 .github/workflows/ui-browser-tests.yml:3-8 📄 .github/workflows/ui-browser-tests.yml:36-39 📄 .github/workflows/ui-browser-tests.yml:228-242
This commit changes CI policy. A pull request now runs only the browser test files whose recorded footprint covers its change. That footprint comes from main's coverage-derived impact map, and only a fully passing main run may become the map. Changes to setup, config, dependencies or core components run everything. It also sets judgment-call limits (FILES_PER_SHARD: 26, SHARDS: 5 as a cap). This rule is stated only in the workflow header, the script docblock and the README. No record in docs/decisions/ states it, and the existing 2026-10-28 browser-mode record does not cover selection. The record would say: "A pull request runs only the browser test files whose main-branch impact map, plus their test helpers and the direct imports of executed files, reaches a changed file; a missing map or a change to browser-test setup, Vite/Vitest config, dependencies, the selection script or shipped core components runs the whole suite; only a fully passing main run may replace the map."

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

@chirag-madlani
chirag-madlani merged commit ad6731a into main Nov 23, 2026
68 of 71 checks passed
@chirag-madlani
chirag-madlani deleted the poc/browser-tests-entity-matrix branch November 23, 2026 13:05
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.

Run only the browser tests a pull request affects Migrate entity, service, custom-property and advanced-search Playwright specs to browser tests

3 participants