Conditionally show Client Offline Session Max
Fixes: #30521 Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>
This commit is contained in:
parent
0a888512a8
commit
f65af84191
4 changed files with 54 additions and 0 deletions
|
@ -20,6 +20,7 @@ import CommonPage from "../support/pages/CommonPage";
|
||||||
import AttributesTab from "../support/pages/admin-ui/manage/AttributesTab";
|
import AttributesTab from "../support/pages/admin-ui/manage/AttributesTab";
|
||||||
import DedicatedScopesMappersTab from "../support/pages/admin-ui/manage/clients/client_details/DedicatedScopesMappersTab";
|
import DedicatedScopesMappersTab from "../support/pages/admin-ui/manage/clients/client_details/DedicatedScopesMappersTab";
|
||||||
import { ClientRegistrationPage } from "../support/pages/admin-ui/manage/clients/ClientRegistrationPage";
|
import { ClientRegistrationPage } from "../support/pages/admin-ui/manage/clients/ClientRegistrationPage";
|
||||||
|
import RealmSettingsPage from "../support/pages/admin-ui/manage/realm_settings/RealmSettingsPage";
|
||||||
|
|
||||||
let itemId = "client_crud";
|
let itemId = "client_crud";
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
|
@ -30,6 +31,7 @@ const commonPage = new CommonPage();
|
||||||
const listingPage = new ListingPage();
|
const listingPage = new ListingPage();
|
||||||
const attributesTab = new AttributesTab();
|
const attributesTab = new AttributesTab();
|
||||||
const dedicatedScopesMappersTab = new DedicatedScopesMappersTab();
|
const dedicatedScopesMappersTab = new DedicatedScopesMappersTab();
|
||||||
|
const realmSettings = new RealmSettingsPage();
|
||||||
|
|
||||||
describe("Clients test", () => {
|
describe("Clients test", () => {
|
||||||
const realmName = `clients-realm-${uuid()}`;
|
const realmName = `clients-realm-${uuid()}`;
|
||||||
|
@ -880,6 +882,30 @@ describe("Clients test", () => {
|
||||||
advancedTab.revertCompatibility();
|
advancedTab.revertCompatibility();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Client Offline Session Max", () => {
|
||||||
|
configureOfflineSessionMaxInRealmSettings(true);
|
||||||
|
|
||||||
|
cy.findByTestId("token-lifespan-clientOfflineSessionMax").should("exist");
|
||||||
|
|
||||||
|
configureOfflineSessionMaxInRealmSettings(false);
|
||||||
|
|
||||||
|
cy.findByTestId("token-lifespan-clientOfflineSessionMax").should(
|
||||||
|
"not.exist",
|
||||||
|
);
|
||||||
|
|
||||||
|
function configureOfflineSessionMaxInRealmSettings(enabled: boolean) {
|
||||||
|
commonPage.sidebar().goToRealmSettings();
|
||||||
|
realmSettings.goToSessionsTab();
|
||||||
|
realmSettings.setOfflineSessionMaxSwitch(enabled);
|
||||||
|
realmSettings.saveSessions();
|
||||||
|
|
||||||
|
commonPage.sidebar().goToClients();
|
||||||
|
commonPage.tableToolbarUtils().searchItem(client);
|
||||||
|
commonPage.tableUtils().clickRowItemLink(client);
|
||||||
|
clientDetailsPage.goToAdvancedTab();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
it("Advanced settings", () => {
|
it("Advanced settings", () => {
|
||||||
advancedTab.jumpToAdvanced();
|
advancedTab.jumpToAdvanced();
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ export default class RealmSettingsPage extends CommonPage {
|
||||||
generalSaveBtn = "realmSettingsGeneralTab-save";
|
generalSaveBtn = "realmSettingsGeneralTab-save";
|
||||||
generalRevertBtn = "realmSettingsGeneralTab-revert";
|
generalRevertBtn = "realmSettingsGeneralTab-revert";
|
||||||
themesSaveBtn = "themes-tab-save";
|
themesSaveBtn = "themes-tab-save";
|
||||||
|
sessionsSaveBtn = "sessions-tab-save";
|
||||||
loginTab = "rs-login-tab";
|
loginTab = "rs-login-tab";
|
||||||
emailTab = "rs-email-tab";
|
emailTab = "rs-email-tab";
|
||||||
themesTab = "rs-themes-tab";
|
themesTab = "rs-themes-tab";
|
||||||
|
@ -402,6 +403,12 @@ export default class RealmSettingsPage extends CommonPage {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveSessions() {
|
||||||
|
cy.findByTestId(this.sessionsSaveBtn).click();
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
addSenderEmail(senderEmail: string) {
|
addSenderEmail(senderEmail: string) {
|
||||||
this.getFromInput().clear();
|
this.getFromInput().clear();
|
||||||
|
|
||||||
|
@ -710,6 +717,11 @@ export default class RealmSettingsPage extends CommonPage {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setOfflineSessionMaxSwitch(value: boolean) {
|
||||||
|
this.setSwitch(this.offlineSessionMaxSwitch, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
clickAdd() {
|
clickAdd() {
|
||||||
cy.findByTestId("addEventTypeConfirm").click();
|
cy.findByTestId("addEventTypeConfirm").click();
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -111,6 +111,21 @@ export const AdvancedSettings = ({
|
||||||
defaultValue={realm?.offlineSessionIdleTimeout}
|
defaultValue={realm?.offlineSessionIdleTimeout}
|
||||||
units={["minute", "day", "hour"]}
|
units={["minute", "day", "hour"]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{realm?.offlineSessionMaxLifespanEnabled && (
|
||||||
|
<TokenLifespan
|
||||||
|
id="clientOfflineSessionMax"
|
||||||
|
name={convertAttributeNameToForm(
|
||||||
|
"attributes.client.offline.session.max.lifespan",
|
||||||
|
)}
|
||||||
|
defaultValue={
|
||||||
|
realm?.offlineSessionMaxLifespanEnabled
|
||||||
|
? realm.offlineSessionMaxLifespan
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
units={["minute", "day", "hour"]}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<DefaultSwitchControl
|
<DefaultSwitchControl
|
||||||
name={convertAttributeNameToForm<FormFields>(
|
name={convertAttributeNameToForm<FormFields>(
|
||||||
"attributes.tls.client.certificate.bound.access.tokens",
|
"attributes.tls.client.certificate.bound.access.tokens",
|
||||||
|
|
|
@ -51,6 +51,7 @@ export const TokenLifespan = ({
|
||||||
label={t(id)}
|
label={t(id)}
|
||||||
fieldId={id}
|
fieldId={id}
|
||||||
labelIcon={<HelpItem helpText={t(`${id}Help`)} fieldLabelId={id} />}
|
labelIcon={<HelpItem helpText={t(`${id}Help`)} fieldLabelId={id} />}
|
||||||
|
data-testid={`token-lifespan-${id}`}
|
||||||
>
|
>
|
||||||
<Controller
|
<Controller
|
||||||
name={name}
|
name={name}
|
||||||
|
|
Loading…
Reference in a new issue