Add advanced client details tests (#3482)

This commit is contained in:
Dominik Kawka 2022-10-10 18:52:44 +01:00 committed by GitHub
parent 066ecbe3e2
commit 5b74013dc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 255 additions and 9 deletions

View file

@ -711,7 +711,9 @@ describe("Clients test", () => {
commonPage.sidebar().waitForPageLoad();
createClientPage.save();
commonPage
.masthead()
.checkNotificationMessage("Client created successfully");
clientDetailsPage.goToAdvancedTab();
});
@ -726,6 +728,7 @@ describe("Clients test", () => {
advancedTab.registerNodeManually().fillHost("localhost").saveHost();
advancedTab.checkTestClusterAvailability(true);
commonPage.masthead().checkNotificationMessage("Node successfully added");
advancedTab.deleteClusterNode();
commonPage.modalUtils().confirmModal();
commonPage
@ -745,6 +748,64 @@ describe("Clients test", () => {
.revertFineGrain();
advancedTab.checkAccessTokenSignatureAlgorithm(algorithm);
});
it("OIDC Compatibility Modes configuration", () => {
advancedTab.clickAllCompatibilitySwitch();
advancedTab.saveCompatibility();
advancedTab.jumpToCompatability();
advancedTab.clickExcludeSessionStateSwitch();
advancedTab.clickUseRefreshTokenForClientCredentialsGrantSwitch();
advancedTab.revertCompatibility();
});
it("Advanced settings", () => {
advancedTab.jumpToAdvanced();
advancedTab.clickAdvancedSwitches();
advancedTab.jumpToAdvanced();
advancedTab.SelectKeyForCodeExchangeInput("S256");
advancedTab.saveAdvanced();
advancedTab.jumpToAdvanced();
advancedTab.checkAdvancedSwitchesOn();
advancedTab.CheckKeyForCodeExchangeInput("S256");
advancedTab.SelectKeyForCodeExchangeInput("plain");
advancedTab.CheckKeyForCodeExchangeInput("plain");
advancedTab.jumpToAdvanced();
advancedTab.clickAdvancedSwitches();
advancedTab.revertAdvanced();
advancedTab.jumpToAdvanced();
advancedTab.CheckKeyForCodeExchangeInput("S256");
//uncomment when revert button reverts all switches
//and ACR to LoA Mapping + Default ACR Values
//advancedTab.checkAdvancedSwitchesOn();
});
it("Authentication flow override", () => {
advancedTab.jumpToAuthFlow();
advancedTab.SelectBrowserFlowInput("browser");
advancedTab.SelectDirectGrantInput("docker auth");
advancedTab.CheckBrowserFlowInput("browser");
advancedTab.CheckDirectGrantInput("docker auth");
advancedTab.revertAuthFlowOverride();
advancedTab.jumpToAuthFlow();
advancedTab.CheckBrowserFlowInput("");
advancedTab.CheckDirectGrantInput("");
advancedTab.SelectBrowserFlowInput("browser");
advancedTab.SelectDirectGrantInput("docker auth");
advancedTab.saveAuthFlowOverride();
advancedTab.SelectBrowserFlowInput("first broker login");
advancedTab.SelectDirectGrantInput("first broker login");
advancedTab.revertAuthFlowOverride();
//revert doesn't work after saving.
//advancedTab.CheckBrowserFlowInput("browser");
//advancedTab.CheckDirectGrantInput("docker auth");
});
});
describe("Service account tab test", () => {

View file

@ -1,6 +1,6 @@
import CommonPage from "../../../../../CommonPage";
import PageObject from "../../../../components/PageObject";
export default class AdvancedTab extends CommonPage {
export default class AdvancedTab extends PageObject {
private setToNowBtn = "#setToNow";
private clearBtn = "#clear";
private pushBtn = "#push";
@ -21,6 +21,32 @@ export default class AdvancedTab extends CommonPage {
private accessTokenSignatureAlgorithmInput = "#accessTokenSignatureAlgorithm";
private fineGrainSaveBtn = "#fineGrainSave";
private fineGrainRevertBtn = "#fineGrainRevert";
private OIDCCompatabilitySaveBtn = "OIDCCompatabilitySave";
private OIDCCompatabilityRevertBtn = "OIDCCompatabilityRevert";
private OIDCAdvancedSaveBtn = "OIDCAdvancedSave";
private OIDCAdvancedRevertBtn = "OIDCAdvancedRevert";
private OIDCAuthFlowOverrideSaveBtn = "OIDCAuthFlowOverrideSave";
private OIDCAuthFlowOverrideRevertBtn = "OIDCAuthFlowOverrideRevert";
private excludeSessionStateSwitch =
"#excludeSessionStateFromAuthenticationResponse-switch";
private useRefreshTokenSwitch = "#useRefreshTokens";
private useRefreshTokenForClientCredentialsGrantSwitch =
"#useRefreshTokenForClientCredentialsGrant";
private useLowerCaseBearerTypeSwitch = "#useLowerCaseBearerType";
private oAuthMutualSwitch = "#oAuthMutual-switch";
private keyForCodeExchangeInput = "#keyForCodeExchange";
private pushedAuthorizationRequestRequiredSwitch =
"#pushedAuthorizationRequestRequired";
private browserFlowInput = "#browserFlow";
private directGrantInput = "#directGrant";
private jumpToOIDCCompatabilitySettings =
"jump-link-open-id-connect-compatibility-modes";
private jumpToAdvancedSettings = "jump-link-advanced-settings";
private jumpToAuthFlowOverride = "jump-link-authentication-flow-overrides";
setRevocationToNow() {
cy.get(this.setToNowBtn).click();
@ -120,4 +146,143 @@ export default class AdvancedTab extends CommonPage {
cy.get(this.fineGrainRevertBtn).click();
return this;
}
saveCompatibility() {
cy.findByTestId(this.OIDCCompatabilitySaveBtn).click();
return this;
}
revertCompatibility() {
cy.findByTestId(this.OIDCCompatabilityRevertBtn).click();
cy.findByTestId(this.jumpToOIDCCompatabilitySettings).click();
//uncomment when revert function reverts all switches, rather than just the first one
//this.assertSwitchStateOn(cy.get(this.useRefreshTokenForClientCredentialsGrantSwitch));
this.assertSwitchStateOn(cy.get(this.excludeSessionStateSwitch));
return this;
}
jumpToCompatability() {
cy.findByTestId(this.jumpToOIDCCompatabilitySettings).click();
return this;
}
clickAllCompatibilitySwitch() {
cy.get(this.excludeSessionStateSwitch).parent().click();
this.assertSwitchStateOn(cy.get(this.excludeSessionStateSwitch));
cy.get(this.useRefreshTokenSwitch).parent().click();
this.assertSwitchStateOff(cy.get(this.useRefreshTokenSwitch));
cy.get(this.useRefreshTokenForClientCredentialsGrantSwitch)
.parent()
.click();
this.assertSwitchStateOn(
cy.get(this.useRefreshTokenForClientCredentialsGrantSwitch)
);
cy.get(this.useLowerCaseBearerTypeSwitch).parent().click();
this.assertSwitchStateOn(cy.get(this.useLowerCaseBearerTypeSwitch));
return this;
}
clickExcludeSessionStateSwitch() {
cy.get(this.excludeSessionStateSwitch).parent().click();
this.assertSwitchStateOff(cy.get(this.excludeSessionStateSwitch));
}
clickUseRefreshTokenForClientCredentialsGrantSwitch() {
cy.get(this.useRefreshTokenForClientCredentialsGrantSwitch)
.parent()
.click();
this.assertSwitchStateOff(
cy.get(this.useRefreshTokenForClientCredentialsGrantSwitch)
);
}
saveAdvanced() {
cy.findByTestId(this.OIDCAdvancedSaveBtn).click();
return this;
}
revertAdvanced() {
cy.findByTestId(this.OIDCAdvancedRevertBtn).click();
return this;
}
jumpToAdvanced() {
cy.findByTestId(this.jumpToAdvancedSettings).click();
return this;
}
clickAdvancedSwitches() {
cy.get(this.oAuthMutualSwitch).parent().click();
cy.get(this.pushedAuthorizationRequestRequiredSwitch).parent().click();
return this;
}
checkAdvancedSwitchesOn() {
this.assertSwitchStateOn(cy.get(this.oAuthMutualSwitch));
this.assertSwitchStateOn(
cy.get(this.pushedAuthorizationRequestRequiredSwitch)
);
return this;
}
checkAdvancedSwitchesOff() {
this.assertSwitchStateOff(cy.get(this.oAuthMutualSwitch));
this.assertSwitchStateOff(
cy.get(this.pushedAuthorizationRequestRequiredSwitch)
);
return this;
}
SelectKeyForCodeExchangeInput(input: string) {
cy.get(this.keyForCodeExchangeInput).click();
cy.get(this.keyForCodeExchangeInput + " + ul")
.contains(input)
.click();
return this;
}
CheckKeyForCodeExchangeInput(input: string) {
cy.get(this.keyForCodeExchangeInput).should("have.text", input);
return this;
}
saveAuthFlowOverride() {
cy.findByTestId(this.OIDCAuthFlowOverrideSaveBtn).click();
return this;
}
revertAuthFlowOverride() {
cy.findByTestId(this.OIDCAuthFlowOverrideRevertBtn).click();
return this;
}
jumpToAuthFlow() {
cy.findByTestId(this.jumpToAuthFlowOverride).click();
return this;
}
SelectBrowserFlowInput(input: string) {
cy.get(this.browserFlowInput).click();
cy.get(this.browserFlowInput + " + ul")
.contains(input)
.click();
return this;
}
SelectDirectGrantInput(input: string) {
cy.get(this.directGrantInput).click();
cy.get(this.directGrantInput + " + ul")
.contains(input)
.click();
return this;
}
CheckBrowserFlowInput(input: string) {
cy.get(this.browserFlowInput).should("have.text", input);
return this;
}
CheckDirectGrantInput(input: string) {
cy.get(this.directGrantInput).should("have.text", input);
return this;
}
}

View file

@ -205,10 +205,14 @@ export const AdvancedSettings = ({
</>
)}
<ActionGroup>
<Button variant="secondary" onClick={save}>
<Button
variant="secondary"
onClick={save}
data-testid="OIDCAdvancedSave"
>
{t("common:save")}
</Button>
<Button variant="link" onClick={reset}>
<Button variant="link" onClick={reset} data-testid="OIDCAdvancedRevert">
{t("common:revert")}
</Button>
</ActionGroup>

View file

@ -128,10 +128,18 @@ export const AuthenticationOverrides = ({
</FormGroup>
)}
<ActionGroup>
<Button variant="secondary" onClick={save}>
<Button
variant="secondary"
onClick={save}
data-testid="OIDCAuthFlowOverrideSave"
>
{t("common:save")}
</Button>
<Button variant="link" onClick={reset}>
<Button
variant="link"
onClick={reset}
data-testid="OIDCAuthFlowOverrideRevert"
>
{t("common:revert")}
</Button>
</ActionGroup>

View file

@ -141,10 +141,18 @@ export const OpenIdConnectCompatibilityModes = ({
/>
</FormGroup>
<ActionGroup>
<Button variant="secondary" onClick={save}>
<Button
variant="secondary"
onClick={save}
data-testid="OIDCCompatabilitySave"
>
{t("common:save")}
</Button>
<Button variant="link" onClick={reset}>
<Button
variant="link"
onClick={reset}
data-testid="OIDCCompatabilityRevert"
>
{t("common:revert")}
</Button>
</ActionGroup>