Always Display in Console missing from OIDC clients (#2869)

* Always Display in Console missing from OIDC clients

* Fix flaky test: Realm settings --> Go to login tab

* Make comment more accurate.
This commit is contained in:
Stan Silvert 2022-06-24 07:31:02 -04:00 committed by GitHub
parent c4cd7c376e
commit c70fa2d5f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 101 additions and 139 deletions

View file

@ -39,40 +39,37 @@ describe("Realm settings tabs tests", () => {
cy.findByTestId(realmSettingsPage.userProfileTab).should("exist");
});
// Clicking multiple toggles in succession causes quick re-renderings of the screen
// and there will be a noticeable flicker during the test.
// Sometimes, this will screw up the test and cause Cypress to hang.
// Clicking to another section each time fixes the problem.
function reloadRealm() {
sidebarPage.goToClientScopes();
sidebarPage.goToRealmSettings();
cy.findByTestId("rs-login-tab").click();
}
function testToggle(realmSwitch: string, expectedValue: string) {
realmSettingsPage.toggleSwitch(realmSwitch);
reloadRealm();
cy.findByTestId(realmSwitch).should("have.value", expectedValue);
}
it("Go to login tab", () => {
sidebarPage.goToRealmSettings();
cy.findByTestId("rs-login-tab").click();
realmSettingsPage.toggleSwitch(realmSettingsPage.userRegSwitch);
realmSettingsPage.toggleSwitch(realmSettingsPage.forgotPwdSwitch);
testToggle(realmSettingsPage.userRegSwitch, "on");
testToggle(realmSettingsPage.forgotPwdSwitch, "on");
testToggle(realmSettingsPage.rememberMeSwitch, "on");
testToggle(realmSettingsPage.loginWithEmailSwitch, "off");
testToggle(realmSettingsPage.duplicateEmailsSwitch, "on");
realmSettingsPage.toggleSwitch(realmSettingsPage.rememberMeSwitch);
realmSettingsPage.toggleSwitch(realmSettingsPage.loginWithEmailSwitch);
// Check values
cy.findByTestId(realmSettingsPage.userRegSwitch).should("have.value", "on");
cy.findByTestId(realmSettingsPage.forgotPwdSwitch).should(
"have.value",
"on"
);
cy.findByTestId(realmSettingsPage.rememberMeSwitch).should(
"have.value",
"on"
);
// Check other values
cy.findByTestId(realmSettingsPage.emailAsUsernameSwitch).should(
"have.value",
"off"
);
cy.findByTestId(realmSettingsPage.loginWithEmailSwitch).should(
"have.value",
"off"
);
cy.findByTestId(realmSettingsPage.duplicateEmailsSwitch).should(
"have.value",
"on"
);
cy.findByTestId(realmSettingsPage.verifyEmailSwitch).should(
"have.value",

View file

@ -15,7 +15,6 @@ type ClientDescriptionProps = {
};
export const ClientDescription = ({
protocol,
hasConfigureAccess: configure,
}: ClientDescriptionProps) => {
const { t } = useTranslation("clients");
@ -93,8 +92,6 @@ export const ClientDescription = ({
}
/>
</FormGroup>
{protocol === "saml" && (
<>
<FormGroup
label={t("clients:alwaysDisplayInConsole")}
labelIcon={
@ -121,34 +118,6 @@ export const ClientDescription = ({
)}
/>
</FormGroup>
<FormGroup
label={t("frontchannelLogout")}
labelIcon={
<HelpItem
helpText="clients-help:frontchannelLogout"
fieldLabelId="clients:frontchannelLogout"
/>
}
fieldId="kc-frontchannelLogout"
hasNoPaddingTop
>
<Controller
name="frontchannelLogout"
defaultValue={true}
control={control}
render={({ onChange, value }) => (
<Switch
id="kc-frontchannelLogout-switch"
label={t("common:on")}
labelOff={t("common:off")}
isChecked={value.toString() === "true"}
onChange={(value) => onChange(value.toString())}
/>
)}
/>
</FormGroup>
</>
)}
</FormAccess>
);
};

View file

@ -37,8 +37,6 @@ export const LogoutPanel = ({
role="manage-clients"
className="pf-u-pb-xl"
>
{protocol === "openid-connect" && (
<>
<FormGroup
label={t("frontchannelLogout")}
labelIcon={
@ -47,7 +45,7 @@ export const LogoutPanel = ({
fieldLabelId="clients:frontchannelLogout"
/>
}
fieldId="frontchannelLogout"
fieldId="kc-frontchannelLogout"
hasNoPaddingTop
>
<Controller
@ -56,7 +54,7 @@ export const LogoutPanel = ({
control={control}
render={({ onChange, value }) => (
<Switch
id="frontchannelLogout"
id="kc-frontchannelLogout-switch"
label={t("common:on")}
labelOff={t("common:off")}
isChecked={value.toString() === "true"}
@ -65,7 +63,8 @@ export const LogoutPanel = ({
)}
/>
</FormGroup>
{frontchannelLogout?.toString() === "true" && (
{protocol === "openid-connect" &&
frontchannelLogout?.toString() === "true" && (
<FormGroup
label={t("frontchannelLogoutUrl")}
fieldId="frontchannelLogoutUrl"
@ -90,8 +89,7 @@ export const LogoutPanel = ({
name="attributes.frontchannel.logout.url"
ref={register({
validate: (uri) =>
((uri.startsWith("https://") ||
uri.startsWith("http://")) &&
((uri.startsWith("https://") || uri.startsWith("http://")) &&
!uri.includes("*")) ||
uri === "" ||
t("frontchannelUrlInvalid").toString(),
@ -104,8 +102,6 @@ export const LogoutPanel = ({
/>
</FormGroup>
)}
</>
)}
<FormGroup
label={t("backchannelLogoutUrl")}
fieldId="backchannelLogoutUrl"