Skip to content

test: add Playwright browser-helper tests + custom ESLint rules (18 files) - #33880

Merged
chirag-madlani merged 2 commits into
mainfrom
chirag-madlani/playwright-eslint-rules-and-browser-tests
Sep 25, 2026
Merged

chirag-madlani merged 2 commits into
mainfrom
chirag-madlani/playwright-eslint-rules-and-browser-tests

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #33087

Describe your changes:

Rebuilt after bot review revealed cross-file dependency issues. Now 18 files, every one with symbols/imports that resolve against main.

What lands

  • 8 browser-helper Playwright tests under playwright/browser-tests/ — each verified against main's helpers:
    • alertDestinationPicker, gridEditors, gridPopoverEditor, landingWidgetReadiness, queryBuilderSelections, reactions, serverLoad, taskActions
  • browser-helper-tests.config.ts — dedicated Playwright config for the browser-helper lane (retain-on-failure trace + screenshot + json reporter).
  • 4 new custom ESLint rules in playwright/eslint-rules/ (all self-contained; no wire-up needed at this layer):
    • no-status-filtered-response
    • no-implicit-navigation-load
    • no-discarded-state-query
    • reset-fixture-arrays
  • RuleTester unit tests for each new rule.
  • playwright/eslint-rules/index.mjs updated to register the 4 new rules (purely additive).

Dropped from the earlier draft (with reason)

Each of the following had a cross-file dependency that doesn't exist on main yet. Will land in a follow-up once the dependent file is ported:

Spec Missing dependency
canvasEdgeSelection.spec.ts src/utils/Lineage/CanvasHitTest.utils.ts
lineageImageExport.spec.ts src/utils/Export/exportStyles.utils.ts
responseWaits.spec.ts waitForResponseWithStatus not exported from utils/waitHelpers.ts
indexedDbStorage.spec.ts scripts/patch-playwright-indexeddb.cjs
formControls.spec.ts / sidebarNavigation.spec.ts antd imports inside template-literal bundle sources trip tw-deprecation-guard
kpiCleanup.spec.ts asserts deleteKpiRequest signature not on main
workflowPolling.spec.ts asserts verifyTaskCreated behavior not on main

Not included (intentional)

eslint.config.mjs wire-up to actually run these rules against the Playwright corpus is NOT in this PR — needs a conflict-resolved merge against main's current file. Until then, rule files are dormant reference implementations plus their standalone RuleTester tests.

Type of change:

  • Test / lint infrastructure additions (no product code change)

Notes

Cherry-picked from #33088. All original content authored by @harshach.

🤖 Generated with Claude Code

RetriggerConfidence Score: 4/5

The PR is not yet safe to merge because the new browser-helper suite still has no package script or CI invocation, leaving its regression coverage dormant.

Findings

  1. P1 Browser Tests Never Run ▶
  2. P1 Missing Patch Module ▶
Summary

Adds a dedicated Playwright browser-helper configuration, eight synthetic-browser regression tests, and four custom ESLint rules with standalone RuleTester coverage.

  • Exercises shared Playwright helpers against isolated UI and HTTP fixtures.
  • Registers lint rules covering response filtering, explicit navigation readiness, discarded response state, and fixture-array mutation.
  • Removes the IndexedDB browser test that depended on a missing patch module.
  • The dedicated browser-helper lane remains disconnected from package scripts and CI, as already reported in the existing review thread.

Reviews (2) · Last reviewed commit: "Drop browser-tests with unresolved cross..."

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Sep 23, 2026
Comment on lines +56 to +65
while (
callback &&
!(
callback.parent?.type === 'CallExpression' &&
callback.parent.callee.type === 'MemberExpression' &&
callback.parent.callee.property.name === 'beforeAll'
)
) {
callback = callback.parent;
}

@gitar-bot gitar-bot Bot Sep 23, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Edge Case: reset-fixture-arrays ignores bare beforeAll(...) hooks

The hook check only matches a MemberExpression callee whose property is beforeAll, such as test.beforeAll. Files that import beforeAll directly, or use a Playwright-style fixture alias like base.beforeAll, are covered, but a bare beforeAll(() => entities.push(...)) walks up to Program and is never reported. Also accept an Identifier callee named beforeAll.

Accept both member and identifier callees.:

const isBeforeAll = (call) =>
  call?.type === 'CallExpression' &&
  ((call.callee.type === 'MemberExpression' && call.callee.property.name === 'beforeAll') ||
    (call.callee.type === 'Identifier' && call.callee.name === 'beforeAll'));
while (callback && !isBeforeAll(callback.parent)) {
  callback = callback.parent;
}

Was this helpful? React with 👍 / 👎


