Skip to content

Commit 7332df1

Browse files
authored
Merge branch 'main' into patch-1
2 parents 265a8a2 + b582ecc commit 7332df1

3,276 files changed

Lines changed: 183215 additions & 73762 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
---
2+
name: playwright-validation
3+
description: Use when validating UI changes in a branch require Playwright E2E testing. Reviews branch changes, validates UI with Playwright MCP, and adds missing test cases.
4+
---
5+
6+
# Playwright Validation Skill
7+
8+
This skill guides you through validating UI changes and ensuring comprehensive Playwright E2E test coverage.
9+
10+
## When to Use
11+
12+
- After completing UI feature development
13+
- Before creating a PR for UI changes
14+
- When reviewing UI-related branches
15+
- To verify existing Playwright tests cover all scenarios
16+
17+
## Workflow
18+
19+
### Phase 1: Review Branch Changes
20+
21+
1. **Identify changed files vs main:**
22+
```bash
23+
git diff main --stat
24+
git diff main --name-only | grep -E "\.(tsx?|less|css|scss)$"
25+
```
26+
27+
2. **Focus on UI component changes:**
28+
```bash
29+
git diff main -- "openmetadata-ui/src/main/resources/ui/src/components/**" --stat
30+
```
31+
32+
3. **Check for existing Playwright tests:**
33+
```bash
34+
git diff main --name-only | grep -E "playwright.*\.spec\.ts$"
35+
```
36+
37+
4. **Read the changed component files** to understand the UI modifications
38+
39+
### Phase 2: Review Existing Playwright Tests
40+
41+
1. **Locate relevant test files:**
42+
- Check `playwright/e2e/Pages/` for page-level tests
43+
- Check `playwright/e2e/Features/` for feature-specific tests
44+
- Use Glob/Grep to find tests related to the feature
45+
46+
2. **Analyze test coverage:**
47+
- Read the existing test file(s)
48+
- Identify the test scenarios already covered
49+
- Note any gaps in coverage based on the UI changes
50+
51+
3. **Review test utilities:**
52+
- Check `playwright/utils/` for helper functions
53+
- Check `playwright/support/` for entity classes and fixtures
54+
55+
### Phase 3: Validate with Playwright MCP
56+
57+
1. **Start the browser and navigate:**
58+
```
59+
mcp__playwright__browser_navigate to http://localhost:8585
60+
```
61+
62+
2. **Authenticate if needed:**
63+
- Use `mcp__playwright__browser_fill_form` for login
64+
- Default admin: `admin@open-metadata.org` / `admin`
65+
66+
3. **Navigate to the feature area:**
67+
- Use `mcp__playwright__browser_click` for navigation
68+
- Use `mcp__playwright__browser_snapshot` to inspect page state
69+
70+
4. **Validate UI behavior:**
71+
- Test the main user flows
72+
- Verify visual elements (icons, badges, labels)
73+
- Check interactive elements (buttons, dropdowns, forms)
74+
- Verify state changes and API calls
75+
76+
5. **Document findings:**
77+
- Note what works correctly
78+
- Identify any issues or missing functionality
79+
- List scenarios not covered by existing tests
80+
81+
### Phase 4: Add Missing Test Cases
82+
83+
1. **Create a TodoWrite checklist** of missing test scenarios
84+
85+
2. **For each missing test case:**
86+
87+
a. **Add necessary test fixtures** in `beforeAll`:
88+
- Create new entity instances (TableClass, DataProduct, etc.)
89+
- Set up required relationships (domains, assets)
90+
91+
b. **Add cleanup** in `afterAll`:
92+
- Delete created entities in reverse order
93+
94+
c. **Write the test** following the pattern:
95+
```typescript
96+
test('Descriptive Test Name - What it validates', async ({ page }) => {
97+
test.setTimeout(300000);
98+
99+
await test.step('Step description', async () => {
100+
// Test actions and assertions
101+
});
102+
103+
await test.step('Next step', async () => {
104+
// More actions and assertions
105+
});
106+
});
107+
```
108+
109+
3. **Test patterns to cover:**
110+
- Happy path (expected behavior)
111+
- Edge cases (empty states, max values)
112+
- Error handling (invalid inputs, failed requests)
113+
- State transitions (before/after actions)
114+
- UI feedback (loading states, success/error messages)
115+
- Permissions (disabled buttons, restricted actions)
116+
117+
4. **Run lint check:**
118+
```bash
119+
yarn eslint playwright/e2e/Pages/YourTest.spec.ts
120+
```
121+
122+
## Common Test Utilities
123+
124+
### Navigation
125+
```typescript
126+
import { sidebarClick } from '../../utils/sidebar';
127+
import { redirectToHomePage } from '../../utils/common';
128+
import { selectDataProduct, selectDomain } from '../../utils/domain';
129+
```
130+
131+
### Waiting
132+
```typescript
133+
import { waitForAllLoadersToDisappear } from '../../utils/entity';
134+
await page.waitForLoadState('networkidle');
135+
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
136+
```
137+
138+
### API Responses
139+
```typescript
140+
const response = page.waitForResponse('/api/v1/endpoint*');
141+
await someAction();
142+
await response;
143+
expect((await response).status()).toBe(200);
144+
```
145+
146+
### Assertions
147+
```typescript
148+
await expect(page.getByTestId('element')).toBeVisible();
149+
await expect(page.getByTestId('element')).toContainText('text');
150+
await expect(page.locator('.class')).not.toBeVisible();
151+
```
152+
153+
## Checklist Before Completion
154+
155+
- [ ] All UI changes have corresponding test coverage
156+
- [ ] Tests cover both positive and negative scenarios
157+
- [ ] Tests verify visual indicators (icons, badges, states)
158+
- [ ] Tests validate API interactions
159+
- [ ] Lint check passes with no errors
160+
- [ ] Test fixtures are properly created and cleaned up
161+
- [ ] Test timeouts are appropriate (300000ms for complex tests)
162+
163+
## Example: Data Contract Inheritance Tests
164+
165+
For reference, see the comprehensive test coverage in:
166+
`playwright/e2e/Pages/DataContractInheritance.spec.ts`
167+
168+
This file demonstrates:
169+
- Multiple entity setup in beforeAll
170+
- Domain assignment patches
171+
- Contract creation and validation
172+
- Inheritance icon verification
173+
- Action button state verification (disabled/enabled)
174+
- API response validation (POST vs PATCH)
175+
- Fallback behavior testing

