Fixed SAML details header and listing providers by name - #1942 (#3954)

* fixed the displayName bug

* fixed listing by displayName

* fixed the displayName bug

* fixed listing by displayName

* fixed identity provider saml test

* fixed enabled-switch in identity providers saml test

* fixed identity providers oidc test

* fixed the displayName bug

* fixed listing by displayName

* fixed identity provider saml test

* fixed enabled-switch in identity providers saml test

* fixed identity providers oidc test

* header fix

Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
This commit is contained in:
agagancarczyk 2022-12-20 11:42:59 +00:00 committed by GitHub
parent b59d46b166
commit 23a6315726
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 39 additions and 6 deletions

View file

@ -50,6 +50,7 @@ describe("OIDC identity provider test", () => {
createProviderPage
.fillDiscoveryUrl(discoveryUrl)
.shouldBeSuccessful()
.fillDisplayName(oidcProviderName)
.fill(oidcProviderName, secret)
.clickAdd();
masthead.checkNotificationMessage(createSuccessMsg, true);

View file

@ -30,6 +30,7 @@ describe("SAML identity provider test", () => {
const keycloakServer = Cypress.env("KEYCLOAK_SERVER");
const samlDiscoveryUrl = `${keycloakServer}/realms/master/protocol/saml/descriptor`;
const samlDisplayName = "saml";
describe("SAML identity provider creation", () => {
const samlProviderName = "saml";
@ -49,6 +50,7 @@ describe("SAML identity provider test", () => {
.clickCard(samlProviderName);
createProviderPage.checkAddButtonDisabled();
createProviderPage
.fillDisplayName(samlDisplayName)
.fillDiscoveryUrl(samlDiscoveryUrl)
.shouldBeSuccessful()
.clickAdd();

View file

@ -3,6 +3,7 @@ export default class CreateProviderPage {
private clientIdField = "clientId";
private clientIdError = "#kc-client-secret-helper";
private clientSecretField = "clientSecret";
private displayName = "displayName";
private discoveryEndpoint = "discoveryEndpoint";
private authorizationUrl = "authorizationUrl";
private addButton = "createProvider";
@ -91,6 +92,12 @@ export default class CreateProviderPage {
return this;
}
fillDisplayName(value: string) {
cy.findByTestId(this.displayName).type("x");
cy.findByTestId(this.displayName).clear().type(value).blur();
return this;
}
fillDiscoveryUrl(value: string) {
cy.findByTestId(this.discoveryEndpoint).type("x");
cy.findByTestId(this.discoveryEndpoint).clear().type(value).blur();

View file

@ -4,7 +4,7 @@ import Masthead from "../../../Masthead";
const masthead = new Masthead();
export default class ProviderSAMLSettings extends PageObject {
private samlSwitch = "#Saml-switch";
private samlSwitch = "Saml-switch";
private modalConfirm = "#modal-confirm";
private serviceProviderEntityID = "serviceProviderEntityId";
private identityProviderEntityId = "identityProviderEntityId";
@ -58,12 +58,12 @@ export default class ProviderSAMLSettings extends PageObject {
}
public enableProviderSwitch() {
cy.get(this.samlSwitch).parent().click();
cy.findByTestId(this.samlSwitch).parent().click();
masthead.checkNotificationMessage("Provider successfully updated");
}
public disableProviderSwitch() {
cy.get(this.samlSwitch).parent().click();
cy.findByTestId(this.samlSwitch).parent().click();
cy.get(this.modalConfirm).click();
masthead.checkNotificationMessage("Provider successfully updated");
}

View file

@ -84,7 +84,7 @@ export default function IdentityProvidersSection() {
tab: "settings",
})}
>
{identityProvider.alias}
{identityProvider.displayName ?? identityProvider.alias}
{!identityProvider.enabled && (
<Badge
key={`${identityProvider.providerId}-disabled`}

View file

@ -74,6 +74,19 @@ type IdPWithMapperAttributes = IdentityProviderMapperRepresentation & {
const Header = ({ onChange, value, save, toggleDeleteDialog }: HeaderProps) => {
const { t } = useTranslation("identity-providers");
const { alias: displayName } = useParams<{ alias: string }>();
const { adminClient } = useAdminClient();
const [provider, setProvider] = useState<IdentityProviderRepresentation>();
useFetch(
() => adminClient.identityProviders.findOne({ alias: displayName }),
(fetchedProvider) => {
if (!fetchedProvider) {
throw new Error(t("common:notFound"));
}
setProvider(fetchedProvider);
},
[]
);
const [toggleDisableDialog, DisableConfirm] = useConfirmDialog({
titleKey: "identity-providers:disableProvider",
@ -89,7 +102,13 @@ const Header = ({ onChange, value, save, toggleDeleteDialog }: HeaderProps) => {
<>
<DisableConfirm />
<ViewHeader
titleKey={toUpperCase(displayName)}
titleKey={toUpperCase(
provider
? provider.displayName
? provider.displayName
: provider.providerId!
: ""
)}
divider={false}
dropdownItems={[
<DropdownItem key="delete" onClick={() => toggleDeleteDialog()}>

View file

@ -66,7 +66,11 @@ export const SamlGeneralSettings = ({
/>
</FormGroup>
<TextField field="displayName" label="displayName" />
<TextField
field="displayName"
label="displayName"
data-testid="displayName"
/>
<DisplayOrder />
<FormGroup
label={t("endpoints")}