AdminEvent.getResourcePath() returns paths with duplicated slashes

closes #45114

Signed-off-by: mposolda <mposolda@gmail.com>
This commit is contained in:
Marek Posolda 2026-01-05 22:18:39 +01:00 committed by GitHub
parent 241ca57157
commit f938d894b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 55 additions and 3 deletions

View File

@ -336,7 +336,7 @@ export const AdminEvents = ({ resourcePath }: AdminEventsProps) => {
collapsedText: t("showRemaining"),
}}
variant={SelectVariant.typeaheadMulti}
typeAheadAriaLabel="Select"
typeAheadAriaLabel="select-resourceTypes"
onToggle={(isOpen) =>
setSelectResourceTypesOpen(isOpen)
}
@ -403,7 +403,7 @@ export const AdminEvents = ({ resourcePath }: AdminEventsProps) => {
collapsedText: t("showRemaining"),
}}
variant={SelectVariant.typeaheadMulti}
typeAheadAriaLabel="Select"
typeAheadAriaLabel="select-operationTypes"
onToggle={(isOpen) =>
setSelectOperationTypesOpen(isOpen)
}

View File

@ -16,6 +16,7 @@ import {
clickSearchPanel,
enableSaveEvents,
fillSearchPanel,
fillAdminEventsSearchPanel,
goToAdminEventsTab,
goToEventsConfig,
} from "./list.ts";
@ -120,5 +121,31 @@ test.describe.serial("Events tests", () => {
await goToAdminEventsTab(page);
await assertAxeViolations(page);
});
test("creating user", async ({ page }) => {
const userToCreate = {
username: `my-user`,
enabled: true,
credentials: [{ value: "events-test" }],
realm: realmName,
email: "some-other@email.com",
firstName: "My",
lastName: "User",
};
await adminClient.createUser(userToCreate);
await goToAdminEventsTab(page);
await clickSearchPanel(page);
await assertSearchButtonDisabled(page);
await fillAdminEventsSearchPanel(page, {
resourceType: "USER",
});
await clickSearchButton(page);
await assertRowExists(page, "users/");
await assertRowExists(page, "users//", false); // Assert no trailing slash
});
});
});

View File

@ -38,6 +38,11 @@ type SearchParam = {
eventType?: string;
};
type AdminEventsSearchParam = {
resourceType?: string;
operationType?: string;
};
export async function fillSearchPanel(
page: Page,
{ userId, client, eventType }: SearchParam,
@ -47,6 +52,24 @@ export async function fillSearchPanel(
if (eventType) await selectItem(page, page.getByLabel("Select"), eventType);
}
export async function fillAdminEventsSearchPanel(
page: Page,
{ resourceType, operationType }: AdminEventsSearchParam,
) {
if (resourceType)
await selectItem(
page,
page.getByLabel("select-resourceTypes"),
resourceType,
);
if (operationType)
await selectItem(
page,
page.getByLabel("select-operationTypes"),
operationType,
);
}
export async function assertSearchButtonDisabled(page: Page, disabled = true) {
if (disabled) {
await expect(page.getByTestId("search-events-btn")).toBeDisabled();

View File

@ -233,7 +233,9 @@ public class AdminEventBuilder {
public AdminEventBuilder resourcePath(UriInfo uriInfo, String id) {
StringBuilder sb = new StringBuilder();
sb.append(getResourcePath(uriInfo));
sb.append("/");
if (!sb.toString().endsWith("/")) {
sb.append("/");
}
sb.append(id);
adminEvent.setResourcePath(sb.toString());
return this;