Skip to content

Conversation

@dhruvjsx
Copy link
Contributor

@dhruvjsx dhruvjsx commented Feb 6, 2026

Screenshot 2026-02-06 at 10 18 54 PM

Summary by Gitar

  • Fixed username transformation bug:
    • Removed incorrect .toUpperCase() calls on usernames in Users.spec.ts that caused selector mismatches
  • Fixed test assertions:
    • Corrected user entity references from user to user3 in custom property tests
    • Added flexible regex pattern for URL matching to handle URL-encoded characters
  • Improved test isolation:
    • Changed entity declarations from const to let and moved initialization to beforeAll hook for proper cleanup between test runs
  • Fixed flaky feed interaction test:
    • Improved popover stability handling and response listener setup in user profile avatar click test
  • Test optimization:
    • Removed unnecessary test.slow(true) from 5 test suites to improve execution time

This will update automatically on new commits.



const upperCasedName = user.responseData.name.toUpperCase();
const userName = user3.responseData.name;
const userDisplayName = user3.responseData.displayName;
Copy link

Choose a reason for hiding this comment

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

⚠️ Edge Case: Missing null safety for user3.responseData.displayName

The variable userDisplayName is assigned user3.responseData.displayName (line 294) without a fallback, even though displayName is an optional field in the OpenMetadata user data model. This value is later passed to toHaveText(userDisplayName) at line 351, which would fail if displayName is undefined.

The same PR correctly applies null safety for persona1.responseData.displayName using ?? at line 874, but misses doing so here.

Suggested fix:

const userDisplayName = user3.responseData.displayName ?? user3.responseData.name;

This matches the defensive pattern already used at line 874 and prevents a flaky test failure when displayName is not set.

Was this helpful? React with 👍 / 👎

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 65%
65.84% (56033/85109) 45.18% (29335/64930) 47.95% (8848/18454)

@gitar-bot
Copy link

gitar-bot bot commented Feb 6, 2026

Code Review 👍 Approved with suggestions 0 resolved / 4 findings

Solid fix for test flakiness — improved test isolation, corrected entity references, and better popover handling. Previous minor findings (null safety, regex escaping, semicolon, formatting) remain unresolved.

⚠️ Edge Case: Missing null safety for user3.responseData.displayName

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts:294

The variable userDisplayName is assigned user3.responseData.displayName (line 294) without a fallback, even though displayName is an optional field in the OpenMetadata user data model. This value is later passed to toHaveText(userDisplayName) at line 351, which would fail if displayName is undefined.

The same PR correctly applies null safety for persona1.responseData.displayName using ?? at line 874, but misses doing so here.

Suggested fix:

const userDisplayName = user3.responseData.displayName ?? user3.responseData.name;

This matches the defensive pattern already used at line 874 and prevents a flaky test failure when displayName is not set.

💡 Quality: Missing space before ?? operator on persona fallback

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts:876

At line 876, the nullish coalescing operator lacks standard spacing:

persona1.responseData.displayName??persona1.responseData.name

Should be:

persona1.responseData.displayName ?? persona1.responseData.name

This is a readability issue. Most formatters (Prettier) would add spaces around ??.

💡 Edge Case: Unescaped userName in RegExp could break with special chars

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts:361

The userName variable is interpolated directly into a RegExp constructor without escaping regex special characters:

new RegExp(`/users/(%22)?${userName}(%22)?`, 'i')

If userName ever contains characters like ., +, (, [, etc., the regex would either match unintended strings or throw a syntax error. While UserClass likely generates safe alphanumeric usernames today, this is fragile.

Suggested fix: Escape the username before using it in a regex:

const escapedName = userName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
new RegExp(`/users/(%22)?${escapedName}(%22)?`, 'i')
💡 Quality: Missing semicolon after test.slow()

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts:561

At line 561, test.slow() is missing a trailing semicolon. While JavaScript's Automatic Semicolon Insertion (ASI) will handle this at runtime, the rest of the file consistently uses semicolons. This inconsistency could cause confusion or linting failures.

Suggested fix:

test.slow();
Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

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.

2 participants