diff --git a/apps/admin-ui/cypress/e2e/identity_providers_oidc_test.spec.ts b/apps/admin-ui/cypress/e2e/identity_providers_oidc_test.spec.ts index aaafb4e84a..b11cadb53e 100644 --- a/apps/admin-ui/cypress/e2e/identity_providers_oidc_test.spec.ts +++ b/apps/admin-ui/cypress/e2e/identity_providers_oidc_test.spec.ts @@ -121,6 +121,15 @@ describe("OIDC identity provider test", () => { masthead.checkNotificationMessage(createMapperSuccessMsg, true); }); + it("should cancel the addition of the OIDC mapper", () => { + sidebarPage.goToIdentityProviders(); + listingPage.goToItemDetails(oidcProviderName); + addMapperPage.goToMappersTab(); + addMapperPage.addMapper(); + addMapperPage.cancelNewMapper(); + addMapperPage.shouldGoToMappersTab(); + }); + it("clean up providers", () => { const modalUtils = new ModalUtils(); diff --git a/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/AddMapperPage.ts b/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/AddMapperPage.ts index 520f9020d1..0708e7780d 100644 --- a/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/AddMapperPage.ts +++ b/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/AddMapperPage.ts @@ -19,6 +19,8 @@ export default class AddMapperPage { private userSessionAttribute = "attribute"; private userSessionAttributeValue = "attribute.value"; private newMapperSaveButton = "new-mapper-save-button"; + private newMapperCancelButton = "new-mapper-cancel-button"; + private mappersUrl = "/oidc/mappers"; private regexAttributeValuesSwitch = "are.attribute.values.regex"; private syncmodeSelectToggle = "#syncMode"; private attributesKeyInput = '[data-testid="config.attributes[0].key"]'; @@ -51,6 +53,11 @@ export default class AddMapperPage { return this; } + cancelNewMapper() { + cy.findByTestId(this.newMapperCancelButton).click(); + return this; + } + toggleSwitch(switchName: string) { cy.findByTestId(switchName).click({ force: true }); @@ -396,4 +403,10 @@ export default class AddMapperPage { return this; } + + shouldGoToMappersTab() { + cy.url().should("include", this.mappersUrl); + + return this; + } } diff --git a/apps/admin-ui/src/identity-providers/add/AddMapper.tsx b/apps/admin-ui/src/identity-providers/add/AddMapper.tsx index 86816e1b62..4b3f027249 100644 --- a/apps/admin-ui/src/identity-providers/add/AddMapper.tsx +++ b/apps/admin-ui/src/identity-providers/add/AddMapper.tsx @@ -245,6 +245,7 @@ export default function AddMapper() { {t("common:save")}