Skip to content

Fixes #27458: Display SQL expression for library DQ tests#27516

Open
piyushdotcomm wants to merge 8 commits intoopen-metadata:mainfrom
piyushdotcomm:fix-27458-dq-library-sql-expression
Open

Fixes #27458: Display SQL expression for library DQ tests#27516
piyushdotcomm wants to merge 8 commits intoopen-metadata:mainfrom
piyushdotcomm:fix-27458-dq-library-sql-expression

Conversation

@piyushdotcomm
Copy link
Copy Markdown

@piyushdotcomm piyushdotcomm commented Apr 18, 2026

Fixes #27458

I worked on displaying the SQL expression for library-based Data Quality tests because the test details
page only showed SQL for custom SQL tests. Library tests already expose their SQL template through
TestDefinition.sqlExpression, but the result/details tab was not requesting or rendering that field.

Changes made:

  • Fetch TestDefinition with parameterDefinition and sqlExpression fields in the test case result
    tab.
  • Render a read-only SQL Expression block for library-based tests when TestDefinition.sqlExpression is
    available.
  • Preserve existing custom SQL behavior by preferring TestCase.parameterValues.sqlExpression when
    present.
  • Keep the edit action only for custom SQL parameter values, not for library definition SQL.
  • Added unit tests for:
    • requesting sqlExpression from the test definition API
    • rendering library test SQL expression
    • preserving custom SQL precedence
  • Added Playwright coverage for viewing a library test SQL expression in the test case details UI.

Type of change:

  • Improvement

Checklist:

  • I have read the CONTRIBUTING document. - [x] My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • I have added tests around the new logic.

Testing:

  • playwright test playwright/e2e/Features/DataQuality/TestCaseResultPermissions.spec.ts --list
    • New Playwright test is discovered

Added Playwright test:

  • User with TEST_CASE.VIEW_ALL can view library test SQL expression in UI

Summary by Gitar

  • Playwright infra stability:
    • Refactored TableClass to implement robust status checks for API responses during entity creation.
    • Updated domain.ts to utilize explicit API response waiting in search and selection workflows for improved test reliability.

This will update automatically on new commits.

@piyushdotcomm piyushdotcomm requested a review from a team as a code owner April 18, 2026 20:35
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@piyushdotcomm
Copy link
Copy Markdown
Author

Hi @harshach , could you please add the safe to test label when you get a chance?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 18, 2026

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 61%
62.05% (61913/99766) 42.16% (33131/78572) 45.21% (9794/21660)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 18, 2026

🟡 Playwright Results — all passed (21 flaky)

