diff --git a/cypress/e2e/realm_settings_tabs_test.spec.ts b/cypress/e2e/realm_settings_tabs_test.spec.ts index 0d6f198a73..1387b74105 100644 --- a/cypress/e2e/realm_settings_tabs_test.spec.ts +++ b/cypress/e2e/realm_settings_tabs_test.spec.ts @@ -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", diff --git a/src/clients/ClientDescription.tsx b/src/clients/ClientDescription.tsx index 1e3eff3530..477bc5a6bd 100644 --- a/src/clients/ClientDescription.tsx +++ b/src/clients/ClientDescription.tsx @@ -15,7 +15,6 @@ type ClientDescriptionProps = { }; export const ClientDescription = ({ - protocol, hasConfigureAccess: configure, }: ClientDescriptionProps) => { const { t } = useTranslation("clients"); @@ -93,62 +92,32 @@ export const ClientDescription = ({ } /> - {protocol === "saml" && ( - <> - - } - fieldId="kc-always-display-in-console" - hasNoPaddingTop - > - ( - - )} + + } + fieldId="kc-always-display-in-console" + hasNoPaddingTop + > + ( + - - - } - fieldId="kc-frontchannelLogout" - hasNoPaddingTop - > - ( - onChange(value.toString())} - /> - )} - /> - - - )} + )} + /> + ); }; diff --git a/src/clients/add/LogoutPanel.tsx b/src/clients/add/LogoutPanel.tsx index 61e4756935..c5499fb4ce 100644 --- a/src/clients/add/LogoutPanel.tsx +++ b/src/clients/add/LogoutPanel.tsx @@ -37,75 +37,71 @@ export const LogoutPanel = ({ role="manage-clients" className="pf-u-pb-xl" > - {protocol === "openid-connect" && ( - <> + + } + fieldId="kc-frontchannelLogout" + hasNoPaddingTop + > + ( + onChange(value.toString())} + /> + )} + /> + + {protocol === "openid-connect" && + frontchannelLogout?.toString() === "true" && ( } - fieldId="frontchannelLogout" - hasNoPaddingTop + helperTextInvalid={ + errors.attributes?.frontchannel?.logout?.url?.message + } + validated={ + errors.attributes?.frontchannel?.logout?.url?.message + ? ValidatedOptions.error + : ValidatedOptions.default + } > - ( - onChange(value.toString())} - /> - )} - /> - - {frontchannelLogout?.toString() === "true" && ( - - } - helperTextInvalid={ - errors.attributes?.frontchannel?.logout?.url?.message - } + + ((uri.startsWith("https://") || uri.startsWith("http://")) && + !uri.includes("*")) || + uri === "" || + t("frontchannelUrlInvalid").toString(), + })} validated={ errors.attributes?.frontchannel?.logout?.url?.message ? ValidatedOptions.error : ValidatedOptions.default } - > - - ((uri.startsWith("https://") || - uri.startsWith("http://")) && - !uri.includes("*")) || - uri === "" || - t("frontchannelUrlInvalid").toString(), - })} - validated={ - errors.attributes?.frontchannel?.logout?.url?.message - ? ValidatedOptions.error - : ValidatedOptions.default - } - /> - - )} - - )} + /> + + )}