Added tests for client scopes/evaluate tab (#25329)
* added tests for clients/authenticated access policies subtab Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * added tests Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * improvements Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * fixed test Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * simplified test Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * changed checking for website Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * cleanup Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * cleanup Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> --------- Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
This commit is contained in:
parent
6ba716cbed
commit
c3bc43aa86
8 changed files with 276 additions and 62 deletions
|
@ -5,13 +5,13 @@ import SidebarPage from "../support/pages/admin-ui/SidebarPage";
|
|||
import LoginPage from "../support/pages/LoginPage";
|
||||
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
||||
|
||||
describe("Client registration policies subtab", () => {
|
||||
const loginPage = new LoginPage();
|
||||
const listingPage = new ListingPage();
|
||||
const masthead = new Masthead();
|
||||
const sidebarPage = new SidebarPage();
|
||||
const clientRegistrationPage = new ClientRegistrationPage();
|
||||
|
||||
describe("Client registration policies tab", () => {
|
||||
beforeEach(() => {
|
||||
loginPage.logIn();
|
||||
keycloakBefore();
|
||||
|
@ -20,6 +20,13 @@ describe("Client registration policies subtab", () => {
|
|||
sidebarPage.waitForPageLoad();
|
||||
});
|
||||
|
||||
describe("Anonymous client policies subtab", () => {
|
||||
it("check anonymous clients list is not empty", () => {
|
||||
cy.findByTestId("clientRegistration-anonymous")
|
||||
.find("tr")
|
||||
.should("have.length.gt", 0);
|
||||
});
|
||||
|
||||
it("add anonymous client registration policy", () => {
|
||||
clientRegistrationPage
|
||||
.createPolicy()
|
||||
|
@ -30,13 +37,16 @@ describe("Client registration policies subtab", () => {
|
|||
.formUtils()
|
||||
.save();
|
||||
|
||||
masthead.checkNotificationMessage("New client policy created successfully");
|
||||
masthead.checkNotificationMessage(
|
||||
"New client policy created successfully",
|
||||
);
|
||||
clientRegistrationPage.formUtils().cancel();
|
||||
listingPage.itemExist("new policy");
|
||||
});
|
||||
|
||||
it("edit anonymous client registration policy", () => {
|
||||
listingPage.goToItemDetails("new policy");
|
||||
cy.findByTestId("name").clear();
|
||||
clientRegistrationPage
|
||||
.fillPolicyForm({
|
||||
name: "policy 2",
|
||||
|
@ -58,6 +68,63 @@ describe("Client registration policies subtab", () => {
|
|||
);
|
||||
listingPage.itemExist("policy 2", false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Authenticated client policies subtab", () => {
|
||||
beforeEach(() => {
|
||||
clientRegistrationPage.goToAuthenticatedSubTab();
|
||||
sidebarPage.waitForPageLoad();
|
||||
});
|
||||
|
||||
it("check authenticated clients list is not empty", () => {
|
||||
cy.findByTestId("clientRegistration-authenticated")
|
||||
.find("tr")
|
||||
.should("have.length.gt", 0);
|
||||
});
|
||||
|
||||
it("add authenticated client registration policy", () => {
|
||||
clientRegistrationPage
|
||||
.createPolicy()
|
||||
.selectRow("scope")
|
||||
.fillPolicyForm({
|
||||
name: "new authenticated policy",
|
||||
})
|
||||
.formUtils()
|
||||
.save();
|
||||
|
||||
masthead.checkNotificationMessage(
|
||||
"New client policy created successfully",
|
||||
);
|
||||
clientRegistrationPage.formUtils().cancel();
|
||||
listingPage.itemExist("new authenticated policy");
|
||||
});
|
||||
|
||||
it("edit authenticated client registration policy", () => {
|
||||
listingPage.goToItemDetails("new authenticated policy");
|
||||
cy.findByTestId("name").clear();
|
||||
clientRegistrationPage
|
||||
.fillPolicyForm({
|
||||
name: "policy 3",
|
||||
})
|
||||
.formUtils()
|
||||
.save();
|
||||
|
||||
masthead.checkNotificationMessage("Client policy updated successfully");
|
||||
clientRegistrationPage.formUtils().cancel();
|
||||
listingPage.itemExist("policy 3");
|
||||
});
|
||||
|
||||
it("delete authenticated client registration policy", () => {
|
||||
listingPage.clickRowDetails("policy 3").clickDetailMenu("Delete");
|
||||
clientRegistrationPage.modalUtils().confirmModal();
|
||||
|
||||
masthead.checkNotificationMessage(
|
||||
"Client registration policy deleted successfully",
|
||||
);
|
||||
listingPage.itemExist("policy 3", false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Accessibility tests for client registration policies", () => {
|
||||
beforeEach(() => {
|
||||
|
@ -73,4 +140,3 @@ describe("Client registration policies subtab", () => {
|
|||
cy.checkA11y();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -231,6 +231,81 @@ describe("Clients test", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("Client scopes evaluate subtab", () => {
|
||||
const clientName = "testClient";
|
||||
|
||||
beforeEach(() => {
|
||||
loginPage.logIn();
|
||||
keycloakBefore();
|
||||
commonPage.sidebar().goToClients();
|
||||
});
|
||||
|
||||
before(async () => {
|
||||
await adminClient.createClient({
|
||||
protocol: "openid-connect",
|
||||
clientId: clientName,
|
||||
publicClient: false,
|
||||
});
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await adminClient.deleteClient(clientName);
|
||||
});
|
||||
|
||||
it("check effective protocol mappers list is not empty and find effective protocol mapper locale", () => {
|
||||
commonPage.tableToolbarUtils().searchItem(clientName);
|
||||
commonPage.tableUtils().clickRowItemLink(clientName);
|
||||
|
||||
clientDetailsPage.goToClientScopesEvaluateTab();
|
||||
|
||||
cy.findByTestId("effective-protocol-mappers")
|
||||
.find("tr")
|
||||
.should("have.length.gt", 0);
|
||||
});
|
||||
|
||||
it("check role scope mappings list list is not empty and find role scope mapping admin", () => {
|
||||
commonPage.tableToolbarUtils().searchItem(clientName);
|
||||
commonPage.tableUtils().clickRowItemLink(clientName);
|
||||
|
||||
clientDetailsPage.goToClientScopesEvaluateTab();
|
||||
clientDetailsPage.goToClientScopesEvaluateEffectiveRoleScopeMappingsTab();
|
||||
|
||||
cy.findByTestId("effective-role-scope-mappings")
|
||||
.find("tr")
|
||||
.should("have.length.gt", 0);
|
||||
});
|
||||
|
||||
it("check generated access token when user is not selected", () => {
|
||||
commonPage.tableToolbarUtils().searchItem(clientName);
|
||||
commonPage.tableUtils().clickRowItemLink(clientName);
|
||||
|
||||
clientDetailsPage.goToClientScopesEvaluateTab();
|
||||
clientDetailsPage.goToClientScopesEvaluateGeneratedAccessTokenTab();
|
||||
|
||||
cy.get("div#generatedAccessToken").contains("No generated access token");
|
||||
});
|
||||
|
||||
it("check generated id token when user is not selected", () => {
|
||||
commonPage.tableToolbarUtils().searchItem(clientName);
|
||||
commonPage.tableUtils().clickRowItemLink(clientName);
|
||||
|
||||
clientDetailsPage.goToClientScopesEvaluateTab();
|
||||
clientDetailsPage.goToClientScopesEvaluateGeneratedIdTokenTab();
|
||||
|
||||
cy.get("div#generatedIdToken").contains("No generated id token");
|
||||
});
|
||||
|
||||
it("check generated user info when user is not selected", () => {
|
||||
commonPage.tableToolbarUtils().searchItem(clientName);
|
||||
commonPage.tableUtils().clickRowItemLink(clientName);
|
||||
|
||||
clientDetailsPage.goToClientScopesEvaluateTab();
|
||||
clientDetailsPage.goToClientScopesEvaluateGeneratedUserInfoTab();
|
||||
|
||||
cy.get("div#generatedUserInfo").contains("No generated user info");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Client creation", () => {
|
||||
beforeEach(() => {
|
||||
loginPage.logIn();
|
||||
|
@ -1068,6 +1143,8 @@ describe("Clients test", () => {
|
|||
});
|
||||
|
||||
describe("Accessibility tests for clients", () => {
|
||||
const clientId = "a11y-client";
|
||||
|
||||
beforeEach(() => {
|
||||
loginPage.logIn();
|
||||
keycloakBefore();
|
||||
|
@ -1075,8 +1152,6 @@ describe("Clients test", () => {
|
|||
cy.injectAxe();
|
||||
});
|
||||
|
||||
const clientId = "a11y-client";
|
||||
|
||||
it("Check a11y violations on load/ clients list tab", () => {
|
||||
cy.checkA11y();
|
||||
});
|
||||
|
@ -1108,6 +1183,21 @@ describe("Clients test", () => {
|
|||
clientDetailsPage.goToClientScopesTab();
|
||||
cy.checkA11y();
|
||||
|
||||
clientDetailsPage.goToClientScopesEvaluateTab();
|
||||
cy.checkA11y();
|
||||
|
||||
clientDetailsPage.goToClientScopesEvaluateEffectiveRoleScopeMappingsTab();
|
||||
cy.checkA11y();
|
||||
|
||||
clientDetailsPage.goToClientScopesEvaluateGeneratedAccessTokenTab();
|
||||
cy.checkA11y();
|
||||
|
||||
clientDetailsPage.goToClientScopesEvaluateGeneratedIdTokenTab();
|
||||
cy.checkA11y();
|
||||
|
||||
clientDetailsPage.goToClientScopesEvaluateGeneratedUserInfoTab();
|
||||
cy.checkA11y();
|
||||
|
||||
clientDetailsPage.goToAdvancedTab();
|
||||
cy.checkA11y();
|
||||
});
|
||||
|
|
|
@ -6,8 +6,13 @@ export class ClientRegistrationPage extends CommonPage {
|
|||
return this;
|
||||
}
|
||||
|
||||
goToAuthenticatedSubTab() {
|
||||
cy.findAllByTestId("authenticated").click();
|
||||
return this;
|
||||
}
|
||||
|
||||
createPolicy() {
|
||||
cy.findAllByTestId("createPolicy").click();
|
||||
cy.findAllByTestId("createPolicy").click({ force: true });
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -17,7 +22,7 @@ export class ClientRegistrationPage extends CommonPage {
|
|||
}
|
||||
|
||||
fillPolicyForm(props: { name: string }) {
|
||||
cy.findAllByTestId("name").clear().type(props.name);
|
||||
cy.findAllByTestId("name").type(props.name);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,13 @@ export default class ClientDetailsPage extends CommonPage {
|
|||
#clientScopesTab = new ClientScopesTab();
|
||||
#authorizationTab = new AuthorizationTab();
|
||||
#advancedTab = new AdvancedTab();
|
||||
#clientScopesSetupTab = "clientScopesSetupTab";
|
||||
#clientScopesEvaluateTab = "clientScopesEvaluateTab";
|
||||
#evaluateEffectiveProtocolMappersTab = "effective-protocol-mappers-tab";
|
||||
#evaluateEffectiveRoleScopeMappingsTab = "effective-role-scope-mappings-tab";
|
||||
#evaluateGeneratedAccessTokenTab = "generated-access-token-tab";
|
||||
#evaluateGeneratedIdTokenTab = "generated-id-token-tab";
|
||||
#evaluateGeneratedUserInfoTab = "generated-user-info-tab";
|
||||
|
||||
goToSettingsTab() {
|
||||
this.tabUtils().clickTab(ClientsDetailsTab.Settings);
|
||||
|
@ -64,4 +71,40 @@ export default class ClientDetailsPage extends CommonPage {
|
|||
this.tabUtils().clickTab(ClientsDetailsTab.Advanced);
|
||||
return this.#advancedTab;
|
||||
}
|
||||
|
||||
goToClientScopesSetupTab() {
|
||||
cy.findByTestId(this.#clientScopesSetupTab).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
goToClientScopesEvaluateTab() {
|
||||
this.goToClientScopesTab();
|
||||
cy.findByTestId(this.#clientScopesEvaluateTab).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
goToClientScopesEvaluateEffectiveProtocolMappersTab() {
|
||||
cy.findByTestId(this.#evaluateEffectiveProtocolMappersTab).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
goToClientScopesEvaluateEffectiveRoleScopeMappingsTab() {
|
||||
cy.findByTestId(this.#evaluateEffectiveRoleScopeMappingsTab).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
goToClientScopesEvaluateGeneratedAccessTokenTab() {
|
||||
cy.findByTestId(this.#evaluateGeneratedAccessTokenTab).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
goToClientScopesEvaluateGeneratedIdTokenTab() {
|
||||
cy.findByTestId(this.#evaluateGeneratedIdTokenTab).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
goToClientScopesEvaluateGeneratedUserInfoTab() {
|
||||
cy.findByTestId(this.#evaluateGeneratedUserInfoTab).click();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import SetupTab from "./clientscopes_subtabs/SetupTab";
|
|||
import EvaluateTab from "./clientscopes_subtabs/EvaluateTab";
|
||||
import DedicatedScopesPage from "../DedicatedScopesPage";
|
||||
|
||||
enum ClientScopesSubTab {
|
||||
export enum ClientScopesSubTab {
|
||||
Setup = "Setup",
|
||||
Evaluate = "Evaluate",
|
||||
}
|
||||
|
|
|
@ -509,6 +509,7 @@ export default function ClientDetails() {
|
|||
>
|
||||
<Tab
|
||||
id="setup"
|
||||
data-testid="clientScopesSetupTab"
|
||||
title={<TabTitleText>{t("setup")}</TabTitleText>}
|
||||
{...clientScopesSetupTab}
|
||||
>
|
||||
|
@ -521,6 +522,7 @@ export default function ClientDetails() {
|
|||
</Tab>
|
||||
<Tab
|
||||
id="evaluate"
|
||||
data-testid="clientScopesEvaluateTab"
|
||||
title={<TabTitleText>{t("evaluate")}</TabTitleText>}
|
||||
{...clientScopesEvaluateTab}
|
||||
>
|
||||
|
|
|
@ -103,8 +103,9 @@ export const ClientRegistrationList = ({
|
|||
)}
|
||||
<DeleteConfirm />
|
||||
<KeycloakDataTable
|
||||
ariaLabelKey="initialAccessToken"
|
||||
searchPlaceholderKey="searchInitialAccessToken"
|
||||
ariaLabelKey="clientRegistration"
|
||||
searchPlaceholderKey="searchClientRegistration"
|
||||
data-testid={`clientRegistration-${subType}`}
|
||||
loader={policies}
|
||||
toolbarItem={
|
||||
<ToolbarItem>
|
||||
|
|
|
@ -59,6 +59,7 @@ const ProtocolMappers = ({
|
|||
loader={() => Promise.resolve(protocolMappers)}
|
||||
ariaLabelKey="effectiveProtocolMappers"
|
||||
searchPlaceholderKey="searchForProtocol"
|
||||
data-testid="effective-protocol-mappers"
|
||||
columns={[
|
||||
{
|
||||
name: "mapperName",
|
||||
|
@ -97,6 +98,7 @@ const EffectiveRoles = ({
|
|||
loader={() => Promise.resolve(effectiveRoles)}
|
||||
ariaLabelKey="effectiveRoleScopeMappings"
|
||||
searchPlaceholderKey="searchForRole"
|
||||
data-testid="effective-role-scope-mappings"
|
||||
columns={[
|
||||
{
|
||||
name: "name",
|
||||
|
@ -362,6 +364,7 @@ export const EvaluateScopes = ({ clientId, protocol }: EvaluateScopesProps) => {
|
|||
<Tab
|
||||
id="effectiveProtocolMappers"
|
||||
aria-controls="effectiveProtocolMappers"
|
||||
data-testid="effective-protocol-mappers-tab"
|
||||
eventKey={0}
|
||||
title={
|
||||
<TabTitleText>
|
||||
|
@ -379,6 +382,7 @@ export const EvaluateScopes = ({ clientId, protocol }: EvaluateScopesProps) => {
|
|||
<Tab
|
||||
id="effectiveRoleScopeMappings"
|
||||
aria-controls="effectiveRoleScopeMappings"
|
||||
data-testid="effective-role-scope-mappings-tab"
|
||||
eventKey={1}
|
||||
title={
|
||||
<TabTitleText>
|
||||
|
@ -396,6 +400,7 @@ export const EvaluateScopes = ({ clientId, protocol }: EvaluateScopesProps) => {
|
|||
<Tab
|
||||
id="generatedAccessToken"
|
||||
aria-controls="generatedAccessToken"
|
||||
data-testid="generated-access-token-tab"
|
||||
eventKey={2}
|
||||
title={
|
||||
<TabTitleText>
|
||||
|
@ -413,6 +418,7 @@ export const EvaluateScopes = ({ clientId, protocol }: EvaluateScopesProps) => {
|
|||
<Tab
|
||||
id="generatedIdToken"
|
||||
aria-controls="generatedIdToken"
|
||||
data-testid="generated-id-token-tab"
|
||||
eventKey={3}
|
||||
title={
|
||||
<TabTitleText>
|
||||
|
@ -430,6 +436,7 @@ export const EvaluateScopes = ({ clientId, protocol }: EvaluateScopesProps) => {
|
|||
<Tab
|
||||
id="generatedUserInfo"
|
||||
aria-controls="generatedUserInfo"
|
||||
data-testid="generated-user-info-tab"
|
||||
eventKey={4}
|
||||
title={
|
||||
<TabTitleText>
|
||||
|
|
Loading…
Reference in a new issue