✅ 3953 passed · ❌ 0 failed · 🟡 21 flaky · ⏭️ 86 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 294 0 5 4
🟡 Shard 2 753 0 7 8
🟡 Shard 3 728 0 4 7
🟡 Shard 4 757 0 2 18
🟡 Shard 5 686 0 1 41
🟡 Shard 6 735 0 2 8
🟡 21 flaky test(s) (passed on retry)
  • Flow/Tour.spec.ts › Tour should work from help section (shard 1, 1 retry)
  • Flow/Tour.spec.ts › Tour should work from welcome screen (shard 1, 1 retry)
  • Flow/Tour.spec.ts › Tour should work from URL directly (shard 1, 1 retry)
  • Pages/AuditLogs.spec.ts › should apply both User and EntityType filters simultaneously (shard 1, 1 retry)
  • Pages/UserCreationWithPersona.spec.ts › Create user with persona and verify on profile (shard 1, 1 retry)
  • Features/ActivityAPI.spec.ts › Activity event is created when description is updated (shard 2, 1 retry)
  • Features/ActivityAPI.spec.ts › Activity event shows the actor who made the change (shard 2, 1 retry)
  • Features/BulkEditEntity.spec.ts › Database (shard 2, 1 retry)
  • Features/BulkImport.spec.ts › Database Schema (shard 2, 1 retry)
  • Features/BulkImport.spec.ts › Keyboard Delete selection (shard 2, 1 retry)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should cancel move operation (shard 2, 1 retry)
  • Features/Glossary/GlossaryWorkflow.spec.ts › should start term as Draft when glossary has reviewers (shard 2, 2 retries)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Features/Tasks/DomainFiltering.spec.ts › selecting All Domains removes domain filter from feed API call (shard 3, 1 retry)
  • Features/Tasks/TaskWorkflowApproval.spec.ts › keep task open until all reviewers have approved (shard 3, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 3, 1 retry)
  • Pages/CustomProperties.spec.ts › Set & Update all CP types on apiCollection (shard 4, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for File (shard 4, 1 retry)
  • Pages/EntityDataConsumer.spec.ts › Tier Add, Update and Remove (shard 5, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: searchIndex (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@piyushdotcomm piyushdotcomm force-pushed the fix-27458-dq-library-sql-expression branch from 90f23d5 to b492f7b Compare April 19, 2026 06:22
@piyushdotcomm
Copy link
Copy Markdown
Author

Hi @harshach @akash-jain-10 @tutte @anuj-kumary @pmbrull
Just following up on this PR all Playwright checks are now passing across all 6 shards (3956 passed, 0 failed), SonarCloud quality gate is green, and the Gitar bot has approved.
Would really appreciate a review when you get a chance.
Thanks for your time

@harshach
Copy link
Copy Markdown
Collaborator

@ShaileshParmar11 please review and merge it cc @TeddyCr

@piyushdotcomm
Copy link
Copy Markdown
Author

GlossaryWorkflow.spec.ts and playwright-sso-tests.yml changes are
minor test/CI fixups picked up while stabilizing the Playwright suite.
Happy to move them to a separate PR if preferred.

Copy link
Copy Markdown
Contributor

@ShaileshParmar11 ShaileshParmar11 left a comment

Choose a reason for hiding this comment

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

Hi, thank you for the contribution. Could you please attach a video recording or screenshots of the UI changes?

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.

Can you please help me understand why we need changes in this yml file?

Comment on lines +318 to +333
let entity: Table;
if (entityResponse.status() === 409) {
const entityResponseByName = await apiContext.get(
`/api/v1/tables/name/${encodeURIComponent(
`${schema.fullyQualifiedName}.${this.entity.name}`
)}`
);
if (!entityResponseByName.ok()) {
throw new Error(
`TableClass: failed to fetch existing table "${
this.entity.name
}" (${entityResponseByName.status()}): ${await entityResponseByName.text()}`
);
}
entity = await entityResponseByName.json();
} else if (!entityResponse.ok()) {
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.

We have fixed this issue, so could you please revert this change?

I would recommend keeping this PR focused on issue #27458 and removing the other unrelated changes from it.

Comment on lines -1673 to -1675
await searchBar.focus();
await searchBar.press('Control+a');
await searchBar.pressSequentially(searchTerm);
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.

please revert this

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 27, 2026

Code Review ✅ Approved 1 resolved / 1 findings

Updates library DQ tests to display the underlying SQL expression, successfully resolving the accidental inclusion of a .spec.ts.bak backup file. No further issues identified.

✅ 1 resolved
Quality: Backup file .spec.ts.bak accidentally committed to repo

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DataQuality/TestCaseResultPermissions.spec.ts.bak:1-15
The file TestCaseResultPermissions.spec.ts.bak (499 lines) is a full copy of the spec file and appears to have been accidentally committed. .bak files should not be checked into version control — they add clutter, confuse tooling, and may diverge from the real spec over time.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

Mock the test definition response directly so the limited-permission user does not reuse a failed live response status. Drop the unrelated data-product PATCH status assertion from this PR.
Make table setup retry-safe after partial shard retries, wait for specific Activity API description events, align glossary workflow assertions with the current In Review state, and simplify domain selector search input handling.
Replace unsupported GitHub Actions upper() usage in SSO Playwright secrets and apply the UI checkstyle formatter output for changed Playwright files.
@sonarqubecloud
Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display SQL Formula for Library-Based DQ Tests, similar to how custom SQL tests are shown

3 participants