Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
f2a6684
Add eslint-plugin-playwright enforcement with CI check
harshach Mar 13, 2026
d684f8f
Fix CodeQL cache poisoning alert: use pull_request instead of pull_re…
harshach Mar 14, 2026
636d5ea
Fix all 1657 Playwright ESLint warnings across 190 files
harshach Mar 14, 2026
5440414
Remove unnecessary ANTLR install and add --frozen-lockfile to CI
harshach Mar 14, 2026
35b4bc7
Restore ANTLR CLI install — required by yarn postinstall script
harshach Mar 14, 2026
171e306
Fix trivially-true assertion in special character search test
harshach Mar 14, 2026
8b88ad3
Fix strict mode violations: add .first() to multi-element waitFor calls
harshach Mar 14, 2026
22e833c
Fix strict mode violation in incidentManager assignee/owner-link
harshach Mar 14, 2026
f49326b
Fix test failures from lint conversions: proper waits and retry logic
harshach Mar 14, 2026
cf94f3c
Restore force:true where genuinely needed with eslint-disable comments
harshach Mar 15, 2026
a3c6eaf
Stabilize 4 flaky tests with retry wrappers and proper waits
harshach Mar 15, 2026
12f7a7c
Merge branch 'main' into playwright-eslint-enforcement-v2
karanh37 Mar 16, 2026
1fb4bfb
Replace .first().waitFor loader pattern with waitForAllLoadersToDisap…
harshach Mar 16, 2026
d41cc74
Merge branch 'main' into playwright-eslint-enforcement-v2
karanh37 Mar 16, 2026
280f217
Add eslint-plugin-playwright enforcement with secure CI workflow (#26…
Copilot Mar 16, 2026
2512386
Revert "Add eslint-plugin-playwright enforcement with secure CI workf…
karanh37 Mar 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .claude/skills/playwright-validation/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,11 @@ This skill guides you through validating UI changes and ensuring comprehensive P
- UI feedback (loading states, success/error messages)
- Permissions (disabled buttons, restricted actions)

4. **Run lint check:**
4. **Run Playwright lint check:**
```bash
yarn eslint playwright/e2e/Pages/YourTest.spec.ts
yarn lint:playwright
```
Error-level rules (`no-networkidle`, `no-page-pause`, `no-focused-test`) will block CI. See the handbook's **ESLint Enforcement** section for the full rule reference.

## Common Test Utilities

Expand All @@ -131,8 +132,9 @@ import { selectDataProduct, selectDomain } from '../../utils/domain';
### Waiting
```typescript
import { waitForAllLoadersToDisappear } from '../../utils/entity';
await page.waitForLoadState('networkidle');
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
await waitForAllLoadersToDisappear(page);
await expect(page.getByTestId('content')).toBeVisible();
// NEVER use: page.waitForLoadState('networkidle') — blocked by ESLint
```

### API Responses
Expand All @@ -156,9 +158,10 @@ await expect(page.locator('.class')).not.toBeVisible();
- [ ] Tests cover both positive and negative scenarios
- [ ] Tests verify visual indicators (icons, badges, states)
- [ ] Tests validate API interactions
- [ ] Lint check passes with no errors
- [ ] `yarn lint:playwright` passes with zero errors
- [ ] No `networkidle`, `page.pause()`, or `test.only()` usage (blocked by ESLint)
- [ ] Test fixtures are properly created and cleaned up
- [ ] Test timeouts are appropriate (300000ms for complex tests)
- [ ] Test timeouts use `test.slow()` (preferred) or `test.setTimeout()`

## Example: Data Contract Inheritance Tests

Expand Down
17 changes: 15 additions & 2 deletions .claude/skills/playwright/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,26 @@ Reference the **Common Test Patterns** section for:

---

### Step 4: Validate Against Handbook Checklist
### Step 4: Run ESLint Check

Before returning the generated test, run the Playwright linter to catch anti-patterns automatically:

```bash
cd openmetadata-ui/src/main/resources/ui
yarn lint:playwright
```

Error-level rules (`no-networkidle`, `no-page-pause`, `no-focused-test`) will block CI. Fix any errors before finalizing. See the handbook's **ESLint Enforcement** section for the full rule reference.

### Step 5: Validate Against Handbook Checklist

Before returning the generated test, verify ALL items from the handbook's **Validation Checklist**:

- ✅ Structure & Organization (test.step, domain tags, imports, beforeAll/afterAll)
- ✅ Anti-Flakiness (no waitForTimeout, no networkidle, no force: true, no positional selectors, no stored :visible locators)
- ✅ API & Network (waitForResponse before actions, status code validation)
- ✅ Waits & Assertions (waitForAllLoadersToDisappear, semantic locators, proper assertions)
- ✅ ESLint (`yarn lint:playwright` passes with zero errors)
- ✅ Coverage & Roles (multi-role tests, data persistence, error handling)

---
Expand All @@ -108,7 +120,8 @@ Read and apply the handbook sections in order:
1. **Anti-Flakiness Patterns** (CRITICAL - #1 cause of flaky tests)
2. **Test File Structure Template** (for proper test structure)
3. **Common Test Patterns** (for specific scenarios)
4. **Validation Checklist** (before returning generated test)
4. **ESLint Enforcement** (run `yarn lint:playwright` — errors block CI)
5. **Validation Checklist** (before returning generated test)

---

Expand Down
12 changes: 12 additions & 0 deletions .claude/skills/writing-playwright-tests/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@ description: Use when writing new Playwright E2E tests or adding test cases. Pro
This skill guides you through writing Playwright E2E tests following OpenMetadata standards.

**Reference**: @openmetadata-ui/src/main/resources/ui/playwright/PLAYWRIGHT_DEVELOPER_HANDBOOK.md

## ESLint Enforcement

All Playwright tests are linted with `eslint-plugin-playwright`. Run before submitting:

```bash
cd openmetadata-ui/src/main/resources/ui
yarn lint:playwright
```

**Error-level rules block CI**: `no-networkidle`, `no-page-pause`, `no-focused-test`.
**Warning-level rules** highlight anti-patterns to fix: `missing-playwright-await`, `no-wait-for-timeout`, `no-force-option`, `no-element-handle`, `prefer-web-first-assertions`, and more. See the handbook's **ESLint Enforcement** section for details.
48 changes: 41 additions & 7 deletions .github/workflows/ui-checkstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,53 @@
name: UI Checkstyle

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- openmetadata-ui/src/main/resources/ui/playwright/**
- openmetadata-ui/src/main/resources/ui/eslint.config.mjs

permissions:
contents: read

concurrency:
group: ui-checkstyle-${{ github.head_ref }}
group: ui-checkstyle-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
UI_WORKING_DIRECTORY: openmetadata-ui/src/main/resources/ui

jobs:
ui-checkstyle:
playwright-lint:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Render msg
run: echo "No checkstyle to run"
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'openmetadata-ui/src/main/resources/ui/.nvmrc'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Caching NPM dependencies
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-yarn-

- name: Install Antlr4 CLI
run: sudo make install_antlr_cli

- name: Install Yarn Packages
working-directory: ${{ env.UI_WORKING_DIRECTORY }}
Comment thread
gitar-bot[bot] marked this conversation as resolved.
Resolved
run: yarn install --frozen-lockfile

- name: Playwright ESLint Check
Comment thread Fixed
Comment thread Fixed
working-directory: ${{ env.UI_WORKING_DIRECTORY }}
run: yarn lint:playwright
Comment thread Fixed
32 changes: 23 additions & 9 deletions openmetadata-ui/src/main/resources/ui/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import i18next from 'eslint-plugin-i18next';
import jest from 'eslint-plugin-jest';
import jestFormatting from 'eslint-plugin-jest-formatting';
import jsoncPlugin from 'eslint-plugin-jsonc';
import playwright from 'eslint-plugin-playwright';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import globals from 'globals';
Expand Down Expand Up @@ -237,20 +238,33 @@ export default [
// Playwright tests
{
files: ['**/playwright/**/*.{js,jsx,ts,tsx}'],
plugins: {
playwright,
},
rules: {
'jest/expect-expect': 'off',
'jest/valid-expect-in-promise': 'off',
'jest/valid-expect': 'off',
'jest/valid-describe': 'off',
'jest/consistent-test-it': 'off',
'jest/no-done-callback': 'off',
'jest/no-standalone-expect': 'off',
'jest/no-conditional-expect': 'off',
// TypeScript/base rule overrides for Playwright files
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-duplicate-enum-values': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-expressions': 'warn',
'react-hooks/rules-of-hooks': 'off',
'prefer-const': 'off',

// Playwright rules — blocking (error): zero existing violations, prevent regressions
'playwright/no-networkidle': 'error',
'playwright/no-page-pause': 'error',
'playwright/no-focused-test': 'error',

// Playwright rules — aspirational (warn): existing violations to fix over time
'playwright/missing-playwright-await': 'warn',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: valid-expect at warn level won't catch missing-await bugs

The playwright/valid-expect rule is configured at 'warn' level, but violations of this rule (e.g., non-awaited expect()) represent actual bugs where assertions silently pass without checking anything. The DataInsight.spec.ts fix in this very PR (line 280: adding await to expect(...).toBeVisible()) demonstrates this is a real bug class. Consider promoting valid-expect and missing-playwright-await to error level since both catch silently-passing assertions that give false test confidence.

Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion

'playwright/valid-expect': 'warn',
'playwright/no-wait-for-timeout': 'warn',
'playwright/no-force-option': 'warn',
'playwright/no-element-handle': 'warn',
'playwright/no-eval': 'warn',
'playwright/no-skipped-test': 'warn',
'playwright/prefer-web-first-assertions': 'warn',
'playwright/no-useless-await': 'warn',
'playwright/no-wait-for-selector': 'warn',
},
},

Expand Down
18 changes: 10 additions & 8 deletions openmetadata-ui/src/main/resources/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"test:cov-summary": "jest --passWithNoTests --coverage --coverageReporters json-summary",
"lint": "NODE_OPTIONS='--max-old-space-size=8192' eslint \"./src/**/*.{js,jsx,ts,tsx,json}\"",
"lint:fix": "NODE_OPTIONS='--max-old-space-size=8192' eslint './src/**/*.{js,jsx,ts,tsx,json}' --fix",
"lint:playwright": "eslint './playwright/**/*.{ts,tsx}'",
"pretty": "prettier . --config './.prettierrc.yaml' --ignore-path './.prettierignore' --write",
"build-check": "yarn run js-antlr && yarn run parse-schema",
"commit-check": "yarn run pretty && yarn run build",
Expand Down Expand Up @@ -55,6 +56,7 @@
"@fontsource/poppins": "^5.0.0",
"@fontsource/source-code-pro": "^5.0.0",
"@github/g-emoji-element": "^1.1.5",
"@internationalized/date": "^3.11.0",
"@material/material-color-utilities": "^0.3.0",
"@melloware/react-logviewer": "^6.2.0",
"@mui/icons-material": "^7.3.1",
Expand All @@ -64,7 +66,9 @@
"@okta/okta-auth-js": "^7.11.3",
"@okta/okta-react": "^6.4.3",
"@openmetadata/ui-core-components": "link:../../../../../openmetadata-ui-core-components/src/main/resources/ui",
"@react-aria/utils": "^3.33.0",
"@react-awesome-query-builder/antd": "^6.6.15",
"@react-stately/utils": "^3.11.0",
"@rjsf/core": "5.24.13",
"@rjsf/utils": "5.24.13",
"@rjsf/validator-ajv8": "5.24.13",
Expand Down Expand Up @@ -105,6 +109,7 @@
"https-browserify": "^1.0.0",
"i18next": "^21.10.0",
"i18next-browser-languagedetector": "^6.1.6",
"input-otp": "^1.4.2",
"js-yaml": "^4.1.1",
"jwt-decode": "^3.1.2",
"katex": "^0.16.21",
Expand All @@ -119,6 +124,8 @@
"rapidoc": "^9.3.8",
"react": "^18.2.0",
"react-antd-column-resize": "1.0.3",
"react-aria": "^3.47.0",
"react-aria-components": "^1.16.0",
"react-codemirror2": "^7.2.1",
"react-data-grid": "7.0.0-beta.47",
"react-dnd": "^16.0.1",
Expand All @@ -127,6 +134,7 @@
"react-error-boundary": "^3.1.4",
"react-grid-layout": "^1.5.1",
"react-helmet-async": "^1.3.0",
"react-hook-form": "^7.71.1",
"react-i18next": "^15.5.3",
"react-intersection-observer": "^9.16.0",
"react-latex-next": "^3.0.0",
Expand All @@ -146,14 +154,7 @@
"use-analytics": "1.1.0",
"vis-data": "^7.1.4",
"vis-network": "^9.1.6",
"zustand": "^4.5.0",
"@react-aria/utils": "^3.33.0",
"@react-stately/utils": "^3.11.0",
"input-otp": "^1.4.2",
"react-aria": "^3.47.0",
"react-aria-components": "^1.16.0",
"react-hook-form": "^7.71.1",
"@internationalized/date": "^3.11.0"
"zustand": "^4.5.0"
},
"browserslist": {
"production": [
Expand Down Expand Up @@ -218,6 +219,7 @@
"eslint-plugin-jest-formatting": "^3.1.0",
"eslint-plugin-jsonc": "^2.19.2",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-playwright": "^2.9.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.3",
"eslint-plugin-react-hooks": "^5.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Common Test Patterns](#common-test-patterns)
- [Support Classes Reference](#support-classes-reference)
- [Domain Tags](#domain-tags)
- [ESLint Enforcement](#eslint-enforcement)
- [Validation Checklist](#validation-checklist)

---
Expand Down Expand Up @@ -632,6 +633,47 @@ Available domain tags (from `DOMAIN_TAGS` in `playwright/constant/config.ts`):

---

## ESLint Enforcement

Playwright tests are linted with `eslint-plugin-playwright` to automatically catch common anti-patterns. This runs as a CI check on all PRs touching `playwright/` files.

### Running the Lint

```bash
cd openmetadata-ui/src/main/resources/ui
yarn lint:playwright
```

### Rule Levels

**Blocking (error)** — these fail CI and must be fixed before merging:

| Rule | What It Catches |
|------|----------------|
| `no-networkidle` | `waitForLoadState('networkidle')` — unreliable with websockets/polling |
| `no-page-pause` | `page.pause()` — debug statement left in code |
| `no-focused-test` | `test.only()` / `describe.only()` — accidentally committed focus |

**Aspirational (warn)** — reported but don't block CI; fix when touching a file:

| Rule | What It Catches |
|------|----------------|
| `missing-playwright-await` | Missing `await` on `expect()` matchers and Playwright API calls |
| `no-wait-for-timeout` | `page.waitForTimeout()` — use event-driven waits instead |
| `no-force-option` | `{ force: true }` — hides real interaction issues |
| `no-element-handle` | `page.$()` / `page.$$()` — use locators with auto-retry |
| `no-eval` | `page.$eval()` / `page.$$eval()` — use locators instead |
| `no-skipped-test` | `test.skip()` — skipped tests should be fixed or removed |
| `prefer-web-first-assertions` | `textContent()` / `isVisible()` — use `toHaveText()` / `toBeVisible()` |
| `no-useless-await` | Unnecessary `await` on non-async methods |
| `no-wait-for-selector` | `page.waitForSelector()` — use `expect().toBeVisible()` instead |

### Promoting Rules

As existing violations are fixed, warning-level rules should be promoted to error level to prevent regressions.

---

## Validation Checklist

Before finalizing tests, verify:
Expand Down Expand Up @@ -662,6 +704,10 @@ Before finalizing tests, verify:
- [ ] Semantic locators (getByRole, getByTestId) used
- [ ] Assertions use `.toBeVisible()` instead of `.waitForSelector()`

### ESLint
- [ ] `yarn lint:playwright` passes with zero errors
- [ ] No new warnings introduced (fix existing ones when touching a file)

### Coverage & Roles
- [ ] Multi-role tests use appropriate fixtures
- [ ] Data persistence verified after reload/navigation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@ export const lookerFormDetails = {
// This is derived from actual scenario where the certificate file content is large enough
// to cause overflow issue in the file upload field
export const CERT_FILE =
// eslint-disable-next-line max-len
'-----BEGIN ENCRYPTED PRIVATE KEY-----OEMIIFJDBWBEIEOELRKEIREOROJKELOQMDKDKDOPWWMKSLLSMDHMFRQXBHQTREFrlpPELhGbNAICCAAwDAYIKoZIhvcNAgkFADAUBggqhkiG9w0DBWTEYEWEIWOWEIUEUWIWIEUEEHEIEOEKELEPOWKWPOQPEKEOEKEPWKWOWPKEOEOEKOEKEOKWKFPLKPFLKPLKPLKPLKPKPLKPLKPLKP.crt';
Loading
Loading