Fixed navigation to mappers tab and added test (#3985)

This commit is contained in:
agagancarczyk 2022-12-15 14:57:51 +00:00 committed by GitHub
parent 9f917e2a65
commit 3c8e4f3b98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 1 deletions

View file

@ -121,6 +121,15 @@ describe("OIDC identity provider test", () => {
masthead.checkNotificationMessage(createMapperSuccessMsg, true); 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", () => { it("clean up providers", () => {
const modalUtils = new ModalUtils(); const modalUtils = new ModalUtils();

View file

@ -19,6 +19,8 @@ export default class AddMapperPage {
private userSessionAttribute = "attribute"; private userSessionAttribute = "attribute";
private userSessionAttributeValue = "attribute.value"; private userSessionAttributeValue = "attribute.value";
private newMapperSaveButton = "new-mapper-save-button"; private newMapperSaveButton = "new-mapper-save-button";
private newMapperCancelButton = "new-mapper-cancel-button";
private mappersUrl = "/oidc/mappers";
private regexAttributeValuesSwitch = "are.attribute.values.regex"; private regexAttributeValuesSwitch = "are.attribute.values.regex";
private syncmodeSelectToggle = "#syncMode"; private syncmodeSelectToggle = "#syncMode";
private attributesKeyInput = '[data-testid="config.attributes[0].key"]'; private attributesKeyInput = '[data-testid="config.attributes[0].key"]';
@ -51,6 +53,11 @@ export default class AddMapperPage {
return this; return this;
} }
cancelNewMapper() {
cy.findByTestId(this.newMapperCancelButton).click();
return this;
}
toggleSwitch(switchName: string) { toggleSwitch(switchName: string) {
cy.findByTestId(switchName).click({ force: true }); cy.findByTestId(switchName).click({ force: true });
@ -396,4 +403,10 @@ export default class AddMapperPage {
return this; return this;
} }
shouldGoToMappersTab() {
cy.url().should("include", this.mappersUrl);
return this;
}
} }

View file

@ -245,6 +245,7 @@ export default function AddMapper() {
{t("common:save")} {t("common:save")}
</Button> </Button>
<Button <Button
data-testid="new-mapper-cancel-button"
variant="link" variant="link"
component={(props) => ( component={(props) => (
<Link <Link
@ -253,7 +254,7 @@ export default function AddMapper() {
realm, realm,
providerId, providerId,
alias: alias!, alias: alias!,
tab: "settings", tab: "mappers",
})} })}
/> />
)} )}