8000 Stabilize Admin UI Edit client profile test by ahus1 · Pull Request #54791 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test } from "@playwright/test";
import { expect, test } from "@playwright/test";
import { v4 as uuid } from "uuid";
import adminClient from "../utils/AdminClient.ts";
import { login } from "../utils/login.ts";
Expand Down Expand Up @@ -76,6 +76,10 @@ test.describe.serial("Realm settings client profiles tab tests", () => {
test.beforeEach(async ({ page }) => {
await searchClientProfile(page, editedProfileName);
await clickTableRowItem(page, editedProfileName);
// Wait for the details page, otherwise the action dropdown of the realm settings page might be used
await expect(page.getByTestId("view-header")).toHaveText(
editedProfileName,
);
});

test("Should add executor to client profile", async ({ page }) => {
Expand Down
15 changes: 13 additions & 2 deletions js/apps/admin-ui/test/utils/masthead.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import AxeBuilder from "@axe-core/playwright";
import { expect, Page } from "@playwright/test";
import { expect, type Page } from "@playwright/test";

const ALERT_TIMEOUT = 15_000;

Expand All @@ -15,7 +15,18 @@ function getActionToggleButton(page: Page) {

export async function selectActionToggleItem(page: Page, item: string) {
await getActionToggleButton(page).click();
await page.getByRole("menuitem", { name: item, exact: true }).click();
const menuItem = page.getByRole("menuitem", { name: item, exact: true });
try {
await expect(menuItem).toBeVisible({ timeout: 5_000 });
} catch (cause) {
throw new Error(
`Menu item "${item}" did not appear after clicking the action dropdown. ` +
"The dropdown of the previous page might have been clicked while navigation was still in progress: " +
"wait for the new page (for example its view-header) to be visible before calling this helper.",
{ cause },
);
}
await menuItem.click();
}

export async function assertAxeViolations(page: Page) {
Expand Down
Loading
0