mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-07 14:02:04 -03:30
AdminEvent.getResourcePath() returns paths with duplicated slashes
closes #45114 Signed-off-by: mposolda <mposolda@gmail.com>
This commit is contained in:
parent
241ca57157
commit
f938d894b9
@ -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)
|
||||
}
|
||||
|
||||
@ -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
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user