8000 Refactor admin-ui Playwright specs to action-oriented helpers by edewit · Pull Request #52267 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Refactor admin-ui Playwright specs to action-oriented helpers - #52267

Open
edewit wants to merge 2 commits into
keycloak:mainfrom
edewit:issue-52266-playwright-style
Open

edewit wants to merge 2 commits into
keycloak:mainfrom
edewit:issue-52266-playwright-style

Conversation

@edewit
@edewit edewit commented Sep 1, 2026 •
Copy link
Copy Markdown
Contributor

Summary

  • add a Playwright test style guide at js/apps/admin-ui/test/README.md and link it from js/apps/admin-ui/CONTRIBUTING.md
  • introduce action/assertion helper modules for SSF, default trust provider, JWT authorization grant provider, and workflow user tab test flows
  • refactor selected Admin UI Playwright specs so test files read as scenario steps while selectors remain in helper files

Closes #52266

Copilot AI balanced review requested due to automatic review settings September 1, 2026 08:13
@edewit
edewit requested review from a team as code owners September 1, 2026 08:13
Copilot AI left a comment
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.

Pull request overview

Refactors Admin UI Playwright tests into readable scenario steps while centralizing selectors and interactions in helper modules, addressing #52266.

Changes:

  • Adds and links a Playwright test style guide.
  • Introduces helpers for SSF, identity-provider, realm-settings, and workflow tests.
  • Refactors related specifications without changing tested behavior.

Reviewed changes

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

Show a summary per file
File Description
js/apps/admin-ui/CONTRIBUTING.md Links the new style guide.
js/apps/admin-ui/test/README.md Defines Playwright testing conventions.
js/apps/admin-ui/test/clients/ssf.ts Centralizes SSF actions and assertions.
js/apps/admin-ui/test/clients/ssf.spec.ts Uses SSF helpers for navigation tests.
js/apps/admin-ui/test/clients/ssf-subjects.spec.ts Uses helpers for subject workflows.
js/apps/admin-ui/test/clients/ssf-stream.spec.ts Uses helpers for stream workflows.
js/apps/admin-ui/test/clients/ssf-receiver.spec.ts Uses helpers for receiver configuration.
js/apps/admin-ui/test/identity-providers/default-trust.ts Adds default-trust provider helpers.
js/apps/admin-ui/test/identity-providers/default-trust.spec.ts Refactors default-trust scenarios.
js/apps/admin-ui/test/identity-providers/jwt-authorization-grant.ts Adds JWT provider helpers.
js/apps/admin-ui/test/identity-providers/jwt-authorization-grant.spec.ts Refactors JWT provider scenarios.
js/apps/admin-ui/test/realm-settings/general.ts Expands realm-settings helpers.
js/apps/admin-ui/test/realm-settings/general.spec.ts Refactors general realm scenarios.
js/apps/admin-ui/test/workflows/workflow-user-tab.ts Adds workflow-tab assertions and actions.
js/apps/admin-ui/test/workflows/workflow-user-tab.spec.ts Refactors workflow-tab scenarios.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@edewit
edewit force-pushed the issue-52266-playwright-style branch from f82b2ab to 772f515 Compare November 27, 2026 12:30
Copilot AI balanced review requested due to automatic review settings November 27, 2026 12:30
Copilot AI left a comment
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.

🟡 Changes recommended

Removing the expect import breaks the unchanged 404 test with a ReferenceError and causes the serial suite to skip the pending-workflow test.

1 open issue

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings December 4, 2026 13:55
Copilot AI left a comment
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.

🔵 Needs a closer look

The helper uses the resolved display name instead of the realm identifier, causing navigation to the wrong realm when a display name is configured.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Use the realm identifier for navigation

js/​apps/​admin-ui/​test/​identity-providers/​default-trust.ts:8

For realms with a display name, currentRealm contains the resolved display name rather than the realm identifier (src/PageNav.tsx:119–120), so this helper navigates to the wrong realm. Pass the spec's realmName into the helper, preserving the explicit realm used by the previous URL.

1 resolved since last review

Review effort: Balanced

Document a scenario-first Playwright testing style and extract reusable action/assertion helpers so specs stay readable while selector and interaction details remain centralized.

Closes keycloak#52266

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
The action-oriented helper refactor left a direct expect() call without
importing expect from @playwright/test, which failed Admin UI E2E.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
@edewit
edewit force-pushed the issue-52266-playwright-style branch from c67d516 to 273c399 Compare December 4, 2026 14:28
Copilot AI balanced review requested due to automatic review settings December 4, 2026 14:28
Copilot AI left a comment
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.

🟡 Changes recommended

The test helper derives the realm route from a displayed label, which may be a display name rather than the realm identifier, causing navigation to the wrong realm.

1 open issue

Review effort: Balanced

import { clickTableRowItem } from "../utils/table.ts";

async function getCurrentRealm(page: Page) {
return (await page.getByTestId("currentRealm").textContent()) ?? "master";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adopt action-oriented Playwright test style for Admin UI integration tests

2 participants

0