Skip to content

test(playwright): add nightly SAML session renewal coverage#27619

Open
siddhant1 wants to merge 6 commits intomainfrom
test/playwright/sso-renewal
Open

test(playwright): add nightly SAML session renewal coverage#27619
siddhant1 wants to merge 6 commits intomainfrom
test/playwright/sso-renewal

Conversation

@siddhant1
Copy link
Copy Markdown
Member

@siddhant1 siddhant1 commented Apr 22, 2026

Summary

  • Adds an end-to-end Playwright spec that exercises OM's JWT refresh behavior for SAML sessions against the local Keycloak fixture, giving the nightly suite first-class coverage of silent refresh, concurrent-401 queuing, and forced re-login on server-side HttpSession loss.
  • Reuses the snapshot/restore mechanism and keycloak-azure-saml provider helper introduced in test(playwright): add nightly SSO login spec starting #27164, and tightens samlConfiguration.security.tokenValidity to 10s so the suite observes multiple expiry cycles in under 60s.
  • Wires the new spec into playwright-sso-login-nightly.yml so the renewal scenarios run on the nightly cadence alongside the existing SSO login spec.

Test plan

  • Run locally: cd openmetadata-ui/src/main/resources/ui && yarn playwright:run playwright/e2e/Auth/SSORenewal.spec.ts
  • Confirm silent-refresh case completes without a visible re-login
  • Confirm concurrent 401s coalesce into a single refresh call (network log)
  • Confirm forced re-login fires when the server-side SAML HttpSession is invalidated
  • Verify the nightly workflow picks up the new spec on the next scheduled run

🤖 Generated with Claude Code


Summary by Gitar

This will update automatically on new commits.

Covers OM's JWT refresh behavior for SAML sessions end-to-end against
the local Keycloak fixture: silent refresh after expiry, concurrent
401s queuing behind a single refresh call, and forced re-login when
the server-side SAML HttpSession is gone.

Reuses the snapshot/restore mechanism and keycloak-azure-saml provider
helper introduced in #27164; shortens samlConfiguration.security.token
Validity to 10s so the suite observes multiple expiry cycles in <60s.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 22, 2026 08:22
@siddhant1 siddhant1 requested review from a team, akash-jain-10, harshach and tutte as code owners April 22, 2026 08:22
@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!

@siddhant1 siddhant1 added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs labels Apr 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Playwright nightly E2E spec to validate SAML session renewal behavior (silent JWT refresh, concurrent-401 coalescing, and forced re-login on server-side session loss) against the local Keycloak SAML fixture, and wires it into the existing nightly SSO workflow.

Changes:

  • Introduces SSORenewal.spec.ts covering access-token refresh, refresh de-duplication, and session-loss relogin.
  • Adds reusable helpers in playwright/utils/sessionRenewal.ts (TTL override, JWT exp decode, expiry wait, cookie clearing).
  • Updates Playwright config + nightly workflow to include the new spec in the sso-auth nightly run.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
openmetadata-ui/src/main/resources/ui/playwright/utils/sessionRenewal.ts Adds helpers to shorten SAML token validity and drive renewal-related assertions.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Auth/SSORenewal.spec.ts New nightly E2E coverage for SAML JWT refresh + forced relogin scenarios.
openmetadata-ui/src/main/resources/ui/playwright.config.ts Includes the new spec in the sso-auth project and excludes it from default runs.
.github/workflows/playwright-sso-login-nightly.yml Executes the new renewal spec alongside the existing SSO login spec on the nightly workflow.

Comment thread openmetadata-ui/src/main/resources/ui/playwright/utils/sessionRenewal.ts Outdated
…Renewal.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 22, 2026 08:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@github-actions
Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 61%
61.98% (60308/97295) 42% (31620/75280) 44.99% (9492/21094)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

🟡 Playwright Results — all passed (17 flaky)

✅ 3694 passed · ❌ 0 failed · 🟡 17 flaky · ⏭️ 89 skipped

Shard Passed Failed Flaky Skipped
✅ Shard 1 481 0 0 4
🟡 Shard 2 653 0 3 7
🟡 Shard 3 663 0 3 1
🟡 Shard 4 643 0 5 27
🟡 Shard 5 610 0 1 42
🟡 Shard 6 644 0 5 8
🟡 17 flaky test(s) (passed on retry)
  • Features/BulkEditEntity.spec.ts › Glossary (shard 2, 1 retry)
  • Features/DataProductRenameConsolidation.spec.ts › Rename then add tags - assets should be preserved (shard 2, 1 retry)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should cancel move operation (shard 2, 1 retry)
  • Features/IncidentManager.spec.ts › Rerunning pipeline for an open incident (shard 3, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › Time (shard 4, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for MlModel (shard 4, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts › Validate Owner Rule Any_In (shard 4, 1 retry)
  • Pages/Entity.spec.ts › Set & Update table-cp, hyperlink-cp, string, integer, markdown, number, duration, email, enum, sqlQuery, timestamp, entityReference, entityReferenceList, timeInterval, time-cp, date-cp, dateTime-cp Custom Property (shard 4, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should allow Data Steward to view all tabs for searchIndex (shard 5, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.ts › verify create lineage for entity - Container (shard 6, 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)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)
  • Pages/Users.spec.ts › Update token expiration for Data Steward (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

page.reload() remounts React and re-races the axios interceptor setup
in AuthProvider — the useEffect that wires authenticatorRef.renewIdToken
onto TokenService has a ref-typed dependency that doesn't reliably
re-run, so the first 401 after reload sometimes finds renewToken=null
and the interceptor silently logs the user out instead of refreshing.

Click the Explore sidebar link instead. The click triggers authenticated
API calls while staying inside the already-mounted React tree, so the
interceptor always reaches the wired TokenService. Spec now passes
10/10 locally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 24, 2026 08:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/playwright-sso-login-nightly.yml Outdated
Comment thread openmetadata-ui/src/main/resources/ui/playwright/e2e/Auth/SSORenewal.spec.ts Outdated
Comment on lines +45 to +48
test.skip(
providerType !== SUPPORTED_PROVIDER || !username || !password,
`${SSO_ENV.PROVIDER_TYPE}=${SUPPORTED_PROVIDER} + ${SSO_ENV.USERNAME} + ${SSO_ENV.PASSWORD} must be set`
);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need this skip?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, the spec mutates the server's security config to a 10s SAML JWT TTL via withShortSamlTokenValidity. That's safe against the local Keycloak SAML container we boot in CI, but unsafe against the shared Okta tenant.

Okta is a public OIDC client, there's no server-side tokenValidity knob to mutate, the test can't lean on natural expiry; it has to mock OM API responses to inject 401s and observe Okta's renewal endpoint from the browser side. Happy to take that on as a follow-up.


// Limited to the local Keycloak SAML fixture because the TTL override mutates
// shared security config and is too aggressive to point at the Okta tenant.
const SUPPORTED_PROVIDER = 'keycloak-azure-saml';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why we need to hardcode this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same reason as the skip above — SUPPORTED_PROVIDER is the gate that keeps the TTL override from being applied to anything other than the local Keycloak fixture.

Comment thread openmetadata-ui/src/main/resources/ui/playwright.config.ts Outdated
Drop the redundant SSORenewal.spec.ts entry from the chromium project's
testIgnore (already covered by **/Auth/**), pull serial-mode config out
of the describe block, and stop duplicating the spec file list in the
nightly workflow command (the sso-auth project's testMatch already lists
both files).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 29, 2026

Code Review ✅ Approved

Adds Playwright coverage for nightly SAML session renewal scenarios. No issues were found.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@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 UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants