8000 Improve Admin UI stability for Playwright E2E tests by edewit · Pull Request #52323 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Improve Admin UI stability for Playwright E2E tests - #52323

Open
edewit wants to merge 17 commits into
keycloak:mainfrom
edewit:admin-ui-e2e-stability
Open

edewit wants to merge 17 commits into
keycloak:mainfrom
edewit:admin-ui-e2e-stability

Conversation

@edewit
@edewit edewit commented Sep 2, 2026
Copy link
Copy Markdown
Contributor

Closes #52322

Summary

  • Add LoadingOverlay with PatternFly Skeleton and testable loading signals (loading-spinner, table-ready) in ui-shared
  • Keep KeycloakDataTable DOM mounted during reload instead of unmounting tbody on every fetch
  • Stabilize switches (consistent ids/testids, disabled while async save) on realm login settings, workflows, SAML keys, and IDP forms
  • Add readiness markers for users list, tab content, and authentication flow reorder completion
  • Refresh IDP mapper lists after save/navigation
  • Replace multi-attempt retry loops in Playwright helpers with waitForLoadingComplete and simple assertions

Test plan

  • ./mvnw -pl quarkus/deployment,quarkus/dist -am -DskipTests clean install (or JS CI equivalent)
  • Run admin-ui Playwright suite locally (chromium + firefox)
  • Verify table reload shows skeleton overlay with page-matching background
  • Verify realm login switches disable during save
  • Verify authentication flow keyboard reorder test passes without drag fallbacks

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

Several readiness signals can report completion prematurely or never appear, and the loading overlay ignores its supplied skeleton.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Improves Admin UI E2E stability by exposing loading/readiness signals and simplifying Playwright interactions.

Changes:

  • Adds shared loading overlays and stable table DOM behavior.
  • Disables switches during asynchronous updates.
  • Replaces retry-heavy Playwright helpers with readiness-based waits.
File summaries
File Description
js/libs/ui-shared/src/main.ts Exports loading components.
js/libs/ui-shared/src/controls/table/KeycloakDataTable.tsx Adds overlays, readiness marker, and stable row keys.
js/libs/ui-shared/src/controls/SwitchControl.tsx Adds switch IDs and disabled state.
js/libs/ui-shared/src/controls/LoadingOverlay.tsx Introduces loading overlay and skeleton.
js/libs/ui-shared/src/controls/loading-overlay.module.css Styles loading overlays.
js/libs/ui-shared/src/controls/KeycloakSpinner.tsx Adds a test selector.
js/libs/ui-shared/src/continue-cancel/ContinueCancelModal.tsx Adds modal action selectors.
js/libs/ui-shared/src/buttons/FormSubmitButton.tsx Exposes submission state.
js/apps/admin-ui/test/workflows/main.spec.ts Removes forced switch click.
js/apps/admin-ui/test/utils/table.ts Simplifies table helpers.
js/apps/admin-ui/test/utils/modal.ts Adds modal visibility assertions.
js/apps/admin-ui/test/utils/loading.ts Adds loading wait helper.
js/apps/admin-ui/test/utils/form.ts Simplifies form and switch interactions.
js/apps/admin-ui/test/realm-settings/userprofile.ts Uses stable switch and user-table helpers.
js/apps/admin-ui/test/identity-providers/saml.spec.ts Reuses table assertion helper.
js/apps/admin-ui/test/identity-providers/main.ts Waits for mapper loading.
js/apps/admin-ui/test/autentication/flow.ts Uses deterministic keyboard reordering.
js/apps/admin-ui/src/workflows/WorkflowsSection.tsx Stabilizes workflow toggles and refreshes.
js/apps/admin-ui/src/user/EditUser.tsx Adds tab readiness marker.
js/apps/admin-ui/src/realm-settings/PoliciesTab.tsx Correctly places switch test selector.
js/apps/admin-ui/src/realm-settings/LoginTab.tsx Disables switches during saves.
js/apps/admin-ui/src/identity-providers/component/SwitchField.tsx Normalizes switch IDs and selectors.
js/apps/admin-ui/src/identity-providers/add/DetailSettings.tsx Refreshes mapper data after navigation.
js/apps/admin-ui/src/components/users/UserDataTable.tsx Adds users-table readiness marker.
js/apps/admin-ui/src/clients/keys/SamlKeys.tsx Restores switch state on cancellation.
js/apps/admin-ui/src/clients/ClientDetails.tsx Adds tab readiness marker.
js/apps/admin-ui/src/authentication/FlowDetails.tsx Signals reorder completion.
js/apps/admin-ui/src/authentication/components/FlowRow.tsx Adds drag-handle selector.
js/apps/admin-ui/README.md Documents Playwright loading conventions.
Review details

Suppressed comments (1)

js/libs/ui-shared/src/controls/LoadingOverlay.tsx:49

  • The supplied skeleton is never rendered: any truthy value is replaced with a new default TableLoadingSkeleton, so callers' custom content and rows setting are ignored. Render the supplied node directly.
          {skeleton ? <TableLoadingSkeleton /> : <KeycloakSpinner />}
  • Files reviewed: 29/29 changed files
  • Comments generated: 6
  • Review effort level: Balanced

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

Comment thread js/apps/admin-ui/test/utils/loading.ts Resolved
Copilot AI review requested due to automatic review settings September 3, 2026 05:56
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

A critical test contract regression and several unresolved loading, concurrency, locator, and accessibility issues block approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (5)

Previously missed (4) — in code that hasn't changed since the last review.

js/apps/admin-ui/src/identity-providers/add/DetailSettings.tsx:356

  • Entering /mappers already mounts a fresh table (RoutableTabs uses mountOnEnter/unmountOnExit, and mapper forms are separate routes), so this mount effect increments the signal and starts a second mapper request immediately after the first. Remove this route-driven refresh; the existing signal refresh used after deletion can remain.
    js/apps/admin-ui/src/identity-providers/component/SwitchField.tsx:34
  • FormGroupField still sets fieldId={label}, so changing the switch ID to fieldName disconnects the visible <label> from its control and clicking the label no longer toggles the switch. Keep the ID aligned with label, or extend FormGroupField to receive the same field ID.
    js/apps/admin-ui/src/workflows/WorkflowsSection.tsx:143
  • Only disabling the matching row allows another workflow toggle to start and overwrite togglingWorkflowId; when either request finishes, its finally can then re-enable switches while the other save is still pending. Disable all workflow switches while one ID is set, or track pending IDs in a set.
    js/apps/admin-ui/test/utils/table.ts:28
  • The strict string match is case-sensitive and breaks the existing SPIFFE caller: spiffe.spec.ts:31 requests Spiffe, while the provider created by AddSpiffeConnect.tsx:29-32 is rendered as alias spiffe. Keep a single deterministic click, but match an escaped, anchored case-insensitive regular expression.

js/apps/admin-ui/test/utils/loading.ts:18

  • This only checks that loading signals are absent at the instant of polling. Post-action callers such as searchItem and refreshTable can therefore return before KeycloakDataTable's effect sets loading=true, allowing interaction with stale rows; the helper needs to observe the new loading/readiness cycle (or wrap the triggering action) before waiting for completion.
  await expect
    .poll(async () => (await spinner.count()) + (await busy.count()), {
      timeout,
    })
    .toBe(0);
  • Files reviewed: 28/28 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings September 3, 2026 06:58
@stianst
stianst requested a review from ssilvert September 3, 2026 07:04
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

Multiple readiness signals and cancellation or accessibility paths remain incorrect and can cause premature waits or inconsistent UI state.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (5)

Previously missed (4) — in code that hasn't changed since the last review.

js/apps/admin-ui/src/clients/ClientDetails.tsx:480

  • This marker remains present while RoutableTabs unmounts/mounts an active tab and while that tab performs its own asynchronous loading, so it cannot signal that the selected tab content is ready. Tie the marker to the active tab's actual load completion instead of the always-mounted page section.
    js/apps/admin-ui/src/clients/keys/SamlKeys.tsx:270
  • This rollback runs only for the Cancel button; ConfirmDialogModal closes via its X/Escape onClose without invoking onCancel, leaving the form value set to disabled even though the user dismissed confirmation. Route every cancellation path through the rollback.
    js/apps/admin-ui/src/identity-providers/component/SwitchField.tsx:34
  • FormGroupField still renders its label with fieldId={label}, so changing the switch ID to fieldName breaks the label association whenever they differ (for example storeToken/storeTokens). Keep the matching ID, or update the parent field ID alongside this change.
    js/apps/admin-ui/src/user/EditUser.tsx:362
  • This marker remains present while RoutableTabs unmounts/mounts an active tab and while that tab performs its own asynchronous loading, so waiting for it after navigation does not establish that the selected user tab is ready. Tie readiness to the active tab's load completion instead of the always-mounted page section.

js/libs/ui-shared/src/controls/table/KeycloakDataTable.tsx:667

  • On the initial render, rows is still undefined and loading remains false until the useFetch effect runs, so this publishes table-ready (and the empty state) before the first request has even started. A readiness wait can therefore pass against an uninitialized table; only render this branch after rows has been populated.
      {!loading && noData && !searching && (
        <div data-testid="table-ready">{emptyState}</div>
      )}
  • Files reviewed: 28/28 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread js/apps/admin-ui/test/utils/loading.ts Resolved
Copilot AI review requested due to automatic review settings September 3, 2026 12:29
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

Critical table loading races and unresolved readiness, accessibility, and retry issues must be addressed.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (7)

Previously missed (3) — in code that hasn't changed since the last review.

js/apps/admin-ui/src/clients/ClientDetails.tsx:480

  • This marker is on the persistent wrapper, while RoutableTabs uses mountOnEnter/unmountOnExit; it therefore remains visible while the active tab content is being replaced and cannot signal that the new tab is ready. Place the marker inside the mounted tab content or make it identify the active tab after that content mounts.
    js/apps/admin-ui/src/identity-providers/add/DetailSettings.tsx:356
  • Entering the mappers route initially runs the table's normal load and then this effect increments the signal, causing a second request for the same list. Track an actual transition back to /mappers (rather than the initial mount) so mapper creation refreshes without duplicating every initial fetch.
    js/apps/admin-ui/src/user/EditUser.tsx:362
  • This marker stays mounted around RoutableTabs during tab navigation, so a wait for it can pass using the previous tab before the newly selected lazy content mounts. Emit readiness from the active tab content (or include an active-tab-specific marker) instead.

js/apps/admin-ui/src/authentication/FlowDetails.tsx:452

  • flow-order-stable reappears when this outer promise resolves, but executeChange starts nested execution updates without awaiting them at lines 131-137. Reordering an expandable flow can therefore be reported stable while child requests are still running; await all recursive updates before resolving or track all pending reorder work.
                      setIsReordering(true);
                      void executeChange(dragged, change).finally(() =>
                        setIsReordering(false),
                      );

js/apps/admin-ui/src/authentication/FlowDetails.tsx:452

  • executeChange calls refresh(), which only schedules the follow-up fetch, and then resolves; this finally consequently restores flow-order-stable before the refreshed execution list arrives. Keep the busy state until the refresh callback has installed the server-confirmed order, otherwise tests can observe stale rows as stable.
                      setIsReordering(true);
                      void executeChange(dragged, change).finally(() =>
                        setIsReordering(false),
                      );

js/apps/admin-ui/test/utils/loading.ts:13

  • This can succeed immediately when called just after a click or Enter, before React mounts the spinner, so callers can still race the fetch. Waiting needs to observe an operation-specific readiness transition (or the triggering response), rather than only sampling that the spinner is currently absent.
  await expect.poll(async () => await spinner.count(), { timeout }).toBe(0);

js/libs/ui-shared/src/controls/LoadingOverlay.tsx:44

  • Keeping the stale children mounted while only applying pointer-events: none leaves links, switches, and buttons keyboard-focusable and activatable during loading. Make the child subtree inert while isLoading so keyboard users cannot interact through the overlay.
      {children}
  • Files reviewed: 28/28 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Comment thread js/apps/admin-ui/test/utils/table.ts Resolved
Copilot AI review requested due to automatic review settings September 3, 2026 13:10
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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

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

Suppressed comments (1)

js/apps/admin-ui/test/utils/table.ts:1

  • clickTableToolbarItem previously handled common UI states (partial matches and kebab/overflow menu). The new implementation only clicks an exact visible item, which can break when the toolbar overflows and actions move into the kebab (or when labels include additional text). Restoring the overflow/kebab fallback (or explicitly opening overflow when present) would keep tests robust across responsive layouts.
import { type Locator, type Page, expect } from "@playwright/test";

Copilot AI review requested due to automatic review settings September 3, 2026 14:21
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

Multiple unresolved moderate issues can still cause races, premature readiness, redundant requests, and incorrect table expansion.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (8)

Previously missed (6) — in code that hasn't changed since the last review.

js/apps/admin-ui/src/authentication/FlowDetails.tsx:418

  • isReordering only removes the readiness marker; it does not prevent another mouse or keyboard reorder. Overlapping executeChange calls can race, and the first reload can restore flow-order-stable while the second is still running, so make the drag region inert (or otherwise disable DnD) until the reorder finishes.
    js/apps/admin-ui/src/clients/ClientDetails.tsx:480
  • This marker stays mounted across every client tab change, including tabs whose children load data asynchronously, so it cannot signal that the newly selected tab is ready. Expose readiness from the active tab content rather than from the static PageSection.
    js/apps/admin-ui/src/identity-providers/add/DetailSettings.tsx:356
  • Entering /mappers already mounts KeycloakDataTable, which starts its initial load; this effect then increments the signal and starts a second identical mapper/type request. Besides unnecessary API traffic, the extra aborted-but-not-cancelled loading cycle works against the stability this change is intended to provide; refresh only after an actual mapper mutation, not on the initial tab render.
    js/apps/admin-ui/src/user/EditUser.tsx:362
  • This marker is on the persistent wrapper around RoutableTabs, so it remains visible while mountOnEnter switches to tab children that are still fetching. Tests waiting on it can proceed before the active tab content is ready; tie the marker to the active tab's actual loading completion instead.
    js/apps/admin-ui/src/workflows/WorkflowsSection.tsx:145
  • Only the active row is disabled, so another workflow can be toggled while its request is pending; that overwrites the scalar ID, and the first request's finally then re-enables the second switch before its save completes. Disable all workflow switches while this scalar state is set, or track pending IDs in a Set.
    js/libs/ui-shared/src/controls/table/KeycloakDataTable.tsx:634
  • Keeping DataTable mounted also preserves its index-based expandedRows state. After pagination, filtering, or refresh replaces rows, an expanded index can therefore expand a different record; reset expansion when the row set changes or key expansion by row ID.

js/apps/admin-ui/test/autentication/flow.ts:191

  • This still adds a role-based selector fallback, and the same helper continues through multiple pointer, dragTo, row, and keyboard fallback paths below. That contradicts the PR's stated replacement of authentication-flow drag fallbacks with a deterministic readiness-based interaction.
    row
      .locator("[data-testid^='drag-handle-']")
      .first()
      .or(row.getByRole("button", { name: /draggable row/i }).first());

