mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-06 14:59:55 -06:00
Fix duplicate mapper save error by auto-navigating after creation
Closes #43948 Signed-off-by: Rathan Naik <30756840+Rathan-Naik@users.noreply.github.com> Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com> Co-authored-by: Alexander Schwartz <alexander.schwartz@ibm.com>
This commit is contained in:
@@ -170,6 +170,9 @@ export default function MappingDetails() {
|
||||
}
|
||||
}
|
||||
addAlert(t(`mapping${key}Success`), AlertVariant.success);
|
||||
if (!isUpdating) {
|
||||
navigate(toDetails());
|
||||
}
|
||||
} catch (error) {
|
||||
addError(`mapping${key}Error`, error);
|
||||
}
|
||||
|
||||
@@ -99,4 +99,34 @@ test.describe("Mappers tab", () => {
|
||||
|
||||
await removeMappers(page, mapperNames);
|
||||
});
|
||||
|
||||
test("auto-navigates after creating an Audience mapper", async ({ page }) => {
|
||||
const mapperName = "test-audience-mapper";
|
||||
|
||||
await using testBed = await createTestBed(testBedData);
|
||||
|
||||
await login(page, { to: toClientScopes({ realm: testBed.realm }) });
|
||||
|
||||
await searchItem(page, placeHolderClientScope, "test-scope");
|
||||
await clickTableRowItem(page, "test-scope");
|
||||
await goToMappersTab(page);
|
||||
|
||||
await page.getByRole("button", { name: "Add mapper" }).click();
|
||||
await page.getByRole("menuitem", { name: "By configuration" }).click();
|
||||
|
||||
await page
|
||||
.locator('[role="dialog"]')
|
||||
.getByText("Audience", { exact: true })
|
||||
.click();
|
||||
await page.getByTestId("name").fill(mapperName);
|
||||
await clickSaveButton(page);
|
||||
await assertNotificationMessage(page, "Mapping successfully created");
|
||||
|
||||
await assertRowExists(page, mapperName);
|
||||
await page
|
||||
.getByRole("button", { name: "Add mapper" })
|
||||
.waitFor({ state: "visible" });
|
||||
|
||||
await removeMappers(page, [mapperName]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { type Page, expect } from "@playwright/test";
|
||||
import {
|
||||
assertSelectValue,
|
||||
clickCancelButton,
|
||||
clickSaveButton,
|
||||
selectItem,
|
||||
} from "../utils/form.ts";
|
||||
@@ -54,7 +53,6 @@ export async function addMappersByConfiguration(page: Page, mappers: string[]) {
|
||||
await page.getByTestId("name").fill(mapperName);
|
||||
await clickSaveButton(page);
|
||||
await assertNotificationMessage(page, "Mapping successfully created");
|
||||
await clickCancelButton(page);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user