Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6aa5a7f

Browse files
pmbrullgithub-actions[bot]Gitargitar-botkaranh37
authored
FIX #24374 - Data Contract at Data Product level (#25314)
* FIX #24374 - Data Contract at Data Product level * Update generated TypeScript types * FIX #24374 - Data Contract at Data Product level * fix DP page * fix: preserve termsOfUse object format in filtered contract The termsOfUse field was being converted to a string during filtering, but the form components expect it to be an object with {content: string}. This was causing test failures where form elements were not visible. - Keep termsOfUse as object format when not inherited - Convert old string format to new object format for consistency - Fixes 21 test failures in DataContracts.spec.ts and DataContractInheritance.spec.ts * fix: address code review findings - state sync and immutability Frontend changes: - Add useEffect to sync formValues with filteredContract changes - Ensures edit form updates when contract prop changes Backend changes: - Create deep copy at start of mergeContracts() to avoid mutating input - Prevents side effects if contract object is reused elsewhere Co-authored-by: pmbrull <[email protected]> * Addressing feedback Co-authored-by: pmbrull <[email protected]> * fix tests * fix inherited contract delete and status * fix inherited contract delete and status * fix inherited contract execution in app * fix test * fix: resolve playwright postgresql ci test failure Co-authored-by: pmbrull <[email protected]> * ci: fix yaml validation and checkstyle failures Co-authored-by: pmbrull <[email protected]> * fix: correct JSON/YAML validation errors Co-authored-by: pmbrull <[email protected]> * fix: resolve maven-collate and ui-coverage test failures Co-authored-by: pmbrull <[email protected]> * gitar feedback * fix ci * fix ci * fix ci * fix ci * include .claude * validate * fix playwright * playwright * fix playwright --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Gitar <[email protected]> Co-authored-by: Gitar <[email protected]> Co-authored-by: pmbrull <[email protected]> Co-authored-by: Karan Hotchandani <[email protected]> Co-authored-by: karanh37 <[email protected]>
1 parent 242df14 commit 6aa5a7f

73 files changed

Lines changed: 3645 additions & 262 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: `[email protected]` / `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

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ claude-flow
180180
claude-flow.bat
181181
claude-flow.ps1
182182
hive-mind-prompt-*.txt
183-
.claude/
184183
.claude-flow/
185184
memory
186185

bootstrap/sql/migrations/native/1.12.0/mysql/schemaChanges.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ UPDATE test_definition
5151
SET json = JSON_SET(json, '$.enabled', true)
5252
WHERE json_extract(json, '$.enabled') IS NULL;
5353

54+
-- Migrate termsOfUse from string to object with content and inherited fields
55+
-- This converts existing termsOfUse string values to the new object structure: { "content": "...", "inherited": false }
56+
UPDATE data_contract_entity
57+
SET json = JSON_SET(
58+
json,
59+
'$.termsOfUse',
60+
JSON_OBJECT('content', JSON_UNQUOTE(JSON_EXTRACT(json, '$.termsOfUse')), 'inherited', false)
61+
)
62+
WHERE JSON_TYPE(JSON_EXTRACT(json, '$.termsOfUse')) = 'STRING';
63+
5464
-- Add updatedAt generated column to entity_extension table for efficient timestamp-based queries
5565
-- This supports the listEntityHistoryByTimestamp API endpoint for retrieving entity versions within a time range
5666
ALTER TABLE entity_extension

bootstrap/sql/migrations/native/1.12.0/postgres/schemaChanges.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ UPDATE test_definition
4646
SET json = jsonb_set(json::jsonb, '{enabled}', 'true'::jsonb, true)::json
4747
WHERE json ->> 'enabled' IS NULL;
4848

49+
-- Migrate termsOfUse from string to object with content and inherited fields
50+
-- This converts existing termsOfUse string values to the new object structure: { "content": "...", "inherited": false }
51+
UPDATE data_contract_entity
52+
SET json = jsonb_set(
53+
json::jsonb,
54+
'{termsOfUse}',
55+
jsonb_build_object('content', json ->> 'termsOfUse', 'inherited', false)
56+
)::json
57+
WHERE jsonb_typeof((json::jsonb) -> 'termsOfUse') = 'string';
58+
4959
CREATE UNIQUE INDEX IF NOT EXISTS idx_audit_log_event_change_event_id
5060
ON audit_log_event (change_event_id);
5161

0 commit comments

Comments
 (0)