.agents/skills/playwright/SKILL.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
name: playwright-test
3+
description: Generate robust, zero-flakiness Playwright E2E tests following OpenMetadata patterns. Creates comprehensive test files with proper waits, API validation, multi-role permissions, and complete entity lifecycle management.
4+
user-invocable: true
5+
---
6+
7+
# Playwright Test Generator - OpenMetadata
8+
9+
Generate production-ready, zero-flakiness Playwright tests following OpenMetadata conventions.
10+
11+
## Usage
12+
13+
```
14+
/playwright-test
15+
Feature: <feature name>
16+
Category: <Features|Pages|Flow|VersionPages>
17+
Entity: <Table|Dashboard|Pipeline|Topic|Database|User|Team|Glossary|Other>
18+
Domain: <Governance|Discovery|Platform|Observability|Integration>
19+
Scenarios:
20+
- <scenario 1 description>
21+
- <scenario 2 description>
22+
- <scenario 3 description>
23+
Roles: <admin|dataConsumer|dataSteward|owner> (optional, defaults to admin)
24+
```
25+
26+
## Quick Example
27+
28+
```
29+
/playwright-test
30+
Feature: Data Quality Rules
31+
Category: Features
32+
Entity: Table
33+
Domain: Observability
34+
Scenarios:
35+
- Admin can create and configure data quality rules
36+
- Data consumer can view test results but not edit rules
37+
- Test results are persisted after page reload
38+
Roles: admin, dataConsumer
39+
```
40+
41+
---
42+
43+
## Instructions
44+
45+
### Step 1: Read the Handbook FIRST
46+
47+
**CRITICAL**: Before generating any tests, read and apply ALL patterns from:
48+
49+
```
50+
openmetadata-ui/src/main/resources/ui/playwright/PLAYWRIGHT_DEVELOPER_HANDBOOK.md
51+
```
52+
53+
The handbook contains:
54+
- Testing philosophy (user-centric, behavior-focused)
55+
- Anti-flakiness patterns (the :visible selector chain pattern, etc.)
56+
- Test timeout strategies (test.slow() vs test.setTimeout())
57+
- Common test patterns (form submission, dropdowns, multi-role testing)
58+
- Locator priority guidelines
59+
- Support classes reference
60+
- Domain tags
61+
- Validation checklist
62+
63+
**Apply ALL handbook principles before proceeding.**
64+
65+
---
66+
67+
### Step 2: Generate Test Using Handbook Template
68+
69+
Use the **Test File Structure Template** from the handbook. It includes:
70+
- Proper imports (performAdminLogin, entity classes, utilities)
71+
- test.describe with domain tags
72+
- beforeAll/afterAll for entity lifecycle via API
73+
- test.slow() for timeout handling
74+
- test.step() for clear organization
75+
- API response validation pattern
76+
77+
---
78+
79+
### Step 3: Apply Common Test Patterns from Handbook
80+
81+
Reference the **Common Test Patterns** section for:
82+
- Form submission with API validation
83+
- Dropdown selection (with :visible chain pattern)
84+
- Multi-role permission testing
85+
- Data persistence verification
86+
- Navigation patterns
87+
- Search and filter patterns
88+
89+
---
90+
91+
### Step 4: Validate Against Handbook Checklist
92+
93+
Before returning the generated test, verify ALL items from the handbook's **Validation Checklist**:
94+
95+
- ✅ Structure & Organization (test.step, domain tags, imports, beforeAll/afterAll)
96+
- ✅ Anti-Flakiness (no waitForTimeout, no networkidle, no force: true, no positional selectors, no stored :visible locators)
97+
- ✅ API & Network (waitForResponse before actions, status code validation)
98+
- ✅ Waits & Assertions (waitForAllLoadersToDisappear, semantic locators, proper assertions)
99+
- ✅ Coverage & Roles (multi-role tests, data persistence, error handling)
100+
101+
---
102+
103+
## Key Reminders
104+
105+
**All patterns, rules, and best practices are in the handbook.**
106+
107+
Read and apply the handbook sections in order:
108+
1. **Anti-Flakiness Patterns** (CRITICAL - #1 cause of flaky tests)
109+
2. **Test File Structure Template** (for proper test structure)
110+
3. **Common Test Patterns** (for specific scenarios)
111+
4. **Validation Checklist** (before returning generated test)
112+
113+
---
114+
115+
## Final Notes
116+
117+
- Generate **production-ready** tests that pass 10/10 times
118+
- Follow ALL patterns from the handbook exactly
119+
- No comments for obvious code (e.g., `// Create entity` before `entity.create()`)
120+
- Test independence - each test runs in any order
121+
- Reference examples: `playwright/e2e/Pages/DataContractInheritance.spec.ts`, `playwright/e2e/Features/Table.spec.ts`
122+
123+
**Generate tests that are production-ready, maintainable, and zero-flakiness by following the handbook patterns exactly.**
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: writing-playwright-tests
3+
description: Use when writing new Playwright E2E tests or adding test cases. Provides testing philosophy, patterns, and best practices from the Playwright Developer Handbook.
4+
---
5+
6+
# Writing Playwright Tests Skill
7+
8+
This skill guides you through writing Playwright E2E tests following OpenMetadata standards.
9+
10+
**Reference**: @openmetadata-ui/src/main/resources/ui/playwright/PLAYWRIGHT_DEVELOPER_HANDBOOK.md

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)