js/apps/admin-ui/test/utils/loading.ts:22

  • This snapshots the current marker count and only asserts candidates already visible, so it never waits for a table-ready marker that appears later. On initial navigation it can return immediately before the table's loading effect starts; wait for the first readiness marker before checking spinner absence.
  const readyCount = await tableReady.count();

  for (let index = 0; index < readyCount; index++) {
    const candidate = tableReady.nth(index);
    if (await candidate.isVisible()) {
      await expect(candidate).toBeVisible({ timeout });
      break;
    }
  }
  • Files reviewed: 28/28 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings September 4, 2026 07:06
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

Seven moderate issues remain in readiness signaling, switch state handling, accessibility, and deterministic test behavior.

Review details

Suppressed comments (8)

Previously missed (5) — in code that hasn't changed since the last review.

js/apps/admin-ui/src/clients/ClientDetails.tsx:480

  • This marker is on a persistent wrapper outside the mountOnEnter tabs, so it is already visible when a different tab is selected and cannot signal that the new tab content is ready. Move or control the marker using the active tab's actual mount/loading state.
    js/apps/admin-ui/src/identity-providers/component/SwitchField.tsx:34
  • FormGroupField still associates its visible label with fieldId={label}, so changing the switch ID to fieldName disconnects every label where those values differ. Keep the matching ID (the new data-testid can remain field-based), or update FormGroupField to receive the same field ID.
    js/apps/admin-ui/src/user/EditUser.tsx:362
  • This marker wraps RoutableTabs and remains visible while mountOnEnter switches tabs, so waiting for it after a tab click can resolve before the newly active tab has mounted or loaded. Tie readiness to the active tab's content/loading state instead of the persistent page wrapper.
    js/apps/admin-ui/src/workflows/WorkflowsSection.tsx:143
  • Only disabling the workflow currently recorded permits another row to start saving and overwrite togglingWorkflowId; when either request finishes, its finally clears the state and can re-enable a switch whose request is still pending. Disable all workflow switches while this value is set, or track pending IDs in a Set.
    js/apps/admin-ui/test/autentication/flow.ts:191
  • The PR says authentication-flow reordering no longer needs drag fallbacks, but this helper still combines a fallback locator here and then tries pointer, dragTo, row drag, and keyboard strategies. Select the intended deterministic keyboard/handle path and remove the fallback chain so the test validates that path directly.

js/apps/admin-ui/test/utils/loading.ts:22

  • This readiness check cannot actually wait: it snapshots the current marker count and calls toBeVisible only after isVisible() has already returned true, before spinner completion is awaited. A caller that runs before the loading/ready markers mount can therefore return immediately; wait for spinner completion first and explicitly poll for a visible table-ready marker for table operations.
  const tableReady = root.locator("[data-testid='table-ready']");
  const readyCount = await tableReady.count();

  for (let index = 0; index < readyCount; index++) {
    const candidate = tableReady.nth(index);
    if (await candidate.isVisible()) {
      await expect(candidate).toBeVisible({ timeout });
      break;
    }
  }

js/apps/admin-ui/test/utils/table.ts:44

  • Adding this readiness wait does not implement the PR's stated replacement of multi-attempt table helpers: the function still executes the six-attempt, four-selector fallback loop below. After readiness, use one exact locator/assertion/click so failures remain deterministic rather than being masked by retries.