export default defineConfig({
captureGitInfo: { commit: false, diff: false },
testDir: './browser-tests',

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.

P1 Browser Tests Never Run

This dedicated config is the only config that points to ./browser-tests, but no package script, Make target, or CI workflow invokes it. The standard command uses the default config, whose testDir is ./playwright/e2e, so these new tests are excluded from normal and CI runs unless someone manually selects this config. As a result, the regressions this suite is meant to catch remain unguarded.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +51 to +53
const {
patchStorageSource,
} = require('../../scripts/patch-playwright-indexeddb.cjs');

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.

P1 Missing Patch Module

This code unconditionally imports ../../scripts/patch-playwright-indexeddb.cjs when the test file is collected, but that module is not present in the repository or added by this PR. Once the browser-helper lane is invoked, this spec will fail with MODULE_NOT_FOUND before any IndexedDB test can run.

@gitar-bot

gitar-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 2 closed / 3 findings

🟡 Medium risk · Adds standalone browser-test infrastructure and registers ESLint rules for UI tests.

Adds 8 Playwright browser-helper tests, a dedicated Playwright config, and 4 custom ESLint rules with RuleTester unit tests—all verified against main's available symbols. The reset-fixture-arrays rule should also accept bare beforeAll(...) hooks (currently it only catches test.beforeAll and fixture-aliased forms) to catch all hook variants.

💡 Edge Case: reset-fixture-arrays ignores bare beforeAll(...) hooks

📄 openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/reset-fixture-arrays.mjs:56-65

The hook check only matches a MemberExpression callee whose property is beforeAll, such as test.beforeAll. Files that import beforeAll directly, or use a Playwright-style fixture alias like base.beforeAll, are covered, but a bare beforeAll(() => entities.push(...)) walks up to Program and is never reported. Also accept an Identifier callee named beforeAll.

Accept both member and identifier callees.
const isBeforeAll = (call) =>
  call?.type === 'CallExpression' &&
  ((call.callee.type === 'MemberExpression' && call.callee.property.name === 'beforeAll') ||
    (call.callee.type === 'Identifier' && call.callee.name === 'beforeAll'));
while (callback && !isBeforeAll(callback.parent)) {
  callback = callback.parent;
}
✅ 2 closed
✅ Bug: Browser tests import modules and exports that don't exist on main

📄 openmetadata-ui/src/main/resources/ui/playwright/browser-tests/responseWaits.spec.ts:18 📄 openmetadata-ui/src/main/resources/ui/playwright/browser-tests/indexedDbStorage.spec.ts:51-58 📄 openmetadata-ui/src/main/resources/ui/playwright/browser-tests/canvasEdgeSelection.spec.ts:16-22 📄 openmetadata-ui/src/main/resources/ui/playwright/browser-tests/lineageImageExport.spec.ts:16-30 📄 openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/no-status-filtered-response.mjs:24
This cherry-pick leaves out code these specs depend on. playwright/utils/waitHelpers.ts has no waitForResponseWithStatus export (it only exports clickAndWaitFor). scripts/patch-playwright-indexeddb.cjs is missing. src/utils/Lineage/CanvasHitTest.utils.ts and src/utils/Export/exportStyles.utils.ts are both missing. Because the esbuild buildSync(...) calls and the require(...)s run at module scope, canvasEdgeSelection, lineageImageExport and indexedDbStorage throw while loading, before any test runs. responseWaits fails the type check and then calls undefined. The no-status-filtered-response message also tells authors to use waitForResponseWithStatus, which doesn't exist. Either add the helper, patch-script and source-util changes from #33088 to this PR, or leave these specs out until those changes land.

✅ Bug: Specs assert helper behavior that main's helpers don't have

📄 openmetadata-ui/src/main/resources/ui/playwright/browser-tests/kpiCleanup.spec.ts:43-48 📄 openmetadata-ui/src/main/resources/ui/playwright/browser-tests/kpiCleanup.spec.ts:71-74 📄 openmetadata-ui/src/main/resources/ui/playwright/browser-tests/workflowPolling.spec.ts:25-27 📄 openmetadata-ui/src/main/resources/ui/playwright/browser-tests/workflowPolling.spec.ts:68-69
These specs test helper fixes that aren't in this PR. On main, deleteKpiRequest(apiRequest) takes one argument, deletes every KPI it lists, and ignores HTTP errors. So deleteKpiRequest(api, ['owned']) fails the type check, deletes another-worker, and resolves on a 503 instead of throwing /503.*KPI storage unavailable/. On main, verifyTaskCreated also retries through expect.poll with WORKFLOW_POLL. With a server that always returns 503, it never throws /503/ after exactly one request; it keeps polling until the 4s test timeout. These tests fail every time until the helper changes from #33088 are added, so include those changes here or defer these specs.

🤖 Prompt for agents
Code Review: Adds 8 Playwright browser-helper tests, a dedicated Playwright config, and 4 custom ESLint rules with RuleTester unit tests—all verified against `main`'s available symbols. The `reset-fixture-arrays` rule should also accept bare `beforeAll(...)` hooks (currently it only catches `test.beforeAll` and fixture-aliased forms) to catch all hook variants.

1. 💡 Edge Case: reset-fixture-arrays ignores bare `beforeAll(...)` hooks
   Files: openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/reset-fixture-arrays.mjs:56-65

   The hook check only matches a MemberExpression callee whose property is `beforeAll`, such as `test.beforeAll`. Files that import `beforeAll` directly, or use a Playwright-style fixture alias like `base.beforeAll`, are covered, but a bare `beforeAll(() => entities.push(...))` walks up to Program and is never reported. Also accept an Identifier callee named `beforeAll`.

   Fix (Accept both member and identifier callees.):
   const isBeforeAll = (call) =>
     call?.type === 'CallExpression' &&
     ((call.callee.type === 'MemberExpression' && call.callee.property.name === 'beforeAll') ||
       (call.callee.type === 'Identifier' && call.callee.name === 'beforeAll'));
   while (callback && !isBeforeAll(callback.parent)) {
     callback = callback.parent;
   }

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

@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-24T14:52:10Z)

Blocked the queue: playwright-summary

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 UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge queue: recover transient artifacts and stabilize recurring E2E failures

2 participants