export async function clickTableRowItem(page: Page, itemName: string) {
  await waitForLoadingComplete(page);

js/apps/admin-ui/test/workflows/main.spec.ts:126

  • This still routes the workflow test through clickSwitch, which falls back to forced label/input clicks in utils/form.ts; that masks the interaction race this PR is intended to eliminate. Since the switch is already asserted enabled immediately above, use Playwright's normal click and let actionability failures surface.
    await clickSwitch(page, toggleLocator);
  • Files reviewed: 28/28 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@keycloak-github-bot keycloak-github-bot Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.forms.BruteForceTest#testExceedMaxTemporaryLockouts

Keycloak CI - Base IT (5)

org.opentest4j.AssertionFailedError: Expected error event ==> expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
...

Report flaky test

Copilot AI review requested due to automatic review settings September 4, 2026 14:39
@edewit
edewit force-pushed the admin-ui-e2e-stability branch from afc6631 to fe2d8d3 Compare September 17, 2026 09:56
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

Expansion state can leak between unrelated rows, and nested flow-update failures can be reported as successful.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (1)

js/libs/ui-shared/src/controls/table/KeycloakDataTable.tsx:140

  • Rows without an id are represented only by their index, so a reload or page change with the same row count leaves rowIdentityKey unchanged and carries expansion state onto unrelated rows. This occurs for the expandable user/admin event tables because their representations have no id; reset expansion from the actual fetched row set rather than the index fallback.
  const rowIdentityKey = useMemo(
    () =>
      rows
        .map((row, index) =>
          "data" in row && row.data != null
            ? String(get(row.data, "id", index))
            : String(index),
        )
        .join("\0"),
  • Files reviewed: 26/26 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +132 to +142
if (ex.executionList?.length) {
await Promise.all(
ex.executionList.map((e, i) =>
executeChange(e, {
parent: { ...ex, id: result.id },
newIndex: i,
oldIndex: i,
}),
),
);
}
Copilot AI review requested due to automatic review settings September 17, 2026 09:58
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

Expansion identity, concurrent flow reconstruction, row-link precedence, and skeleton overflow remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (2)

js/libs/ui-shared/src/controls/table/KeycloakDataTable.tsx:138

  • The index fallback does not detect dataset changes for expandable rows without an id. Both event representations used by expandable event tables have no id, so paging between equally sized result sets leaves expandedRows attached to the same indexes and expands unrelated rows; use a caller-supplied stable row identity or reset expansion when fetched rows are replaced.
          "data" in row && row.data != null
            ? String(get(row.data, "id", index))
            : String(index),

js/apps/admin-ui/test/utils/table.ts:17

  • Locator.or(...).first() merges all candidates in DOM order; it does not prioritize the exact-name branch. If both foo and foobar links exist and the latter appears first, requesting foo can click the wrong row, so resolve the exact candidate first and only then fall back to partial/provider matching.
  return tableBody
    .getByRole("link", { name: exactNameRegex })
    .or(tableBody.getByRole("link", { name: itemName }))
    .or(
      tableBody.getByTestId("provider-name-link").filter({ hasText: itemName }),
  • Files reviewed: 26/26 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment on lines +132 to +142
if (ex.executionList?.length) {
await Promise.all(
ex.executionList.map((e, i) =>
executeChange(e, {
parent: { ...ex, id: result.id },
newIndex: i,
oldIndex: i,
}),
),
);
}
Comment on lines +14 to +18
position: absolute;
inset: 0;
z-index: 1;
display: flex;
flex-direction: column;
Add LoadingOverlay with PatternFly Skeleton and testable loading signals.
Keep KeycloakDataTable DOM mounted during reload, normalize switch handling,
and add readiness markers for tabs, users list, and auth flow reordering.
Simplify Playwright helpers to use waitForLoadingComplete instead of
multi-attempt retry loops.

Closes keycloak#52322

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Render the supplied loading skeleton, fix screen-reader class, emit
table-ready on empty results, disable all login switches during any save,
poll until loading indicators clear, and tie create-user waits to table-ready.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Restore PatternFly switch label force-click fallback, multi-strategy flow
drag helpers, and scope waitForLoadingComplete to loading-spinner only so
save-button aria-busy does not block table interactions.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Restore robust switch interactions, retry table row clicks, wait for rows
instead of global spinners in assertRowExists, and clear KeycloakDataTable
loading state on fetch errors and dependency changes.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Make overlay content inert while loading, gate table-ready on first fetch,
fix abort-aware loading state, clear flow-order-stable after refresh, and
improve Playwright loading cycle waits.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Only wait on visible table-ready elements and restore row-link click
retries so identity-provider and user list navigation works on CI.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
< 10BC8 span class="Skeleton d-inline-block" style="width:12px; height:12px;">
PatternFly switch inputs require the shared click fallback instead of a
direct locator click when disabling Use JWKS URL during provider setup.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Stop polling table-ready in waitForLoadingComplete to avoid flakes when
markers briefly appear during reload or on unmounted tabs. Add
waitForTableReady for KeycloakDataTable-only cases and harden row clicks.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Wait for add-user or empty-state action instead of table-ready, which
returned early while UserDataTable still showed KeycloakSpinner. Require
visible table-ready in waitForTableReady rather than treating absence as ready.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Fix drag-handle and switch label associations, drop unused readiness
signals, simplify table row waits, and tighten save/disable behavior on
LoginTab, WorkflowsSection, FlowDetails, and mapper refresh.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Scope flow drag handles to the draggable button inside the marked cell,
wait for flow-order-stable after reorder, prefer add-user over empty-state
union locators, and click workflow toggles directly.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Restore flexible row link matching for badges and provider tables, poll
for users page actions, refresh realm on LoginTab save failure, use
clickSwitch for workflow toggles, and fix LoadingOverlay inert typing.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Only treat visible loading-spinner markers as busy so collapsed table
rows do not block assertRowExists. Refresh mapper table when returning
from a mapper detail route without refetching on initial tab mount.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Use table-loading-overlay and page-loading-spinner instead of a shared
loading-spinner test id. Refactor table helpers to wait on rows, links,
and toolbars directly; only render scope detail spinners when expanded.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Guard KeycloakDataTable success callbacks against stale responses, tighten
Playwright table waits, and restore toolbar overflow fallback.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Resolve the correct table-toolbar when multiple are visible by preferring
the active tab panel or the toolbar tied to the selected row.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
@edewit
edewit force-pushed the admin-ui-e2e-stability branch from fe2d8d3 to 7ffcfc7 Compare November 27, 2026 12:34
Copilot AI balanced review requested due to automatic review settings November 27, 2026 12:34
Wait for table idle before toolbar interactions and after mapper saves, reset expanded rows when paginated data changes, and await nested flow execution moves before refetching.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
@edewit
edewit force-pushed the admin-ui-e2e-stability branch from 7ffcfc7 to 64fcd96 Compare November 27, 2026 12:35
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.

({ flow, executions }) => {
setFlow(flow);
setExecutionList(new ExecutionList(executions));
setIsReordering(false);
}
loader={loader}
key={key}
loader={{ signal: key, loader }}
Comment on lines +143 to +144
isDisabled={togglingWorkflowId !== undefined}
aria-busy={togglingWorkflowId === workflow.id}
export async function getTableData(page: Page, name: string) {
// Retry the complete data capture so the wait and read cannot race each other
// during React re-renders that momentarily empty the table. 10BC8
// getTableRows already waits for loading to complete.
<Tr key={index} isExpanded={expandedRows[index]}>
<Tr
// SubRow entries have no `data`; they key on index while parent rows use id.
key={get(row.data, "id") ?? index}
Copilot AI balanced review requested due to automatic review settings November 27, 2026 12:40
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.

<DeleteConfirm />
<KeycloakDataTable
key={key}
loader={{ signal: refreshSignal, loader }}
>
<div
className={style.overlayContent}
{...(isLoading ? { inert: true } : {})}
const [rows, setRows] = useState<(Row<T> | SubRow<T>)[]>();
const [unPaginatedData, setUnPaginatedData] = useState<T[]>();
const [loading, setLoading] = useState(true);
const [loading, setLoading] = useState(false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Admin UI stability for Playwright E2E tests

4 participants

0