Use JavaScript private class features (#24054)

Uses JavaScript [private class features](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields) over TypeScript's `private` keyword. Also introduces some ESLint configuration to enforce this rule throughout the project.
This commit is contained in:
Jon Koops 2023-10-23 20:12:55 +02:00 committed by GitHub
parent 9da57b1489
commit fefe2f57ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
88 changed files with 2191 additions and 2157 deletions

View file

@ -76,6 +76,15 @@ module.exports = {
],
},
],
// Prefer using the `#private` syntax for private class members, we want to keep this consistent and use the same syntax.
"no-restricted-syntax": [
"error",
{
selector:
':matches(PropertyDefinition, MethodDefinition)[accessibility="private"]',
message: "Use #private instead",
},
],
},
overrides: [
{

View file

@ -9,49 +9,49 @@ import TableUtils from "./admin-ui/components/TablePage";
import EmptyStatePage from "./admin-ui/components/EmptyStatePage";
export default class CommonPage {
private mastheadPage = new Masthead();
private sidebarPage = new SidebarPage();
private tabUtilsObj = new TabUtils();
private formUtilsObj = new FormUtils();
private modalUtilsObj = new ModalUtils();
private actionToolbarUtilsObj = new ActionToolbarUtils();
private tableUtilsObj = new TableUtils();
private tableToolbarUtilsObj = new TableToolbarUtils();
private emptyStatePage = new EmptyStatePage();
#mastheadPage = new Masthead();
#sidebarPage = new SidebarPage();
#tabUtilsObj = new TabUtils();
#formUtilsObj = new FormUtils();
#modalUtilsObj = new ModalUtils();
#actionToolbarUtilsObj = new ActionToolbarUtils();
#tableUtilsObj = new TableUtils();
#tableToolbarUtilsObj = new TableToolbarUtils();
#emptyStatePage = new EmptyStatePage();
masthead() {
return this.mastheadPage;
return this.#mastheadPage;
}
sidebar() {
return this.sidebarPage;
return this.#sidebarPage;
}
tabUtils() {
return this.tabUtilsObj;
return this.#tabUtilsObj;
}
formUtils() {
return this.formUtilsObj;
return this.#formUtilsObj;
}
modalUtils() {
return this.modalUtilsObj;
return this.#modalUtilsObj;
}
actionToolbarUtils() {
return this.actionToolbarUtilsObj;
return this.#actionToolbarUtilsObj;
}
tableUtils() {
return this.tableUtilsObj;
return this.#tableUtilsObj;
}
tableToolbarUtils() {
return this.tableToolbarUtilsObj;
return this.#tableToolbarUtilsObj;
}
emptyState() {
return this.emptyStatePage;
return this.#emptyStatePage;
}
}

View file

@ -1,13 +1,13 @@
export default class LoginPage {
private userNameInput = "#username";
private passwordInput = "#password";
private submitBtn = "#kc-login";
#userNameInput = "#username";
#passwordInput = "#password";
#submitBtn = "#kc-login";
private oldLoadContainer = "#loading";
private loadContainer = "div.keycloak__loading-container";
#oldLoadContainer = "#loading";
#loadContainer = "div.keycloak__loading-container";
isLogInPage() {
cy.get(this.userNameInput).should("exist");
cy.get(this.#userNameInput).should("exist");
cy.url().should("include", "/auth");
return this;
@ -19,17 +19,17 @@ export default class LoginPage {
() => {
cy.visit("/");
cy.get('[role="progressbar"]').should("not.exist");
cy.get(this.oldLoadContainer).should("not.exist");
cy.get(this.loadContainer).should("not.exist");
cy.get(this.#oldLoadContainer).should("not.exist");
cy.get(this.#loadContainer).should("not.exist");
cy.get("body")
.children()
.then((children) => {
if (children.length == 1) {
cy.get(this.userNameInput).type(userName);
cy.get(this.passwordInput).type(password);
cy.get(this.#userNameInput).type(userName);
cy.get(this.#passwordInput).type(password);
cy.get(this.submitBtn).click();
cy.get(this.#submitBtn).click();
}
});
},

View file

@ -1,8 +1,8 @@
export default class ListingPage {
private actionMenu = "action-dropdown";
#actionMenu = "action-dropdown";
clickAction(action: string) {
cy.findByTestId(this.actionMenu).click().findByTestId(action).click();
cy.findByTestId(this.#actionMenu).click().findByTestId(action).click();
return this;
}
}

View file

@ -1,52 +1,51 @@
export default class CreateRealmPage {
private clearBtn = ".pf-c-file-upload__file-select button:last-child";
private modalClearBtn = "clear-button";
private realmNameInput = "#kc-realm-name";
private enabledSwitch =
'[for="kc-realm-enabled-switch"] span.pf-c-switch__toggle';
private createBtn = '.pf-c-form__group:last-child button[type="submit"]';
private cancelBtn = '.pf-c-form__group:last-child button[type="button"]';
private codeEditor = ".pf-c-code-editor__code";
#clearBtn = ".pf-c-file-upload__file-select button:last-child";
#modalClearBtn = "clear-button";
#realmNameInput = "#kc-realm-name";
#enabledSwitch = '[for="kc-realm-enabled-switch"] span.pf-c-switch__toggle';
#createBtn = '.pf-c-form__group:last-child button[type="submit"]';
#cancelBtn = '.pf-c-form__group:last-child button[type="button"]';
#codeEditor = ".pf-c-code-editor__code";
fillRealmName(realmName: string) {
cy.get(this.realmNameInput).clear().type(realmName);
cy.get(this.#realmNameInput).clear().type(realmName);
return this;
}
fillCodeEditor() {
cy.get(this.codeEditor).click().type("clear this field");
cy.get(this.#codeEditor).click().type("clear this field");
return this;
}
createRealm() {
cy.get(this.createBtn).click();
cy.get(this.#createBtn).click();
return this;
}
disableRealm() {
cy.get(this.enabledSwitch).click();
cy.get(this.#enabledSwitch).click();
return this;
}
cancelRealmCreation() {
cy.get(this.cancelBtn).click();
cy.get(this.#cancelBtn).click();
return this;
}
clearTextField() {
cy.get(this.clearBtn).click();
cy.findByTestId(this.modalClearBtn).click();
cy.get(this.#clearBtn).click();
cy.findByTestId(this.#modalClearBtn).click();
return this;
}
verifyRealmNameFieldInvalid() {
cy.get(this.realmNameInput)
cy.get(this.#realmNameInput)
.next("div")
.contains("Required field")
.should("have.class", "pf-m-error");

View file

@ -28,65 +28,63 @@ export enum FilterSession {
}
export default class ListingPage extends CommonElements {
private searchInput =
#searchInput =
".pf-c-toolbar__item .pf-c-text-input-group__text-input:visible";
private tableToolbar = ".pf-c-toolbar";
private itemsRows = "table:visible";
private deleteUserButton = "delete-user-btn";
private emptyListImg =
'[role="tabpanel"]:not([hidden]) [data-testid="empty-state"]';
#tableToolbar = ".pf-c-toolbar";
#itemsRows = "table:visible";
#deleteUserButton = "delete-user-btn";
#emptyListImg = '[role="tabpanel"]:not([hidden]) [data-testid="empty-state"]';
public emptyState = "empty-state";
private itemRowDrpDwn = ".pf-c-dropdown__toggle";
private itemRowSelect = ".pf-c-select__toggle:nth-child(1)";
private itemRowSelectItem = ".pf-c-select__menu-item";
private itemCheckbox = ".pf-c-table__check";
#itemRowDrpDwn = ".pf-c-dropdown__toggle";
#itemRowSelect = ".pf-c-select__toggle:nth-child(1)";
#itemRowSelectItem = ".pf-c-select__menu-item";
#itemCheckbox = ".pf-c-table__check";
public exportBtn = '[role="menuitem"]:nth-child(1)';
public deleteBtn = '[role="menuitem"]:nth-child(2)';
private searchBtn =
#searchBtn =
".pf-c-page__main .pf-c-toolbar__content-section button.pf-m-control:visible";
private listHeaderPrimaryBtn =
#listHeaderPrimaryBtn =
".pf-c-page__main .pf-c-toolbar__content-section .pf-m-primary:visible";
private listHeaderSecondaryBtn =
#listHeaderSecondaryBtn =
".pf-c-page__main .pf-c-toolbar__content-section .pf-m-link";
private previousPageBtn =
#previousPageBtn =
"div[class=pf-c-pagination__nav-control] button[data-action=previous]:visible";
private nextPageBtn =
#nextPageBtn =
"div[class=pf-c-pagination__nav-control] button[data-action=next]:visible";
public tableRowItem = "tbody tr[data-ouia-component-type]:visible";
private table = "table[aria-label]";
private filterSessionDropdownButton = ".pf-c-select button:nth-child(1)";
private filterDropdownButton = "[class*='searchtype'] button";
private dropdownItem = ".pf-c-dropdown__menu-item";
private changeTypeToButton = ".pf-c-select__toggle";
private toolbarChangeType = "#change-type-dropdown";
private tableNameColumnPrefix = "name-column-";
private rowGroup = "table:visible tbody[role='rowgroup']";
private tableHeaderCheckboxItemAllRows =
"input[aria-label='Select all rows']";
#table = "table[aria-label]";
#filterSessionDropdownButton = ".pf-c-select button:nth-child(1)";
#filterDropdownButton = "[class*='searchtype'] button";
#dropdownItem = ".pf-c-dropdown__menu-item";
#changeTypeToButton = ".pf-c-select__toggle";
#toolbarChangeType = "#change-type-dropdown";
#tableNameColumnPrefix = "name-column-";
#rowGroup = "table:visible tbody[role='rowgroup']";
#tableHeaderCheckboxItemAllRows = "input[aria-label='Select all rows']";
private searchBtnInModal =
#searchBtnInModal =
".pf-c-modal-box .pf-c-toolbar__content-section button.pf-m-control:visible";
showPreviousPageTableItems() {
cy.get(this.previousPageBtn).first().click();
cy.get(this.#previousPageBtn).first().click();
return this;
}
showNextPageTableItems() {
cy.get(this.nextPageBtn).first().click();
cy.get(this.#nextPageBtn).first().click();
return this;
}
goToCreateItem() {
cy.get(this.listHeaderPrimaryBtn).click();
cy.get(this.#listHeaderPrimaryBtn).click();
return this;
}
goToImportItem() {
cy.get(this.listHeaderSecondaryBtn).click();
cy.get(this.#listHeaderSecondaryBtn).click();
return this;
}
@ -97,13 +95,13 @@ export default class ListingPage extends CommonElements {
cy.intercept(searchUrl).as("search");
}
cy.get(this.searchInput).clear();
cy.get(this.#searchInput).clear();
if (searchValue) {
cy.get(this.searchInput).type(searchValue);
cy.get(this.searchBtn).click({ force: true });
cy.get(this.#searchInput).type(searchValue);
cy.get(this.#searchBtn).click({ force: true });
} else {
// TODO: Remove else and move clickSearchButton outside of the if
cy.get(this.searchInput).type("{enter}");
cy.get(this.#searchInput).type("{enter}");
}
if (wait) {
@ -114,11 +112,11 @@ export default class ListingPage extends CommonElements {
}
searchItemInModal(searchValue: string) {
cy.get(this.searchInput).clear();
cy.get(this.#searchInput).clear();
if (searchValue) {
cy.get(this.searchInput).type(searchValue);
cy.get(this.#searchInput).type(searchValue);
}
cy.get(this.searchBtnInModal).click({ force: true });
cy.get(this.#searchBtnInModal).click({ force: true });
}
checkTableLength(length: number, identifier: string) {
@ -130,14 +128,14 @@ export default class ListingPage extends CommonElements {
}
clickSearchBarActionButton() {
cy.get(this.tableToolbar).find(this.itemRowDrpDwn).last().click();
cy.get(this.#tableToolbar).find(this.#itemRowDrpDwn).last().click();
return this;
}
clickSearchBarActionItem(itemName: string) {
cy.get(this.tableToolbar)
.find(this.dropdownItem)
cy.get(this.#tableToolbar)
.find(this.#dropdownItem)
.contains(itemName)
.click();
@ -145,16 +143,16 @@ export default class ListingPage extends CommonElements {
}
clickRowDetails(itemName: string) {
cy.get(this.itemsRows)
cy.get(this.#itemsRows)
.contains(itemName)
.parentsUntil("tbody")
.find(this.itemRowDrpDwn)
.find(this.#itemRowDrpDwn)
.click({ force: true });
return this;
}
markItemRow(itemName: string) {
cy.get(this.itemsRows)
cy.get(this.#itemsRows)
.contains(itemName)
.parentsUntil("tbody")
.find('input[name*="checkrow"]')
@ -163,12 +161,12 @@ export default class ListingPage extends CommonElements {
}
removeMarkedItems(name: string = "Remove") {
cy.get(this.listHeaderSecondaryBtn).contains(name).click();
cy.get(this.#listHeaderSecondaryBtn).contains(name).click();
return this;
}
checkRowColumnValue(itemName: string, column: number, value: string) {
cy.get(this.itemsRows)
cy.get(this.#itemsRows)
.contains(itemName)
.parentsUntil("tbody")
.find("td:nth-child(" + column + ")")
@ -177,48 +175,48 @@ export default class ListingPage extends CommonElements {
}
clickDetailMenu(name: string) {
cy.get(this.itemsRows).contains(name).click();
cy.get(this.#itemsRows).contains(name).click();
return this;
}
clickItemCheckbox(itemName: string) {
cy.get(this.itemsRows)
cy.get(this.#itemsRows)
.contains(itemName)
.parentsUntil("tbody")
.find(this.itemCheckbox)
.find(this.#itemCheckbox)
.click();
return this;
}
clickTableHeaderItemCheckboxAllRows() {
cy.get(this.tableHeaderCheckboxItemAllRows).click();
cy.get(this.#tableHeaderCheckboxItemAllRows).click();
return this;
}
clickRowSelectButton(itemName: string) {
cy.get(this.itemsRows)
cy.get(this.#itemsRows)
.contains(itemName)
.parentsUntil("tbody")
.find(this.itemRowSelect)
.find(this.#itemRowSelect)
.click();
return this;
}
clickPrimaryButton() {
cy.get(this.listHeaderPrimaryBtn).click();
cy.get(this.#listHeaderPrimaryBtn).click();
return this;
}
clickRowSelectItem(rowItemName: string, selectItemName: string) {
this.clickRowSelectButton(rowItemName);
cy.get(this.itemRowSelectItem).contains(selectItemName).click();
cy.get(this.#itemRowSelectItem).contains(selectItemName).click();
return this;
}
itemExist(itemName: string, exist = true) {
cy.get(this.itemsRows)
cy.get(this.#itemsRows)
.contains(itemName)
.should((!exist ? "not." : "") + "exist");
@ -226,13 +224,13 @@ export default class ListingPage extends CommonElements {
}
goToItemDetails(itemName: string) {
cy.get(this.itemsRows).contains(itemName).click();
cy.get(this.#itemsRows).contains(itemName).click();
return this;
}
checkEmptyList() {
cy.get(this.emptyListImg).should("be.visible");
cy.get(this.#emptyListImg).should("be.visible");
return this;
}
@ -253,7 +251,7 @@ export default class ListingPage extends CommonElements {
deleteItemFromSearchBar(itemName: string) {
this.markItemRow(itemName);
cy.findByTestId(this.deleteUserButton).click();
cy.findByTestId(this.#deleteUserButton).click();
return this;
}
@ -278,7 +276,7 @@ export default class ListingPage extends CommonElements {
}
itemContainValue(itemName: string, colIndex: number, value: string) {
cy.get(this.itemsRows)
cy.get(this.#itemsRows)
.contains(itemName)
.parentsUntil("tbody")
.find("td")
@ -289,15 +287,15 @@ export default class ListingPage extends CommonElements {
}
selectFilter(filter: Filter) {
cy.get(this.filterDropdownButton).first().click();
cy.get(this.dropdownItem).contains(filter).click();
cy.get(this.#filterDropdownButton).first().click();
cy.get(this.#dropdownItem).contains(filter).click();
return this;
}
selectSecondaryFilter(itemName: string) {
cy.get(this.filterDropdownButton).last().click();
cy.get(this.itemRowSelectItem).contains(itemName).click();
cy.get(this.#filterDropdownButton).last().click();
cy.get(this.#itemRowSelectItem).contains(itemName).click();
return this;
}
@ -315,32 +313,32 @@ export default class ListingPage extends CommonElements {
}
selectSecondaryFilterSession(sessionName: FilterSession) {
cy.get(this.filterSessionDropdownButton).click();
cy.get(this.itemRowSelectItem).contains(sessionName);
cy.get(this.#filterSessionDropdownButton).click();
cy.get(this.#itemRowSelectItem).contains(sessionName);
return this;
}
changeTypeToOfSelectedItems(assignedType: FilterAssignedType) {
cy.intercept("/admin/realms/master/client-scopes").as("load");
cy.get(this.toolbarChangeType).click();
cy.get(this.itemRowSelectItem).contains(assignedType).click();
cy.get(this.#toolbarChangeType).click();
cy.get(this.#itemRowSelectItem).contains(assignedType).click();
cy.wait("@load");
return this;
}
changeTypeToOfItem(assignedType: FilterAssignedType, itemName: string) {
cy.get(this.itemsRows)
cy.get(this.#itemsRows)
.contains(itemName)
.parentsUntil("tbody")
.find(this.changeTypeToButton)
.find(this.#changeTypeToButton)
.first()
.click();
cy.get(this.itemsRows)
cy.get(this.#itemsRows)
.contains(itemName)
.parentsUntil("tbody")
.find(this.changeTypeToButton)
.find(this.#changeTypeToButton)
.contains(assignedType)
.click();
@ -352,13 +350,13 @@ export default class ListingPage extends CommonElements {
if (!disabled) {
condition = "be.enabled";
}
cy.get(this.changeTypeToButton).first().should(condition);
cy.get(this.#changeTypeToButton).first().should(condition);
return this;
}
checkDropdownItemIsDisabled(itemName: string, disabled: boolean = true) {
cy.get(this.dropdownItem)
cy.get(this.#dropdownItem)
.contains(itemName)
.should("have.attr", "aria-disabled", String(disabled));
@ -370,17 +368,17 @@ export default class ListingPage extends CommonElements {
if (!exists) {
condition = "not.be.visible";
}
cy.get(this.table).should(condition);
cy.get(this.#table).should(condition);
return this;
}
private getResourceLink(name: string) {
return cy.findByTestId(this.tableNameColumnPrefix + name);
#getResourceLink(name: string) {
return cy.findByTestId(this.#tableNameColumnPrefix + name);
}
goToResourceDetails(name: string) {
this.getResourceLink(name).click();
this.#getResourceLink(name).click();
return this;
}
@ -390,37 +388,37 @@ export default class ListingPage extends CommonElements {
}
assertResource(name: string) {
this.getResourceLink(name).should("exist");
this.#getResourceLink(name).should("exist");
return this;
}
private getRowGroup(index = 0) {
return cy.get(this.rowGroup).eq(index);
#getRowGroup(index = 0) {
return cy.get(this.#rowGroup).eq(index);
}
expandRow(index = 0) {
this.getRowGroup(index)
this.#getRowGroup(index)
.find("[class='pf-c-button pf-m-plain'][id*='expandable']")
.click();
return this;
}
collapseRow(index = 0) {
this.getRowGroup(index)
this.#getRowGroup(index)
.find("[class='pf-c-button pf-m-plain pf-m-expanded'][id*='expandable']")
.click();
return this;
}
assertExpandedRowContainText(index = 0, text: string) {
this.getRowGroup(index)
this.#getRowGroup(index)
.find("tr[class='pf-c-table__expandable-row pf-m-expanded']")
.should("contain.text", text);
return this;
}
assertRowIsExpanded(index = 0, isExpanded: boolean) {
this.getRowGroup(index)
this.#getRowGroup(index)
.find("[class='pf-c-button pf-m-plain pf-m-expanded'][id*='expandable']")
.should((!isExpanded ? "not." : "") + "exist");
return this;

View file

@ -1,26 +1,25 @@
import CommonElements from "../CommonElements";
export default class Masthead extends CommonElements {
private logoBtn = ".pf-c-page__header-brand-link img";
private helpBtn = "#help";
private closeAlertMessageBtn = ".pf-c-alert__action button";
private closeLastAlertMessageBtn =
"li:first-child .pf-c-alert__action button";
#logoBtn = ".pf-c-page__header-brand-link img";
#helpBtn = "#help";
#closeAlertMessageBtn = ".pf-c-alert__action button";
#closeLastAlertMessageBtn = "li:first-child .pf-c-alert__action button";
private alertMessage = ".pf-c-alert__title";
private userDrpDwn = "#user-dropdown";
private userDrpDwnKebab = "#user-dropdown-kebab";
private globalAlerts = "global-alerts";
private documentationLink = "#link";
private backToAdminConsoleLink = "#landingReferrerLink";
private userDrpdwnItem = ".pf-c-dropdown__menu-item";
#alertMessage = ".pf-c-alert__title";
#userDrpDwn = "#user-dropdown";
#userDrpDwnKebab = "#user-dropdown-kebab";
#globalAlerts = "global-alerts";
#documentationLink = "#link";
#backToAdminConsoleLink = "#landingReferrerLink";
#userDrpdwnItem = ".pf-c-dropdown__menu-item";
private getAlertsContainer() {
return cy.findByTestId(this.globalAlerts);
#getAlertsContainer() {
return cy.findByTestId(this.#globalAlerts);
}
checkIsAdminUI() {
cy.get(this.logoBtn).should("exist");
cy.get(this.userDrpDwn).should("exist");
cy.get(this.#logoBtn).should("exist");
cy.get(this.#userDrpDwn).should("exist");
return this;
}
@ -34,7 +33,7 @@ export default class Masthead extends CommonElements {
}
toggleGlobalHelp() {
cy.get(this.helpBtn).click();
cy.get(this.#helpBtn).click();
cy.get("#enableHelp").click({ force: true });
}
@ -44,22 +43,22 @@ export default class Masthead extends CommonElements {
}
toggleMobileViewHelp() {
cy.get(this.userDrpdwnItem).contains("Help").click();
cy.get(this.#userDrpdwnItem).contains("Help").click();
return this;
}
clickRealmInfo() {
cy.get(this.userDrpdwnItem).contains("Realm info").click();
cy.get(this.#userDrpdwnItem).contains("Realm info").click();
return this;
}
clickGlobalHelp() {
cy.get(this.helpBtn).click();
cy.get(this.#helpBtn).click();
return this;
}
getDocumentationLink() {
return cy.get(this.documentationLink);
return cy.get(this.#documentationLink);
}
clickDocumentationLink() {
@ -71,7 +70,7 @@ export default class Masthead extends CommonElements {
}
goToAdminConsole() {
cy.get(this.backToAdminConsoleLink).click({ force: true });
cy.get(this.#backToAdminConsoleLink).click({ force: true });
return this;
}
@ -80,7 +79,7 @@ export default class Masthead extends CommonElements {
.document()
.then(({ documentElement }) => documentElement.getBoundingClientRect())
.then(({ width }) =>
cy.get(width < 1024 ? this.userDrpDwnKebab : this.userDrpDwn),
cy.get(width < 1024 ? this.#userDrpDwnKebab : this.#userDrpDwn),
);
}
@ -96,12 +95,12 @@ export default class Masthead extends CommonElements {
}
checkNotificationMessage(message: string, closeNotification = true) {
this.getAlertsContainer()
.find(this.alertMessage)
this.#getAlertsContainer()
.find(this.#alertMessage)
.should("contain.text", message);
if (closeNotification) {
this.getAlertsContainer()
this.#getAlertsContainer()
.find(`button[title="` + message.replaceAll('"', '\\"') + `"]`)
.last()
.click({ force: true });
@ -110,12 +109,12 @@ export default class Masthead extends CommonElements {
}
closeLastAlertMessage() {
this.getAlertsContainer().find(this.closeLastAlertMessageBtn).click();
this.#getAlertsContainer().find(this.#closeLastAlertMessageBtn).click();
return this;
}
closeAllAlertMessages() {
this.getAlertsContainer().find(this.closeAlertMessageBtn).click({
this.#getAlertsContainer().find(this.#closeAlertMessageBtn).click({
force: true,
multiple: true,
});
@ -124,15 +123,15 @@ export default class Masthead extends CommonElements {
}
assertIsDesktopView() {
cy.get(this.userDrpDwn).should("be.visible");
cy.get(this.userDrpDwnKebab).should("not.be.visible");
cy.get(this.#userDrpDwn).should("be.visible");
cy.get(this.#userDrpDwnKebab).should("not.be.visible");
return this;
}
assertIsMobileView() {
cy.get(this.userDrpDwn).should("not.be.visible");
cy.get(this.userDrpDwnKebab).should("be.visible");
cy.get(this.#userDrpDwn).should("not.be.visible");
cy.get(this.#userDrpDwnKebab).should("be.visible");
return this;
}

View file

@ -1,38 +1,38 @@
import CommonElements from "../CommonElements";
export default class SidebarPage extends CommonElements {
private realmsDrpDwn = "realmSelectorToggle";
private createRealmBtn = "add-realm";
#realmsDrpDwn = "realmSelectorToggle";
#createRealmBtn = "add-realm";
private clientsBtn = "#nav-item-clients";
private clientScopesBtn = "#nav-item-client-scopes";
private realmRolesBtn = "#nav-item-roles";
private usersBtn = "#nav-item-users";
private groupsBtn = "#nav-item-groups";
private sessionsBtn = "#nav-item-sessions";
private eventsBtn = "#nav-item-events";
#clientsBtn = "#nav-item-clients";
#clientScopesBtn = "#nav-item-client-scopes";
#realmRolesBtn = "#nav-item-roles";
#usersBtn = "#nav-item-users";
#groupsBtn = "#nav-item-groups";
#sessionsBtn = "#nav-item-sessions";
#eventsBtn = "#nav-item-events";
private realmSettingsBtn = "#nav-item-realm-settings";
private authenticationBtn = "#nav-item-authentication";
private identityProvidersBtn = "#nav-item-identity-providers";
private userFederationBtn = "#nav-item-user-federation";
#realmSettingsBtn = "#nav-item-realm-settings";
#authenticationBtn = "#nav-item-authentication";
#identityProvidersBtn = "#nav-item-identity-providers";
#userFederationBtn = "#nav-item-user-federation";
showCurrentRealms(length: number) {
cy.findByTestId(this.realmsDrpDwn).click();
cy.findByTestId(this.#realmsDrpDwn).click();
cy.get('[data-testid="realmSelector"] li').should(
"have.length",
length + 1, // account for button
);
cy.findByTestId(this.realmsDrpDwn).click({ force: true });
cy.findByTestId(this.#realmsDrpDwn).click({ force: true });
}
getCurrentRealm() {
return cy.findByTestId(this.realmsDrpDwn).scrollIntoView().invoke("text");
return cy.findByTestId(this.#realmsDrpDwn).scrollIntoView().invoke("text");
}
goToRealm(realmName: string) {
this.waitForPageLoad();
cy.findByTestId(this.realmsDrpDwn)
cy.findByTestId(this.#realmsDrpDwn)
.click()
.parent()
.contains(realmName)
@ -44,8 +44,8 @@ export default class SidebarPage extends CommonElements {
goToCreateRealm() {
this.waitForPageLoad();
cy.findByTestId(this.realmsDrpDwn).click();
cy.findByTestId(this.createRealmBtn).click();
cy.findByTestId(this.#realmsDrpDwn).click();
cy.findByTestId(this.#createRealmBtn).click();
this.waitForPageLoad();
return this;
@ -53,7 +53,7 @@ export default class SidebarPage extends CommonElements {
goToClients() {
this.waitForPageLoad();
cy.get(this.clientsBtn).click({ force: true });
cy.get(this.#clientsBtn).click({ force: true });
this.waitForPageLoad();
return this;
@ -61,14 +61,14 @@ export default class SidebarPage extends CommonElements {
goToClientScopes() {
this.waitForPageLoad();
cy.get(this.clientScopesBtn).click();
cy.get(this.#clientScopesBtn).click();
this.waitForPageLoad();
return this;
}
goToRealmRoles() {
cy.get(this.realmRolesBtn).click();
cy.get(this.#realmRolesBtn).click();
this.waitForPageLoad();
return this;
@ -76,7 +76,7 @@ export default class SidebarPage extends CommonElements {
goToUsers() {
this.waitForPageLoad();
cy.get(this.usersBtn).click();
cy.get(this.#usersBtn).click();
this.waitForPageLoad();
return this;
@ -84,7 +84,7 @@ export default class SidebarPage extends CommonElements {
goToGroups() {
this.waitForPageLoad();
cy.get(this.groupsBtn).click();
cy.get(this.#groupsBtn).click();
this.waitForPageLoad();
return this;
@ -92,7 +92,7 @@ export default class SidebarPage extends CommonElements {
goToSessions() {
this.waitForPageLoad();
cy.get(this.sessionsBtn).click();
cy.get(this.#sessionsBtn).click();
this.waitForPageLoad();
return this;
@ -100,7 +100,7 @@ export default class SidebarPage extends CommonElements {
goToEvents() {
this.waitForPageLoad();
cy.get(this.eventsBtn).click();
cy.get(this.#eventsBtn).click();
this.waitForPageLoad();
return this;
@ -108,7 +108,7 @@ export default class SidebarPage extends CommonElements {
goToRealmSettings() {
this.waitForPageLoad();
cy.get(this.realmSettingsBtn).click({ force: true });
cy.get(this.#realmSettingsBtn).click({ force: true });
this.waitForPageLoad();
return this;
@ -116,7 +116,7 @@ export default class SidebarPage extends CommonElements {
goToAuthentication() {
this.waitForPageLoad();
cy.get(this.authenticationBtn).click();
cy.get(this.#authenticationBtn).click();
this.waitForPageLoad();
return this;
@ -124,7 +124,7 @@ export default class SidebarPage extends CommonElements {
goToIdentityProviders() {
this.waitForPageLoad();
cy.get(this.identityProvidersBtn).click();
cy.get(this.#identityProvidersBtn).click();
this.waitForPageLoad();
return this;
@ -132,7 +132,7 @@ export default class SidebarPage extends CommonElements {
goToUserFederation() {
this.waitForPageLoad();
cy.get(this.userFederationBtn).click();
cy.get(this.#userFederationBtn).click();
this.waitForPageLoad();
return this;
@ -144,6 +144,6 @@ export default class SidebarPage extends CommonElements {
}
checkRealmSettingsLinkContainsText(expectedText: string) {
cy.get(this.realmSettingsBtn).should("contain", expectedText);
cy.get(this.#realmSettingsBtn).should("contain", expectedText);
}
}

View file

@ -20,18 +20,18 @@ export default class ActionToolbarPage extends CommonElements {
return this;
}
private getDropdownItem(itemName: string) {
#getDropdownItem(itemName: string) {
return cy.get(this.dropdownMenuItem).contains(itemName);
}
checkActionItemExists(itemName: string, exists: boolean) {
const condition = exists ? "exist" : "not.exist";
this.getDropdownItem(itemName).should(condition);
this.#getDropdownItem(itemName).should(condition);
return this;
}
clickDropdownItem(itemName: string) {
this.getDropdownItem(itemName).click();
this.#getDropdownItem(itemName).click();
return this;
}
}

View file

@ -1,19 +1,19 @@
export default class PageObject {
private selectItemSelectedIcon = ".pf-c-select__menu-item-icon";
private drpDwnMenuList = ".pf-c-dropdown__menu";
private drpDwnMenuItem = ".pf-c-dropdown__menu-item";
private drpDwnMenuToggleBtn = ".pf-c-dropdown__toggle";
private selectMenuList = ".pf-c-select__menu";
private selectMenuItem = ".pf-c-select__menu-item";
private selectMenuToggleBtn = ".pf-c-select__toggle";
private switchInput = ".pf-c-switch__input";
private formLabel = ".pf-c-form__label";
private chipGroup = ".pf-c-chip-group";
private chipGroupCloseBtn = ".pf-c-chip-group__close";
private chipItem = ".pf-c-chip-group__list-item";
private emptyStateDiv = ".pf-c-empty-state:visible";
private toolbarActionsButton = ".pf-c-toolbar button[aria-label='Actions']";
private breadcrumbItem = ".pf-c-breadcrumb .pf-c-breadcrumb__item";
#selectItemSelectedIcon = ".pf-c-select__menu-item-icon";
#drpDwnMenuList = ".pf-c-dropdown__menu";
#drpDwnMenuItem = ".pf-c-dropdown__menu-item";
#drpDwnMenuToggleBtn = ".pf-c-dropdown__toggle";
#selectMenuList = ".pf-c-select__menu";
#selectMenuItem = ".pf-c-select__menu-item";
#selectMenuToggleBtn = ".pf-c-select__toggle";
#switchInput = ".pf-c-switch__input";
#formLabel = ".pf-c-form__label";
#chipGroup = ".pf-c-chip-group";
#chipGroupCloseBtn = ".pf-c-chip-group__close";
#chipItem = ".pf-c-chip-group__list-item";
#emptyStateDiv = ".pf-c-empty-state:visible";
#toolbarActionsButton = ".pf-c-toolbar button[aria-label='Actions']";
#breadcrumbItem = ".pf-c-breadcrumb .pf-c-breadcrumb__item";
protected assertExist(element: Cypress.Chainable<JQuery>, exist: boolean) {
element.should((!exist ? "not." : "") + "exist");
@ -63,7 +63,7 @@ export default class PageObject {
element?: Cypress.Chainable<JQuery>,
isOn = true,
) {
(element ?? cy.get(this.switchInput))
(element ?? cy.get(this.#switchInput))
.parent()
.contains(isOn ? "On" : "Off")
.should("be.visible");
@ -78,14 +78,14 @@ export default class PageObject {
isOpen = true,
element?: Cypress.Chainable<JQuery>,
) {
this.assertExist(element ?? cy.get(this.drpDwnMenuList), isOpen);
this.assertExist(element ?? cy.get(this.#drpDwnMenuList), isOpen);
return this;
}
protected assertDropdownMenuIsClosed(element?: Cypress.Chainable<JQuery>) {
return this.assertDropdownMenuIsOpen(
false,
element ?? cy.get(this.drpDwnMenuList),
element ?? cy.get(this.#drpDwnMenuList),
);
}
@ -93,7 +93,7 @@ export default class PageObject {
itemName: string,
element?: Cypress.Chainable<JQuery>,
) {
(element ?? cy.get(this.drpDwnMenuItem).contains(itemName)).click();
(element ?? cy.get(this.#drpDwnMenuItem).contains(itemName)).click();
return this;
}
@ -103,7 +103,7 @@ export default class PageObject {
) {
element =
element ??
cy.get(this.drpDwnMenuToggleBtn).contains(itemName).parent().parent();
cy.get(this.#drpDwnMenuToggleBtn).contains(itemName).parent().parent();
element.click();
return this;
}
@ -114,7 +114,7 @@ export default class PageObject {
) {
element =
element ??
cy.get(this.drpDwnMenuToggleBtn).contains(itemName).parent().parent();
cy.get(this.#drpDwnMenuToggleBtn).contains(itemName).parent().parent();
this.clickDropdownMenuToggleButton(itemName, element);
this.assertDropdownMenuIsOpen(true);
return this;
@ -126,7 +126,7 @@ export default class PageObject {
) {
element =
element ??
cy.get(this.drpDwnMenuToggleBtn).contains(itemName).parent().parent();
cy.get(this.#drpDwnMenuToggleBtn).contains(itemName).parent().parent();
this.clickDropdownMenuToggleButton(itemName, element);
this.assertDropdownMenuIsOpen(false);
return this;
@ -137,9 +137,9 @@ export default class PageObject {
isSelected: boolean,
element?: Cypress.Chainable<JQuery>,
) {
element = element ?? cy.get(this.drpDwnMenuItem);
element = element ?? cy.get(this.#drpDwnMenuItem);
this.assertExist(
element.contains(itemName).find(this.selectItemSelectedIcon),
element.contains(itemName).find(this.#selectItemSelectedIcon),
isSelected,
);
return this;
@ -151,8 +151,8 @@ export default class PageObject {
) {
const initialElement = element;
for (const item of items) {
element = initialElement ?? cy.get(this.drpDwnMenuList);
this.assertExist(element.find(this.drpDwnMenuItem).contains(item), true);
element = initialElement ?? cy.get(this.#drpDwnMenuList);
this.assertExist(element.find(this.#drpDwnMenuItem).contains(item), true);
}
return this;
}
@ -163,8 +163,8 @@ export default class PageObject {
) {
const initialElement = element;
for (const item of items) {
element = initialElement ?? cy.get(this.drpDwnMenuList);
this.assertExist(element.find(this.formLabel).contains(item), true);
element = initialElement ?? cy.get(this.#drpDwnMenuList);
this.assertExist(element.find(this.#formLabel).contains(item), true);
}
return this;
}
@ -173,8 +173,8 @@ export default class PageObject {
number: number,
element?: Cypress.Chainable<JQuery>,
) {
element = element ?? cy.get(this.drpDwnMenuList);
element.find(this.drpDwnMenuItem).should(($item) => {
element = element ?? cy.get(this.#drpDwnMenuList);
element.find(this.#drpDwnMenuItem).should(($item) => {
expect($item).to.have.length(number);
});
return this;
@ -184,12 +184,12 @@ export default class PageObject {
isOpen = true,
element?: Cypress.Chainable<JQuery>,
) {
element = element ?? cy.get(this.selectMenuList);
element = element ?? cy.get(this.#selectMenuList);
return this.assertDropdownMenuIsOpen(isOpen, element);
}
protected assertSelectMenuIsClosed(element?: Cypress.Chainable<JQuery>) {
element = element ?? cy.get(this.selectMenuList);
element = element ?? cy.get(this.#selectMenuList);
return this.assertDropdownMenuIsClosed(element);
}
@ -199,7 +199,7 @@ export default class PageObject {
) {
element =
element ??
cy.get(this.selectMenuItem).contains(new RegExp(`^${itemName}$`));
cy.get(this.#selectMenuItem).contains(new RegExp(`^${itemName}$`));
return this.clickDropdownMenuItem(itemName, element);
}
@ -209,14 +209,14 @@ export default class PageObject {
) {
element =
element ??
cy.get(this.selectMenuToggleBtn).contains(itemName).parent().parent();
cy.get(this.#selectMenuToggleBtn).contains(itemName).parent().parent();
return this.clickDropdownMenuToggleButton(itemName, element);
}
protected openSelectMenu(itemName: string, element?: Cypress.Chainable<any>) {
element =
element ??
cy.get(this.selectMenuToggleBtn).contains(itemName).parent().parent();
cy.get(this.#selectMenuToggleBtn).contains(itemName).parent().parent();
this.clickDropdownMenuToggleButton(itemName, element);
this.assertSelectMenuIsOpen(true);
return this;
@ -228,7 +228,7 @@ export default class PageObject {
) {
element =
element ??
cy.get(this.selectMenuToggleBtn).contains(itemName).parent().parent();
cy.get(this.#selectMenuToggleBtn).contains(itemName).parent().parent();
this.clickDropdownMenuToggleButton(itemName, element);
this.assertSelectMenuIsOpen(false);
return this;
@ -239,7 +239,7 @@ export default class PageObject {
isSelected: boolean,
element?: Cypress.Chainable<JQuery>,
) {
element = element ?? cy.get(this.selectMenuItem);
element = element ?? cy.get(this.#selectMenuItem);
return this.assertDropdownMenuItemIsSelected(itemName, isSelected, element);
}
@ -249,8 +249,8 @@ export default class PageObject {
) {
const initialElement = element;
for (const item of items) {
element = initialElement ?? cy.get(this.selectMenuList);
this.assertExist(element.find(this.selectMenuItem).contains(item), true);
element = initialElement ?? cy.get(this.#selectMenuList);
this.assertExist(element.find(this.#selectMenuItem).contains(item), true);
}
return this;
}
@ -259,59 +259,59 @@ export default class PageObject {
number: number,
element?: Cypress.Chainable<JQuery>,
) {
element = element ?? cy.get(this.selectMenuList);
element.find(this.selectMenuItem).should(($item) => {
element = element ?? cy.get(this.#selectMenuList);
element.find(this.#selectMenuItem).should(($item) => {
expect($item).to.have.length(number);
});
return this;
}
private getChipGroup(groupName: string) {
return cy.get(this.chipGroup).contains(groupName).parent().parent();
#getChipGroup(groupName: string) {
return cy.get(this.#chipGroup).contains(groupName).parent().parent();
}
private getChipItem(itemName: string) {
return cy.get(this.chipItem).contains(itemName).parent();
#getChipItem(itemName: string) {
return cy.get(this.#chipItem).contains(itemName).parent();
}
private getChipGroupItem(groupName: string, itemName: string) {
return this.getChipGroup(groupName)
.find(this.chipItem)
#getChipGroupItem(groupName: string, itemName: string) {
return this.#getChipGroup(groupName)
.find(this.#chipItem)
.contains(itemName)
.parent();
}
protected removeChipGroup(groupName: string) {
this.getChipGroup(groupName)
.find(this.chipGroupCloseBtn)
this.#getChipGroup(groupName)
.find(this.#chipGroupCloseBtn)
.find("button")
.click();
return this;
}
protected removeChipItem(itemName: string) {
this.getChipItem(itemName).find("button").click();
this.#getChipItem(itemName).find("button").click();
return this;
}
protected removeChipGroupItem(groupName: string, itemName: string) {
this.getChipGroupItem(groupName, itemName).find("button").click();
this.#getChipGroupItem(groupName, itemName).find("button").click();
return this;
}
protected assertChipGroupExist(groupName: string, exist: boolean) {
this.assertExist(cy.contains(this.chipGroup, groupName), exist);
this.assertExist(cy.contains(this.#chipGroup, groupName), exist);
return this;
}
protected clickToolbarAction(itemName: string) {
cy.get(this.toolbarActionsButton).click();
cy.get(this.#toolbarActionsButton).click();
this.clickDropdownMenuItem(itemName);
return this;
}
protected assertChipItemExist(itemName: string, exist: boolean) {
cy.get(this.chipItem).within(() => {
cy.get(this.#chipItem).within(() => {
cy.contains(itemName).should((exist ? "" : "not.") + "exist");
});
return this;
@ -323,7 +323,7 @@ export default class PageObject {
exist: boolean,
) {
this.assertExist(
this.getChipGroup(groupName).contains(this.chipItem, itemName),
this.#getChipGroup(groupName).contains(this.#chipItem, itemName),
exist,
);
return this;
@ -331,15 +331,15 @@ export default class PageObject {
protected assertEmptyStateExist(exist: boolean) {
if (exist) {
cy.get(this.emptyStateDiv).should("exist").should("be.visible");
cy.get(this.#emptyStateDiv).should("exist").should("be.visible");
} else {
cy.get(this.emptyStateDiv).should("not.exist");
cy.get(this.#emptyStateDiv).should("not.exist");
}
return this;
}
protected clickBreadcrumbItem(itemName: string) {
cy.get(this.breadcrumbItem).contains(itemName).click();
cy.get(this.#breadcrumbItem).contains(itemName).click();
return this;
}

View file

@ -10,7 +10,7 @@ export default class TabPage extends CommonElements {
this.tabsList = '[role="tablist"]';
}
private getTab(tabName: string, index: number | undefined = 0) {
#getTab(tabName: string, index: number | undefined = 0) {
return cy
.get(this.parentSelector)
.eq(index)
@ -19,13 +19,13 @@ export default class TabPage extends CommonElements {
}
clickTab(tabName: string, index: number | undefined = 0) {
this.getTab(tabName, index).click();
this.#getTab(tabName, index).click();
this.checkIsCurrentTab(tabName, index);
return this;
}
checkIsCurrentTab(tabName: string, index: number | undefined = 0) {
this.getTab(tabName, index).parent().should("have.class", "pf-m-current");
this.#getTab(tabName, index).parent().should("have.class", "pf-m-current");
return this;
}
@ -35,7 +35,7 @@ export default class TabPage extends CommonElements {
index: number | undefined = 0,
) {
const condition = exists ? "exist" : "not.exist";
this.getTab(tabName, index).should(condition);
this.#getTab(tabName, index).should(condition);
return this;
}

View file

@ -1,44 +1,42 @@
import CommonElements from "../../CommonElements";
export default class TablePage extends CommonElements {
private tableRowItem: string;
private tableRowItemChckBx: string;
private tableHeaderRowItem: string;
private tableInModal: boolean;
#tableRowItem: string;
#tableRowItemChckBx: string;
#tableHeaderRowItem: string;
#tableInModal: boolean;
static tableSelector = "table[aria-label]";
constructor(parentElement?: string) {
if (parentElement) {
super(parentElement);
} else {
super(TablePage.tableSelector + ":visible");
}
this.tableRowItem =
super(parentElement ?? TablePage.tableSelector + ":visible");
this.#tableRowItem =
this.parentSelector + "tbody tr[data-ouia-component-type]";
this.tableHeaderRowItem =
this.#tableHeaderRowItem =
this.parentSelector + "thead tr[data-ouia-component-type]";
this.tableRowItemChckBx = ".pf-c-table__check";
this.tableInModal = false;
this.#tableRowItemChckBx = ".pf-c-table__check";
this.#tableInModal = false;
}
setTableInModal(value: boolean) {
this.tableInModal = value;
this.#tableInModal = value;
}
selectRowItemCheckbox(itemName: string) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") + this.tableRowItem,
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableRowItem,
)
.contains(itemName)
.parentsUntil("tbody")
.find(this.tableRowItemChckBx)
.find(this.#tableRowItemChckBx)
.click();
return this;
}
clickRowItemLink(itemName: string) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") + this.tableRowItem,
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableRowItem,
)
.contains(itemName)
.click();
@ -47,7 +45,8 @@ export default class TablePage extends CommonElements {
selectRowItemAction(itemName: string, actionItemName: string) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") + this.tableRowItem,
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableRowItem,
)
.contains(itemName)
.parentsUntil("tbody")
@ -59,8 +58,8 @@ export default class TablePage extends CommonElements {
typeValueToRowItem(row: number, column: number, value: string) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.tableRowItem +
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableRowItem +
":nth-child(" +
row +
")",
@ -72,8 +71,8 @@ export default class TablePage extends CommonElements {
clickRowItemByIndex(row: number, column: number, appendChildren?: string) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.tableRowItem +
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableRowItem +
":nth-child(" +
row +
")",
@ -89,7 +88,8 @@ export default class TablePage extends CommonElements {
appendChildren?: string,
) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") + this.tableRowItem,
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableRowItem,
)
.find("td:nth-child(" + column + ") " + appendChildren)
.contains(itemName)
@ -99,8 +99,8 @@ export default class TablePage extends CommonElements {
clickHeaderItem(column: number, appendChildren?: string) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.tableHeaderRowItem,
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableHeaderRowItem,
)
.find("td:nth-child(" + column + ") " + appendChildren)
.click();
@ -109,7 +109,8 @@ export default class TablePage extends CommonElements {
checkRowItemsEqualTo(amount: number) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") + this.tableRowItem,
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableRowItem,
)
.its("length")
.should("be.eq", amount);
@ -118,7 +119,8 @@ export default class TablePage extends CommonElements {
checkRowItemsGreaterThan(amount: number) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") + this.tableRowItem,
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableRowItem,
)
.its("length")
.should("be.gt", amount);
@ -127,7 +129,8 @@ export default class TablePage extends CommonElements {
checkRowItemExists(itemName: string, exist = true) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") + this.tableRowItem,
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableRowItem,
)
.contains(itemName)
.should((!exist ? "not." : "") + "exist");
@ -136,7 +139,8 @@ export default class TablePage extends CommonElements {
checkRowItemValueByItemName(itemName: string, column: number, value: string) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") + this.tableRowItem,
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableRowItem,
)
.contains(itemName)
.parentsUntil("tbody")
@ -152,8 +156,8 @@ export default class TablePage extends CommonElements {
appendChildren?: string,
) {
cy.get(
(this.tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.tableRowItem +
(this.#tableInModal ? ".pf-c-modal-box.pf-m-md " : "") +
this.#tableRowItem +
":nth-child(" +
row +
")",

View file

@ -2,57 +2,58 @@ import CommonElements from "../../CommonElements";
import type { Filter, FilterAssignedType } from "../ListingPage";
export default class TableToolbar extends CommonElements {
private searchBtn: string;
private searchInput: string;
private changeTypeBtn: string;
private nextPageBtn: string;
private previousPageBtn: string;
private searchTypeDropdownBtn: string;
private searchTypeSelectToggleBtn: string;
private actionToggleBtn: string;
#searchBtn: string;
#searchInput: string;
#changeTypeBtn: string;
#nextPageBtn: string;
#previousPageBtn: string;
#searchTypeDropdownBtn: string;
#searchTypeSelectToggleBtn: string;
#actionToggleBtn: string;
constructor() {
super(".pf-c-toolbar:visible");
this.searchBtn =
this.#searchBtn =
this.parentSelector + "button[aria-label='Search']:visible";
this.searchInput =
this.#searchInput =
this.parentSelector + ".pf-c-text-input-group__text-input:visible";
this.changeTypeBtn = this.parentSelector + "#change-type-dropdown";
this.nextPageBtn = this.parentSelector + "button[data-action=next]";
this.previousPageBtn = this.parentSelector + "button[data-action=previous]";
this.searchTypeDropdownBtn =
this.#changeTypeBtn = this.parentSelector + "#change-type-dropdown";
this.#nextPageBtn = this.parentSelector + "button[data-action=next]";
this.#previousPageBtn =
this.parentSelector + "button[data-action=previous]";
this.#searchTypeDropdownBtn =
this.parentSelector + "[class*='searchtype'] .pf-c-dropdown__toggle";
this.searchTypeSelectToggleBtn =
this.#searchTypeSelectToggleBtn =
this.parentSelector + "[class*='searchtype'] .pf-c-select__toggle";
this.actionToggleBtn = this.dropdownToggleBtn + "[aria-label='Actions']";
this.#actionToggleBtn = this.dropdownToggleBtn + "[aria-label='Actions']";
}
clickNextPageButton(isUpperButton = true) {
if (isUpperButton) {
cy.get(this.nextPageBtn).first().click();
cy.get(this.#nextPageBtn).first().click();
} else {
cy.get(this.nextPageBtn).last().click();
cy.get(this.#nextPageBtn).last().click();
}
return this;
}
clickPreviousPageButton(isUpperButton = true) {
if (isUpperButton) {
cy.get(this.previousPageBtn).first().click();
cy.get(this.#previousPageBtn).first().click();
} else {
cy.get(this.previousPageBtn).last().click();
cy.get(this.#previousPageBtn).last().click();
}
return this;
}
clickActionItem(actionItemName: string) {
cy.get(this.actionToggleBtn).click();
cy.get(this.#actionToggleBtn).click();
cy.get(this.dropdownMenuItem).contains(actionItemName).click();
return this;
}
clickSearchButton() {
cy.get(this.searchBtn).click({ force: true });
cy.get(this.#searchBtn).click({ force: true });
return this;
}
@ -75,13 +76,13 @@ export default class TableToolbar extends CommonElements {
const searchUrl = `/admin/realms/master/*${searchValue}*`;
cy.intercept(searchUrl).as("search");
}
cy.get(this.searchInput).clear();
cy.get(this.#searchInput).clear();
if (searchValue) {
cy.get(this.searchInput).type(searchValue);
cy.get(this.#searchInput).type(searchValue);
this.clickSearchButton();
} else {
// TODO: Remove else and move clickSearchButton outside of the if
cy.get(this.searchInput).type("{enter}");
cy.get(this.#searchInput).type("{enter}");
}
if (wait) {
cy.wait(["@search"]);
@ -90,19 +91,19 @@ export default class TableToolbar extends CommonElements {
}
selectSearchType(itemName: Filter) {
cy.get(this.searchTypeDropdownBtn).click();
cy.get(this.#searchTypeDropdownBtn).click();
cy.get(this.dropdownMenuItem).contains(itemName).click();
return this;
}
selectSecondarySearchType(itemName: FilterAssignedType) {
cy.get(this.searchTypeSelectToggleBtn).click();
cy.get(this.#searchTypeSelectToggleBtn).click();
cy.get(this.dropdownSelectToggleItem).contains(itemName).click();
return this;
}
changeTypeTo(itemName: FilterAssignedType) {
cy.get(this.changeTypeBtn).click();
cy.get(this.#changeTypeBtn).click();
cy.get(this.dropdownSelectToggleItem).contains(itemName).click();
return this;
}
@ -123,11 +124,11 @@ export default class TableToolbar extends CommonElements {
}
checkActionItemIsEnabled(actionItemName: string, enabled: boolean) {
cy.get(this.actionToggleBtn).click();
cy.get(this.#actionToggleBtn).click();
cy.get(this.dropdownMenuItem)
.contains(actionItemName)
.should((!enabled ? "not." : "") + "be.disabled");
cy.get(this.actionToggleBtn).click();
cy.get(this.#actionToggleBtn).click();
return this;
}
}

View file

@ -1,8 +1,8 @@
export default class GroupModal {
private openPartialImport = "openPartialImportModal";
#openPartialImport = "openPartialImportModal";
open() {
cy.findByTestId(this.openPartialImport).click();
cy.findByTestId(this.#openPartialImport).click();
return this;
}

View file

@ -1,8 +1,8 @@
export default class RealmSettings {
private actionDropdown = "action-dropdown";
#actionDropdown = "action-dropdown";
clickActionMenu() {
cy.findByTestId(this.actionDropdown).click();
cy.findByTestId(this.#actionDropdown).click();
return this;
}
}

View file

@ -1,14 +1,14 @@
export default class AttributesTab {
private saveAttributeBtn = "save-attributes";
private addAttributeBtn = "attributes-add-row";
private attributesTab = "attributes";
private keyInput = "attributes-key";
private valueInput = "attributes-value";
private removeBtn = "attributes-remove";
private emptyState = "attributes-empty-state";
#saveAttributeBtn = "save-attributes";
#addAttributeBtn = "attributes-add-row";
#attributesTab = "attributes";
#keyInput = "attributes-key";
#valueInput = "attributes-value";
#removeBtn = "attributes-remove";
#emptyState = "attributes-empty-state";
public goToAttributesTab() {
cy.findByTestId(this.attributesTab).click();
cy.findByTestId(this.#attributesTab).click();
return this;
}
@ -16,18 +16,18 @@ export default class AttributesTab {
public addAttribute(key: string, value: string) {
this.addAnAttributeButton();
cy.findAllByTestId(this.keyInput)
cy.findAllByTestId(this.#keyInput)
.its("length")
.then((length) => {
this.keyInputAt(length - 1).type(key, { force: true });
this.valueInputAt(length - 1).type(value, { force: true });
this.#keyInputAt(length - 1).type(key, { force: true });
this.#valueInputAt(length - 1).type(value, { force: true });
});
return this;
}
public save() {
cy.findByTestId(this.saveAttributeBtn).click();
cy.findByTestId(this.#saveAttributeBtn).click();
return this;
}
@ -37,13 +37,13 @@ export default class AttributesTab {
}
public deleteAttributeButton(row: number) {
this.removeButtonAt(row).click({ force: true });
this.#removeButtonAt(row).click({ force: true });
return this;
}
public addAnAttributeButton() {
cy.wait(1000);
cy.findByTestId(this.addAttributeBtn).click();
cy.findByTestId(this.#addAttributeBtn).click();
return this;
}
@ -55,23 +55,23 @@ export default class AttributesTab {
}
public assertEmpty() {
cy.findByTestId(this.emptyState).should("exist");
cy.findByTestId(this.#emptyState).should("exist");
}
public assertRowItemsEqualTo(amount: number) {
cy.findAllByTestId(this.keyInput).its("length").should("be.eq", amount);
cy.findAllByTestId(this.#keyInput).its("length").should("be.eq", amount);
return this;
}
private keyInputAt(index: number) {
return cy.findAllByTestId(this.keyInput).eq(index);
#keyInputAt(index: number) {
return cy.findAllByTestId(this.#keyInput).eq(index);
}
private valueInputAt(index: number) {
return cy.findAllByTestId(this.valueInput).eq(index);
#valueInputAt(index: number) {
return cy.findAllByTestId(this.#valueInput).eq(index);
}
private removeButtonAt(index: number) {
return cy.findAllByTestId(this.removeBtn).eq(index);
#removeButtonAt(index: number) {
return cy.findAllByTestId(this.#removeBtn).eq(index);
}
}

View file

@ -1,16 +1,16 @@
import type { KeyValueType } from "../../../../../src/components/key-value-form/key-value-convert";
export default class KeyValueInput {
private name: string;
#name: string;
constructor(name: string) {
this.name = name;
this.#name = name;
}
fillKeyValue({ key, value }: KeyValueType) {
cy.findByTestId(`${this.name}-add-row`).click();
cy.findByTestId(`${this.#name}-add-row`).click();
cy.findAllByTestId(`${this.name}-key`)
cy.findAllByTestId(`${this.#name}-key`)
.its("length")
.then((length) => {
this.keyInputAt(length - 1).type(key);
@ -21,12 +21,12 @@ export default class KeyValueInput {
}
deleteRow(index: number) {
cy.findAllByTestId(`${this.name}-remove`).eq(index).click();
cy.findAllByTestId(`${this.#name}-remove`).eq(index).click();
return this;
}
validateRows(numberOfRows: number) {
cy.findAllByTestId(`${this.name}-key`).should("have.length", numberOfRows);
cy.findAllByTestId(`${this.#name}-key`).should("have.length", numberOfRows);
return this;
}
@ -36,10 +36,10 @@ export default class KeyValueInput {
}
keyInputAt(index: number) {
return cy.findAllByTestId(`${this.name}-key`).eq(index);
return cy.findAllByTestId(`${this.#name}-key`).eq(index);
}
valueInputAt(index: number) {
return cy.findAllByTestId(`${this.name}-value`).eq(index);
return cy.findAllByTestId(`${this.#name}-value`).eq(index);
}
}

View file

@ -1,23 +1,23 @@
import type { KeyValueType } from "../../../../../src/components/key-value-form/key-value-convert";
export default class LegacyKeyValueInput {
private name: string;
#name: string;
constructor(name: string) {
this.name = name;
this.#name = name;
}
fillKeyValue({ key, value }: KeyValueType, index = 0) {
cy.findByTestId(`${this.name}.${index}.key`).clear();
cy.findByTestId(`${this.name}.${index}.key`).type(key);
cy.findByTestId(`${this.name}.${index}.value`).clear();
cy.findByTestId(`${this.name}.${index}.value`).type(value);
cy.findByTestId(`${this.name}-add-row`).click();
cy.findByTestId(`${this.#name}.${index}.key`).clear();
cy.findByTestId(`${this.#name}.${index}.key`).type(key);
cy.findByTestId(`${this.#name}.${index}.value`).clear();
cy.findByTestId(`${this.#name}.${index}.value`).type(value);
cy.findByTestId(`${this.#name}-add-row`).click();
return this;
}
deleteRow(index: number) {
cy.findByTestId(`${this.name}.${index}.remove`).click();
cy.findByTestId(`${this.#name}.${index}.remove`).click();
return this;
}

View file

@ -1,67 +1,67 @@
const expect = chai.expect;
export default class RoleMappingTab {
private type = "client";
private serviceAccountTab = "serviceAccountTab";
private scopeTab = "scopeTab";
private assignEmptyRoleBtn = (type: string) =>
#type = "client";
#serviceAccountTab = "serviceAccountTab";
#scopeTab = "scopeTab";
#assignEmptyRoleBtn = (type: string) =>
`no-roles-for-this-${type}-empty-action`;
private assignRoleBtn = "assignRole";
private unAssignBtn = "unAssignRole";
private unAssignDrpDwnBtn = '.pf-c-table__action li button[role="menuitem"]';
private assignBtn = "assign";
private hideInheritedRolesBtn = "#hideInheritedRoles";
private assignedRolesTable = "assigned-roles";
private namesColumn = 'td[data-label="Name"]:visible';
private roleMappingTab = "role-mapping-tab";
#assignRoleBtn = "assignRole";
#unAssignBtn = "unAssignRole";
#unAssignDrpDwnBtn = '.pf-c-table__action li button[role="menuitem"]';
#assignBtn = "assign";
#hideInheritedRolesBtn = "#hideInheritedRoles";
#assignedRolesTable = "assigned-roles";
#namesColumn = 'td[data-label="Name"]:visible';
#roleMappingTab = "role-mapping-tab";
constructor(type: string) {
this.type = type;
this.#type = type;
}
goToServiceAccountTab() {
cy.findByTestId(this.serviceAccountTab).click();
cy.findByTestId(this.#serviceAccountTab).click();
return this;
}
goToScopeTab() {
cy.findByTestId(this.scopeTab).click();
cy.findByTestId(this.#scopeTab).click();
return this;
}
assignRole(notEmpty = true) {
cy.findByTestId(
notEmpty ? this.assignEmptyRoleBtn(this.type) : this.assignRoleBtn,
notEmpty ? this.#assignEmptyRoleBtn(this.#type) : this.#assignRoleBtn,
).click();
return this;
}
assign() {
cy.findByTestId(this.assignBtn).click();
cy.findByTestId(this.#assignBtn).click();
return this;
}
unAssign() {
cy.findByTestId(this.unAssignBtn).click();
cy.findByTestId(this.#unAssignBtn).click();
return this;
}
unAssignFromDropdown() {
cy.get(this.unAssignDrpDwnBtn).click();
cy.get(this.#unAssignDrpDwnBtn).click();
return this;
}
hideInheritedRoles() {
cy.get(this.hideInheritedRolesBtn).check();
cy.get(this.#hideInheritedRolesBtn).check();
return this;
}
unhideInheritedRoles() {
cy.get(this.hideInheritedRolesBtn).uncheck({ force: true });
cy.get(this.#hideInheritedRolesBtn).uncheck({ force: true });
return this;
}
selectRow(name: string, modal = false) {
cy.get(modal ? ".pf-c-modal-box " : "" + this.namesColumn)
cy.get(modal ? ".pf-c-modal-box " : "" + this.#namesColumn)
.contains(name)
.parent()
.within(() => {
@ -72,8 +72,8 @@ export default class RoleMappingTab {
checkRoles(roleNames: string[], exist = true) {
if (roleNames.length) {
cy.findByTestId(this.assignedRolesTable)
.get(this.namesColumn)
cy.findByTestId(this.#assignedRolesTable)
.get(this.#namesColumn)
.should((roles) => {
for (let index = 0; index < roleNames.length; index++) {
const roleName = roleNames[index];
@ -86,13 +86,13 @@ export default class RoleMappingTab {
}
});
} else {
cy.findByTestId(this.assignedRolesTable).should("not.exist");
cy.findByTestId(this.#assignedRolesTable).should("not.exist");
}
return this;
}
goToRoleMappingTab() {
cy.findByTestId(this.roleMappingTab).click();
cy.findByTestId(this.#roleMappingTab).click();
return this;
}
}

View file

@ -1,12 +1,12 @@
import ModalUtils from "../../../../util/ModalUtils";
export default class BindFlowModal extends ModalUtils {
private bindingType = "#chooseBindingType";
private dropdownSelectToggleItem = ".pf-c-select__menu > li";
#bindingType = "#chooseBindingType";
#dropdownSelectToggleItem = ".pf-c-select__menu > li";
fill(bindingType: string) {
cy.get(this.bindingType).click();
cy.get(this.dropdownSelectToggleItem).contains(bindingType).click();
cy.get(this.#bindingType).click();
cy.get(this.#dropdownSelectToggleItem).contains(bindingType).click();
return this;
}

View file

@ -1,21 +1,22 @@
export default class DuplicateFlowModal {
private nameInput = "name";
private descriptionInput = "description";
private confirmButton = "confirm";
private errorText = ".pf-m-error";
#nameInput = "name";
#descriptionInput = "description";
#confirmButton = "confirm";
#errorText = ".pf-m-error";
fill(name?: string, description?: string) {
cy.findByTestId(this.nameInput).clear();
cy.findByTestId(this.#nameInput).clear();
if (name) {
cy.findByTestId(this.nameInput).type(name);
if (description) cy.findByTestId(this.descriptionInput).type(description);
cy.findByTestId(this.#nameInput).type(name);
if (description)
cy.findByTestId(this.#descriptionInput).type(description);
}
cy.findByTestId(this.confirmButton).click();
cy.findByTestId(this.#confirmButton).click();
return this;
}
shouldShowError(message: string) {
cy.get(this.errorText).invoke("text").should("contain", message);
cy.get(this.#errorText).invoke("text").should("contain", message);
}
}

View file

@ -2,7 +2,7 @@ type RequirementType = "Required" | "Alternative" | "Disabled" | "Conditional";
export default class FlowDetails {
executionExists(name: string, exist = true) {
this.getExecution(name).should((!exist ? "not." : "") + "exist");
this.#getExecution(name).should((!exist ? "not." : "") + "exist");
return this;
}
@ -11,7 +11,7 @@ export default class FlowDetails {
return this;
}
private getExecution(name: string) {
#getExecution(name: string) {
return cy.findByTestId(name);
}
@ -34,7 +34,7 @@ export default class FlowDetails {
}
changeRequirement(execution: string, requirement: RequirementType) {
this.getExecution(execution)
this.#getExecution(execution)
.parentsUntil(".keycloak__authentication__flow-row")
.find(".keycloak__authentication__requirement-dropdown")
.click()
@ -48,7 +48,7 @@ export default class FlowDetails {
return this;
}
private clickEditDropdownForFlow(subFlowName: string, option: string) {
#clickEditDropdownForFlow(subFlowName: string, option: string) {
cy.findByTestId(`${subFlowName}-edit-dropdown`)
.click()
.contains(option)
@ -56,7 +56,7 @@ export default class FlowDetails {
}
addExecution(subFlowName: string, executionTestId: string) {
this.clickEditDropdownForFlow(subFlowName, "Add step");
this.#clickEditDropdownForFlow(subFlowName, "Add step");
cy.get(".pf-c-pagination").should("exist");
cy.findByTestId(executionTestId).click();
@ -66,7 +66,7 @@ export default class FlowDetails {
}
addCondition(subFlowName: string, executionTestId: string) {
this.clickEditDropdownForFlow(subFlowName, "Add condition");
this.#clickEditDropdownForFlow(subFlowName, "Add condition");
cy.findByTestId(executionTestId).click();
cy.findByTestId("modal-add").click();
@ -75,8 +75,8 @@ export default class FlowDetails {
}
addSubFlow(subFlowName: string, name: string) {
this.clickEditDropdownForFlow(subFlowName, "Add sub-flow");
this.fillSubFlowModal(subFlowName, name);
this.#clickEditDropdownForFlow(subFlowName, "Add sub-flow");
this.#fillSubFlowModal(subFlowName, name);
return this;
}
@ -87,7 +87,7 @@ export default class FlowDetails {
return this;
}
private fillSubFlowModal(subFlowName: string, name: string) {
#fillSubFlowModal(subFlowName: string, name: string) {
cy.get(".pf-c-modal-box__title-text").contains(
"Add step to " + subFlowName,
);
@ -109,7 +109,7 @@ export default class FlowDetails {
addSubFlowToEmpty(subFlowName: string, name: string) {
cy.findByTestId("addSubFlow").click();
this.fillSubFlowModal(subFlowName, name);
this.#fillSubFlowModal(subFlowName, name);
return this;
}

View file

@ -1,17 +1,17 @@
export default class RequiredActions {
private toId(name: string) {
#toId(name: string) {
return name.replace(/\s/g, "\\ ");
}
private toKey(name: string) {
#toKey(name: string) {
return name.replace(/\s/g, "-");
}
private getEnabled(name: string) {
return `#enable-${this.toKey(name)}`;
#getEnabled(name: string) {
return `#enable-${this.#toKey(name)}`;
}
private getDefault(name: string) {
return `#default-${this.toKey(name)}`;
#getDefault(name: string) {
return `#default-${this.#toKey(name)}`;
}
goToTab() {
@ -19,32 +19,32 @@ export default class RequiredActions {
}
enableAction(name: string) {
cy.get(this.getEnabled(name)).click({ force: true });
cy.get(this.#getEnabled(name)).click({ force: true });
return this;
}
isChecked(name: string) {
cy.get(this.getEnabled(name)).should("be.checked");
cy.get(this.#getEnabled(name)).should("be.checked");
return this;
}
isDefaultEnabled(name: string) {
cy.get(this.getDefault(name)).should("be.enabled");
cy.get(this.#getDefault(name)).should("be.enabled");
return this;
}
setAsDefault(name: string) {
cy.get(this.getDefault(name)).click({ force: true });
cy.get(this.#getDefault(name)).click({ force: true });
return this;
}
isDefaultChecked(name: string) {
cy.get(this.getEnabled(name)).should("be.checked");
cy.get(this.#getEnabled(name)).should("be.checked");
return this;
}
moveRowTo(from: string, to: string) {
cy.get("#" + this.toId(from)).drag("#" + this.toId(to));
cy.get("#" + this.#toId(from)).drag("#" + this.#toId(to));
return this;
}

View file

@ -10,22 +10,22 @@ export enum ClientScopeDetailsTab {
}
export default class ClientScopeDetailsPage extends CommonPage {
private settingsTab = new SettingsTab();
private scopesTab = new ScopeTab();
private mappersTab = new MappersTab();
#settingsTab = new SettingsTab();
#scopesTab = new ScopeTab();
#mappersTab = new MappersTab();
goToSettingsTab() {
this.tabUtils().clickTab(ClientScopeDetailsTab.SettingsTab);
return this.settingsTab;
return this.#settingsTab;
}
goToMappersTab() {
this.tabUtils().clickTab(ClientScopeDetailsTab.MappersTab);
return this.mappersTab;
return this.#mappersTab;
}
goToScopesTab() {
this.tabUtils().clickTab(ClientScopeDetailsTab.Scope);
return this.scopesTab;
return this.#scopesTab;
}
}

View file

@ -1,19 +1,19 @@
import CommonPage from "../../../../../CommonPage";
export default class MappersTab extends CommonPage {
private addMapperBtn = "#mapperAction";
private fromPredefinedMappersBtn =
#addMapperBtn = "#mapperAction";
#fromPredefinedMappersBtn =
'ul[aria-labelledby="mapperAction"] > li:nth-child(1) a';
private byConfigurationBtn =
#byConfigurationBtn =
'ul[aria-labelledby="mapperAction"] > li:nth-child(2) a';
private mapperConfigurationList =
#mapperConfigurationList =
'ul[aria-label="Add predefined mappers"] > li:not([id=header])';
private mapperNameInput = "#name";
#mapperNameInput = "#name";
addPredefinedMappers(mappersNames: string[]) {
cy.get(this.addMapperBtn).click();
cy.get(this.fromPredefinedMappersBtn).click();
cy.get(this.#addMapperBtn).click();
cy.get(this.#fromPredefinedMappersBtn).click();
this.tableUtils().setTableInModal(true);
for (const mapperName of mappersNames) {
@ -34,12 +34,14 @@ export default class MappersTab extends CommonPage {
}
addMappersByConfiguration(predefinedMapperName: string, mapperName: string) {
cy.get(this.addMapperBtn).click();
cy.get(this.byConfigurationBtn).click();
cy.get(this.#addMapperBtn).click();
cy.get(this.#byConfigurationBtn).click();
cy.get(this.mapperConfigurationList).contains(predefinedMapperName).click();
cy.get(this.#mapperConfigurationList)
.contains(predefinedMapperName)
.click();
cy.get(this.mapperNameInput).type(mapperName);
cy.get(this.#mapperNameInput).type(mapperName);
this.formUtils().save();
this.masthead().checkNotificationMessage("Mapping successfully created");

View file

@ -9,43 +9,43 @@ export enum ClaimJsonType {
}
export default class MapperDetailsPage extends CommonPage {
private userAttributeInput = '[id="user.attribute"]';
private tokenClaimNameInput = '[id="claim.name"]';
private claimJsonType = '[id="jsonType.label"]';
#userAttributeInput = '[id="user.attribute"]';
#tokenClaimNameInput = '[id="claim.name"]';
#claimJsonType = '[id="jsonType.label"]';
fillUserAttribute(userAttribute: string) {
cy.get(this.userAttributeInput).clear().type(userAttribute);
cy.get(this.#userAttributeInput).clear().type(userAttribute);
return this;
}
checkUserAttribute(userAttribute: string) {
cy.get(this.userAttributeInput).should("have.value", userAttribute);
cy.get(this.#userAttributeInput).should("have.value", userAttribute);
return this;
}
fillTokenClaimName(name: string) {
cy.get(this.tokenClaimNameInput).clear().type(name);
cy.get(this.#tokenClaimNameInput).clear().type(name);
return this;
}
checkTokenClaimName(name: string) {
cy.get(this.tokenClaimNameInput).should("have.value", name);
cy.get(this.#tokenClaimNameInput).should("have.value", name);
return this;
}
changeClaimJsonType(type: string) {
cy.get(this.claimJsonType).click();
cy.get(this.claimJsonType).parent().contains(type).click();
cy.get(this.#claimJsonType).click();
cy.get(this.#claimJsonType).parent().contains(type).click();
return this;
}
checkClaimJsonType(type: string) {
cy.get(this.claimJsonType).should("contain", type);
cy.get(this.#claimJsonType).should("contain", type);
return this;
}

View file

@ -8,11 +8,11 @@ enum ClientRolesTabItems {
}
export default class ClientRolesTab extends CommonPage {
private createRoleBtn = "create-role";
private createRoleEmptyStateBtn = "no-roles-for-this-client-empty-action";
private hideInheritedRolesChkBox = "#hideInheritedRoles";
private rolesTab = "rolesTab";
private associatedRolesTab = "associatedRolesTab";
#createRoleBtn = "create-role";
#createRoleEmptyStateBtn = "no-roles-for-this-client-empty-action";
#hideInheritedRolesChkBox = "#hideInheritedRoles";
#rolesTab = "rolesTab";
#associatedRolesTab = "associatedRolesTab";
goToDetailsTab() {
this.tabUtils().clickTab(ClientRolesTabItems.Details);
@ -35,32 +35,32 @@ export default class ClientRolesTab extends CommonPage {
}
goToRolesTab() {
cy.findByTestId(this.rolesTab).click();
cy.findByTestId(this.#rolesTab).click();
return this;
}
goToAssociatedRolesTab() {
cy.findByTestId(this.associatedRolesTab).click();
cy.findByTestId(this.#associatedRolesTab).click();
return this;
}
goToCreateRoleFromToolbar() {
cy.findByTestId(this.createRoleBtn).click();
cy.findByTestId(this.#createRoleBtn).click();
return this;
}
goToCreateRoleFromEmptyState() {
cy.findByTestId(this.createRoleEmptyStateBtn).click();
cy.findByTestId(this.#createRoleEmptyStateBtn).click();
return this;
}
fillClientRoleData() {
cy.findByTestId(this.createRoleBtn).click();
cy.findByTestId(this.#createRoleBtn).click();
return this;
}
hideInheritedRoles() {
cy.get(this.hideInheritedRolesChkBox).check();
cy.get(this.#hideInheritedRolesChkBox).check();
return this;
}
}

View file

@ -8,16 +8,16 @@ enum ClientsTab {
}
export default class ClientsPage extends CommonPage {
private clientsListTab = new ClientsListTab();
private initialAccessTokenTab = new InitialAccessTokenTab();
#clientsListTab = new ClientsListTab();
#initialAccessTokenTab = new InitialAccessTokenTab();
goToClientsListTab() {
this.tabUtils().clickTab(ClientsTab.ClientsList);
return this.clientsListTab;
return this.#clientsListTab;
}
goToInitialAccessTokenTab() {
this.tabUtils().clickTab(ClientsTab.InitialAccessToken);
return this.initialAccessTokenTab;
return this.#initialAccessTokenTab;
}
}

View file

@ -1,69 +1,67 @@
import CommonPage from "../../../CommonPage";
export default class CreateClientPage extends CommonPage {
private clientTypeDrpDwn = ".pf-c-select__toggle";
private clientTypeList = ".pf-c-select__toggle + ul";
private clientIdInput = "#clientId";
private clientIdError = "#clientId + div";
private clientNameInput = "#name";
private clientDescriptionInput = "#kc-description";
private alwaysDisplayInUISwitch =
#clientTypeDrpDwn = ".pf-c-select__toggle";
#clientTypeList = ".pf-c-select__toggle + ul";
#clientIdInput = "#clientId";
#clientIdError = "#clientId + div";
#clientNameInput = "#name";
#clientDescriptionInput = "#kc-description";
#alwaysDisplayInUISwitch =
'[for="kc-always-display-in-ui-switch"] .pf-c-switch__toggle';
private frontchannelLogoutSwitch =
#frontchannelLogoutSwitch =
'[for="kc-frontchannelLogout-switch"] .pf-c-switch__toggle';
private clientAuthenticationSwitch =
#clientAuthenticationSwitch =
'[for="kc-authentication-switch"] > .pf-c-switch__toggle';
private clientAuthenticationSwitchInput = "#kc-authentication-switch";
private clientAuthorizationSwitch =
#clientAuthenticationSwitchInput = "#kc-authentication-switch";
#clientAuthorizationSwitch =
'[for="kc-authorization-switch"] > .pf-c-switch__toggle';
private clientAuthorizationSwitchInput = "#kc-authorization-switch";
private standardFlowChkBx = "#kc-flow-standard";
private directAccessChkBx = "#kc-flow-direct";
private implicitFlowChkBx = "#kc-flow-implicit";
private oidcCibaGrantChkBx = "#kc-oidc-ciba-grant";
private deviceAuthGrantChkBx = "#kc-oauth-device-authorization-grant";
private serviceAccountRolesChkBx = "#kc-flow-service-account";
#clientAuthorizationSwitchInput = "#kc-authorization-switch";
#standardFlowChkBx = "#kc-flow-standard";
#directAccessChkBx = "#kc-flow-direct";
#implicitFlowChkBx = "#kc-flow-implicit";
#oidcCibaGrantChkBx = "#kc-oidc-ciba-grant";
#deviceAuthGrantChkBx = "#kc-oauth-device-authorization-grant";
#serviceAccountRolesChkBx = "#kc-flow-service-account";
private rootUrlInput = "#kc-root-url";
private homeUrlInput = "#kc-home-url";
private firstValidRedirectUrlInput = "redirectUris0";
private firstWebOriginsInput = "webOrigins0";
private adminUrlInput = "#kc-admin-url";
#rootUrlInput = "#kc-root-url";
#homeUrlInput = "#kc-home-url";
#firstValidRedirectUrlInput = "redirectUris0";
#firstWebOriginsInput = "webOrigins0";
#adminUrlInput = "#kc-admin-url";
private loginThemeDrpDwn = "#loginTheme";
private loginThemeList = 'ul[aria-label="Login theme"]';
private consentRequiredSwitch =
'[for="kc-consent-switch"] > .pf-c-switch__toggle';
private consentRequiredSwitchInput = "#kc-consent-switch";
private displayClientOnScreenSwitch = '[for="kc-display-on-client-switch"]';
private displayClientOnScreenSwitchInput = "#kc-display-on-client-switch";
private clientConsentScreenText = "#kc-consent-screen-text";
#loginThemeDrpDwn = "#loginTheme";
#loginThemeList = 'ul[aria-label="Login theme"]';
#consentRequiredSwitch = '[for="kc-consent-switch"] > .pf-c-switch__toggle';
#consentRequiredSwitchInput = "#kc-consent-switch";
#displayClientOnScreenSwitch = '[for="kc-display-on-client-switch"]';
#displayClientOnScreenSwitchInput = "#kc-display-on-client-switch";
#clientConsentScreenText = "#kc-consent-screen-text";
private frontChannelLogoutSwitch =
#frontChannelLogoutSwitch =
'[for="kc-frontchannelLogout-switch"] > .pf-c-switch__toggle';
private frontChannelLogoutSwitchInput = "#kc-frontchannelLogout-switch";
private frontChannelLogoutInput = "#frontchannelLogoutUrl";
private backChannelLogoutInput = "#backchannelLogoutUrl";
private backChannelLogoutRequiredSwitchInput =
"#backchannelLogoutSessionRequired";
private backChannelLogoutRevoqueSwitch =
#frontChannelLogoutSwitchInput = "#kc-frontchannelLogout-switch";
#frontChannelLogoutInput = "#frontchannelLogoutUrl";
#backChannelLogoutInput = "#backchannelLogoutUrl";
#backChannelLogoutRequiredSwitchInput = "#backchannelLogoutSessionRequired";
#backChannelLogoutRevoqueSwitch =
'.pf-c-form__group-control [for="backchannelLogoutRevokeOfflineSessions"] > .pf-c-switch__toggle';
private backChannelLogoutRevoqueSwitchInput =
#backChannelLogoutRevoqueSwitchInput =
"#backchannelLogoutRevokeOfflineSessions";
private actionDrpDwn = "action-dropdown";
private deleteClientBtn = "delete-client";
#actionDrpDwn = "action-dropdown";
#deleteClientBtn = "delete-client";
private saveBtn = "save";
private continueBtn = "next";
private backBtn = "back";
private cancelBtn = "cancel";
#saveBtn = "save";
#continueBtn = "next";
#backBtn = "back";
#cancelBtn = "cancel";
//#region General Settings
selectClientType(clientType: string) {
cy.get(this.clientTypeDrpDwn).click();
cy.get(this.clientTypeList).findByTestId(`option-${clientType}`).click();
cy.get(this.#clientTypeDrpDwn).click();
cy.get(this.#clientTypeList).findByTestId(`option-${clientType}`).click();
return this;
}
@ -75,26 +73,26 @@ export default class CreateClientPage extends CommonPage {
alwaysDisplay?: boolean,
frontchannelLogout?: boolean,
) {
cy.get(this.clientIdInput).clear();
cy.get(this.#clientIdInput).clear();
if (id) {
cy.get(this.clientIdInput).type(id);
cy.get(this.#clientIdInput).type(id);
}
if (name) {
cy.get(this.clientNameInput).type(name);
cy.get(this.#clientNameInput).type(name);
}
if (description) {
cy.get(this.clientDescriptionInput).type(description);
cy.get(this.#clientDescriptionInput).type(description);
}
if (alwaysDisplay) {
cy.get(this.alwaysDisplayInUISwitch).click();
cy.get(this.#alwaysDisplayInUISwitch).click();
}
if (frontchannelLogout) {
cy.get(this.frontchannelLogoutSwitch).click();
cy.get(this.#frontchannelLogoutSwitch).click();
}
return this;
@ -108,7 +106,7 @@ export default class CreateClientPage extends CommonPage {
}
checkClientIdRequiredMessage(exist = true) {
cy.get(this.clientIdError).should((!exist ? "not." : "") + "exist");
cy.get(this.#clientIdError).should((!exist ? "not." : "") + "exist");
return this;
}
@ -124,167 +122,169 @@ export default class CreateClientPage extends CommonPage {
//#region Capability config
switchClientAuthentication() {
cy.get(this.clientAuthenticationSwitch).click();
cy.get(this.#clientAuthenticationSwitch).click();
return this;
}
switchClientAuthorization() {
cy.get(this.clientAuthorizationSwitch).click();
cy.get(this.#clientAuthorizationSwitch).click();
return this;
}
clickStandardFlow() {
cy.get(this.standardFlowChkBx).click();
cy.get(this.#standardFlowChkBx).click();
return this;
}
clickDirectAccess() {
cy.get(this.directAccessChkBx).click();
cy.get(this.#directAccessChkBx).click();
return this;
}
clickImplicitFlow() {
cy.get(this.implicitFlowChkBx).click();
cy.get(this.#implicitFlowChkBx).click();
return this;
}
clickServiceAccountRoles() {
cy.get(this.serviceAccountRolesChkBx).click();
cy.get(this.#serviceAccountRolesChkBx).click();
return this;
}
clickOAuthDeviceAuthorizationGrant() {
cy.get(this.deviceAuthGrantChkBx).click();
cy.get(this.#deviceAuthGrantChkBx).click();
return this;
}
clickOidcCibaGrant() {
cy.get(this.oidcCibaGrantChkBx).click();
cy.get(this.#oidcCibaGrantChkBx).click();
return this;
}
//#endregion
save() {
cy.findByTestId(this.saveBtn).click();
cy.findByTestId(this.#saveBtn).click();
return this;
}
continue() {
cy.findByTestId(this.continueBtn).click();
cy.findByTestId(this.#continueBtn).click();
return this;
}
back() {
cy.findByTestId(this.backBtn).click();
cy.findByTestId(this.#backBtn).click();
return this;
}
cancel() {
cy.findByTestId(this.cancelBtn).click();
cy.findByTestId(this.#cancelBtn).click();
return this;
}
checkCapabilityConfigElements() {
cy.get(this.oidcCibaGrantChkBx).scrollIntoView();
cy.get(this.#oidcCibaGrantChkBx).scrollIntoView();
cy.get(this.clientAuthenticationSwitchInput).should("not.be.disabled");
cy.get(this.clientAuthorizationSwitchInput).should("be.disabled");
cy.get(this.#clientAuthenticationSwitchInput).should("not.be.disabled");
cy.get(this.#clientAuthorizationSwitchInput).should("be.disabled");
cy.get(this.standardFlowChkBx).should("not.be.disabled");
cy.get(this.directAccessChkBx).should("not.be.disabled");
cy.get(this.implicitFlowChkBx).should("not.be.disabled");
cy.get(this.serviceAccountRolesChkBx).should("be.disabled");
cy.get(this.deviceAuthGrantChkBx).should("not.be.disabled");
cy.get(this.oidcCibaGrantChkBx).should("be.disabled");
cy.get(this.#standardFlowChkBx).should("not.be.disabled");
cy.get(this.#directAccessChkBx).should("not.be.disabled");
cy.get(this.#implicitFlowChkBx).should("not.be.disabled");
cy.get(this.#serviceAccountRolesChkBx).should("be.disabled");
cy.get(this.#deviceAuthGrantChkBx).should("not.be.disabled");
cy.get(this.#oidcCibaGrantChkBx).should("be.disabled");
cy.get(this.clientAuthenticationSwitch).click();
cy.get(this.clientAuthorizationSwitchInput).should("not.be.disabled");
cy.get(this.serviceAccountRolesChkBx).should("not.be.disabled");
cy.get(this.oidcCibaGrantChkBx).should("not.be.disabled");
cy.get(this.#clientAuthenticationSwitch).click();
cy.get(this.#clientAuthorizationSwitchInput).should("not.be.disabled");
cy.get(this.#serviceAccountRolesChkBx).should("not.be.disabled");
cy.get(this.#oidcCibaGrantChkBx).should("not.be.disabled");
cy.get(this.clientAuthorizationSwitch).click();
cy.get(this.serviceAccountRolesChkBx).should("be.disabled");
cy.get(this.oidcCibaGrantChkBx).should("not.be.disabled");
cy.get(this.#clientAuthorizationSwitch).click();
cy.get(this.#serviceAccountRolesChkBx).should("be.disabled");
cy.get(this.#oidcCibaGrantChkBx).should("not.be.disabled");
cy.get(this.clientAuthorizationSwitch).click();
cy.get(this.serviceAccountRolesChkBx).should("not.be.disabled");
cy.get(this.#clientAuthorizationSwitch).click();
cy.get(this.#serviceAccountRolesChkBx).should("not.be.disabled");
cy.get(this.clientAuthenticationSwitch).click();
cy.get(this.serviceAccountRolesChkBx).should("be.disabled");
cy.get(this.oidcCibaGrantChkBx).should("be.disabled");
cy.get(this.#clientAuthenticationSwitch).click();
cy.get(this.#serviceAccountRolesChkBx).should("be.disabled");
cy.get(this.#oidcCibaGrantChkBx).should("be.disabled");
return this;
}
checkAccessSettingsElements() {
cy.get(this.adminUrlInput).scrollIntoView();
cy.get(this.rootUrlInput).should("not.be.disabled");
cy.get(this.homeUrlInput).should("not.be.disabled");
cy.findByTestId(this.firstValidRedirectUrlInput).should("not.be.disabled");
cy.findByTestId(this.firstWebOriginsInput).should("not.be.disabled");
cy.get(this.adminUrlInput).should("not.be.disabled");
cy.get(this.#adminUrlInput).scrollIntoView();
cy.get(this.#rootUrlInput).should("not.be.disabled");
cy.get(this.#homeUrlInput).should("not.be.disabled");
cy.findByTestId(this.#firstValidRedirectUrlInput).should("not.be.disabled");
cy.findByTestId(this.#firstWebOriginsInput).should("not.be.disabled");
cy.get(this.#adminUrlInput).should("not.be.disabled");
return this;
}
checkLoginSettingsElements() {
cy.get(this.clientConsentScreenText).scrollIntoView();
cy.get(this.loginThemeDrpDwn).should("not.be.disabled");
cy.get(this.consentRequiredSwitchInput).should("not.be.disabled");
cy.get(this.displayClientOnScreenSwitchInput).should("be.disabled");
cy.get(this.clientConsentScreenText).should("be.disabled");
cy.get(this.#clientConsentScreenText).scrollIntoView();
cy.get(this.#loginThemeDrpDwn).should("not.be.disabled");
cy.get(this.#consentRequiredSwitchInput).should("not.be.disabled");
cy.get(this.#displayClientOnScreenSwitchInput).should("be.disabled");
cy.get(this.#clientConsentScreenText).should("be.disabled");
cy.get(this.loginThemeDrpDwn).click();
cy.get(this.loginThemeList).findByText("base").should("exist");
cy.get(this.loginThemeList).findByText("keycloak").should("exist");
cy.get(this.loginThemeDrpDwn).click();
cy.get(this.#loginThemeDrpDwn).click();
cy.get(this.#loginThemeList).findByText("base").should("exist");
cy.get(this.#loginThemeList).findByText("keycloak").should("exist");
cy.get(this.#loginThemeDrpDwn).click();
cy.get(this.consentRequiredSwitch).click();
cy.get(this.displayClientOnScreenSwitchInput).should("not.be.disabled");
cy.get(this.clientConsentScreenText).should("be.disabled");
cy.get(this.#consentRequiredSwitch).click();
cy.get(this.#displayClientOnScreenSwitchInput).should("not.be.disabled");
cy.get(this.#clientConsentScreenText).should("be.disabled");
cy.get(this.displayClientOnScreenSwitch).click();
cy.get(this.clientConsentScreenText).should("not.be.disabled");
cy.get(this.#displayClientOnScreenSwitch).click();
cy.get(this.#clientConsentScreenText).should("not.be.disabled");
cy.get(this.displayClientOnScreenSwitch).click();
cy.get(this.clientConsentScreenText).should("be.disabled");
cy.get(this.consentRequiredSwitch).click();
cy.get(this.displayClientOnScreenSwitchInput).should("be.disabled");
cy.get(this.#displayClientOnScreenSwitch).click();
cy.get(this.#clientConsentScreenText).should("be.disabled");
cy.get(this.#consentRequiredSwitch).click();
cy.get(this.#displayClientOnScreenSwitchInput).should("be.disabled");
return this;
}
checkLogoutSettingsElements() {
cy.get(this.backChannelLogoutRevoqueSwitch).scrollIntoView();
cy.get(this.frontChannelLogoutSwitchInput).should("not.be.disabled");
cy.get(this.frontChannelLogoutInput).should("not.be.disabled");
cy.get(this.backChannelLogoutInput).should("not.be.disabled");
cy.get(this.backChannelLogoutRequiredSwitchInput).should("not.be.disabled");
cy.get(this.backChannelLogoutRevoqueSwitchInput).should("not.be.disabled");
cy.get(this.#backChannelLogoutRevoqueSwitch).scrollIntoView();
cy.get(this.#frontChannelLogoutSwitchInput).should("not.be.disabled");
cy.get(this.#frontChannelLogoutInput).should("not.be.disabled");
cy.get(this.#backChannelLogoutInput).should("not.be.disabled");
cy.get(this.#backChannelLogoutRequiredSwitchInput).should(
"not.be.disabled",
);
cy.get(this.#backChannelLogoutRevoqueSwitchInput).should("not.be.disabled");
cy.get(this.frontChannelLogoutSwitch).click();
cy.get(this.frontChannelLogoutInput).should("not.exist");
cy.get(this.frontChannelLogoutSwitch).click();
cy.get(this.frontChannelLogoutInput).should("not.be.disabled");
cy.get(this.#frontChannelLogoutSwitch).click();
cy.get(this.#frontChannelLogoutInput).should("not.exist");
cy.get(this.#frontChannelLogoutSwitch).click();
cy.get(this.#frontChannelLogoutInput).should("not.be.disabled");
return this;
}
deleteClientFromActionDropdown() {
cy.findAllByTestId(this.actionDrpDwn).click();
cy.findAllByTestId(this.deleteClientBtn).click();
cy.findAllByTestId(this.#actionDrpDwn).click();
cy.findAllByTestId(this.#deleteClientBtn).click();
return this;
}

View file

@ -1,16 +1,16 @@
import CommonPage from "../../../CommonPage";
export default class CreateInitialAccessTokenPage extends CommonPage {
private expirationInput = "expiration";
private countInput = "count";
private countPlusBtn = '[data-testid="count"] [aria-label="Plus"]';
#expirationInput = "expiration";
#countInput = "count";
#countPlusBtn = '[data-testid="count"] [aria-label="Plus"]';
fillNewTokenData(expiration: number, count: number) {
cy.findByTestId(this.expirationInput).clear().type(expiration.toString());
cy.findByTestId(this.countInput).clear();
cy.findByTestId(this.#expirationInput).clear().type(expiration.toString());
cy.findByTestId(this.#countInput).clear();
for (let i = 0; i < count; i++) {
cy.get(this.countPlusBtn).click();
cy.get(this.#countPlusBtn).click();
}
return this;

View file

@ -22,46 +22,46 @@ export enum ClientsDetailsTab {
}
export default class ClientDetailsPage extends CommonPage {
private settingsTab = new SettingsTab();
private keysTab = new KeysTab();
private credentialsTab = new CredentialsTab();
private rolesTab = new RolesTab();
private clientScopesTab = new ClientScopesTab();
private authorizationTab = new AuthorizationTab();
private advancedTab = new AdvancedTab();
#settingsTab = new SettingsTab();
#keysTab = new KeysTab();
#credentialsTab = new CredentialsTab();
#rolesTab = new RolesTab();
#clientScopesTab = new ClientScopesTab();
#authorizationTab = new AuthorizationTab();
#advancedTab = new AdvancedTab();
goToSettingsTab() {
this.tabUtils().clickTab(ClientsDetailsTab.Settings);
return this.settingsTab;
return this.#settingsTab;
}
goToKeysTab() {
this.tabUtils().clickTab(ClientsDetailsTab.Keys);
return this.keysTab;
return this.#keysTab;
}
goToCredentials() {
this.tabUtils().clickTab(ClientsDetailsTab.Credentials);
return this.credentialsTab;
return this.#credentialsTab;
}
goToRolesTab() {
this.tabUtils().clickTab(ClientsDetailsTab.Roles);
return this.rolesTab;
return this.#rolesTab;
}
goToClientScopesTab() {
this.tabUtils().clickTab(ClientsDetailsTab.ClientScopes);
return this.clientScopesTab;
return this.#clientScopesTab;
}
goToAuthorizationTab() {
this.tabUtils().clickTab(ClientsDetailsTab.Authorization);
return this.authorizationTab;
return this.#authorizationTab;
}
goToAdvancedTab() {
this.tabUtils().clickTab(ClientsDetailsTab.Advanced);
return this.advancedTab;
return this.#advancedTab;
}
}

View file

@ -6,10 +6,8 @@ enum mapperType {
}
export default class DedicatedScopesMappersTab extends CommonPage {
private addPredefinedMapperEmptyStateBtn =
"add-predefined-mapper-empty-action";
private configureNewMapperEmptyStateBtn =
"configure-a-new-mapper-empty-action";
#addPredefinedMapperEmptyStateBtn = "add-predefined-mapper-empty-action";
#configureNewMapperEmptyStateBtn = "configure-a-new-mapper-empty-action";
addMapperFromPredefinedMappers() {
this.emptyState().checkIfExists(false);
@ -29,13 +27,13 @@ export default class DedicatedScopesMappersTab extends CommonPage {
addPredefinedMapper() {
this.emptyState().checkIfExists(true);
cy.findByTestId(this.addPredefinedMapperEmptyStateBtn).click();
cy.findByTestId(this.#addPredefinedMapperEmptyStateBtn).click();
return this;
}
configureNewMapper() {
this.emptyState().checkIfExists(true);
cy.findByTestId(this.configureNewMapperEmptyStateBtn).click({
cy.findByTestId(this.#configureNewMapperEmptyStateBtn).click({
force: true,
});
return this;

View file

@ -8,16 +8,16 @@ export enum DedicatedScopesTab {
}
export default class DedicatedScopesPage extends CommonPage {
private mappersTab = new DedicatedScopesMappersTab();
private scopeTab = new DedicatedScopesScopeTab();
#mappersTab = new DedicatedScopesMappersTab();
#scopeTab = new DedicatedScopesScopeTab();
goToMappersTab() {
this.tabUtils().clickTab(DedicatedScopesTab.Mappers);
return this.mappersTab;
return this.#mappersTab;
}
goToScopeTab() {
this.tabUtils().clickTab(DedicatedScopesTab.Scope);
return this.scopeTab;
return this.#scopeTab;
}
}

View file

@ -1,7 +1,7 @@
import PageObject from "../../../../components/PageObject";
export class AdvancedSamlTab extends PageObject {
private termsOfServiceUrlId = "attributes.tosUri";
#termsOfServiceUrlId = "attributes.tosUri";
saveFineGrain() {
cy.findAllByTestId("fineGrainSave").click();
@ -12,13 +12,13 @@ export class AdvancedSamlTab extends PageObject {
}
termsOfServiceUrl(termsOfServiceUrl: string) {
cy.findAllByTestId(this.termsOfServiceUrlId).clear();
cy.findAllByTestId(this.termsOfServiceUrlId).type(termsOfServiceUrl);
cy.findAllByTestId(this.#termsOfServiceUrlId).clear();
cy.findAllByTestId(this.#termsOfServiceUrlId).type(termsOfServiceUrl);
return this;
}
checkTermsOfServiceUrl(termsOfServiceUrl: string) {
cy.findAllByTestId(this.termsOfServiceUrlId).should(
cy.findAllByTestId(this.#termsOfServiceUrlId).should(
"have.value",
termsOfServiceUrl,
);

View file

@ -1,76 +1,76 @@
import PageObject from "../../../../components/PageObject";
export default class AdvancedTab extends PageObject {
private setToNowBtn = "#setToNow";
private clearBtn = "#clear";
private pushBtn = "#push";
private notBeforeInput = "#kc-not-before";
#setToNowBtn = "#setToNow";
#clearBtn = "#clear";
#pushBtn = "#push";
#notBeforeInput = "#kc-not-before";
private clusterNodesExpandBtn =
#clusterNodesExpandBtn =
".pf-c-expandable-section .pf-c-expandable-section__toggle";
private testClusterAvailability = "#testClusterAvailability";
private emptyClusterElement = "empty-state";
private registerNodeManuallyBtn = "no-nodes-registered-empty-action";
private deleteClusterNodeDrpDwn =
#testClusterAvailability = "#testClusterAvailability";
#emptyClusterElement = "empty-state";
#registerNodeManuallyBtn = "no-nodes-registered-empty-action";
#deleteClusterNodeDrpDwn =
'[aria-label="Registered cluster nodes"] [aria-label="Actions"]';
private deleteClusterNodeBtn =
#deleteClusterNodeBtn =
'[aria-label="Registered cluster nodes"] [role="menu"] button';
private nodeHostInput = "#nodeHost";
private addNodeConfirmBtn = "#add-node-confirm";
#nodeHostInput = "#nodeHost";
#addNodeConfirmBtn = "#add-node-confirm";
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";
#accessTokenSignatureAlgorithmInput = "#accessTokenSignatureAlgorithm";
#fineGrainSaveBtn = "#fineGrainSave";
#fineGrainRevertBtn = "#fineGrainRevert";
#OIDCCompatabilitySaveBtn = "OIDCCompatabilitySave";
#OIDCCompatabilityRevertBtn = "OIDCCompatabilityRevert";
#OIDCAdvancedSaveBtn = "OIDCAdvancedSave";
#OIDCAdvancedRevertBtn = "OIDCAdvancedRevert";
#OIDCAuthFlowOverrideSaveBtn = "OIDCAuthFlowOverrideSave";
#OIDCAuthFlowOverrideRevertBtn = "OIDCAuthFlowOverrideRevert";
private excludeSessionStateSwitch =
#excludeSessionStateSwitch =
"#excludeSessionStateFromAuthenticationResponse-switch";
private useRefreshTokenSwitch = "#useRefreshTokens";
private useRefreshTokenForClientCredentialsGrantSwitch =
#useRefreshTokenSwitch = "#useRefreshTokens";
#useRefreshTokenForClientCredentialsGrantSwitch =
"#useRefreshTokenForClientCredentialsGrant";
private useLowerCaseBearerTypeSwitch = "#useLowerCaseBearerType";
#useLowerCaseBearerTypeSwitch = "#useLowerCaseBearerType";
private oAuthMutualSwitch = "#oAuthMutual-switch";
private keyForCodeExchangeInput = "#keyForCodeExchange";
private pushedAuthorizationRequestRequiredSwitch =
#oAuthMutualSwitch = "#oAuthMutual-switch";
#keyForCodeExchangeInput = "#keyForCodeExchange";
#pushedAuthorizationRequestRequiredSwitch =
"#pushedAuthorizationRequestRequired";
private browserFlowInput = "#browserFlow";
private directGrantInput = "#directGrant";
#browserFlowInput = "#browserFlow";
#directGrantInput = "#directGrant";
private jumpToOIDCCompatabilitySettings =
#jumpToOIDCCompatabilitySettings =
"jump-link-open-id-connect-compatibility-modes";
private jumpToAdvancedSettings = "jump-link-advanced-settings";
private jumpToAuthFlowOverride = "jump-link-authentication-flow-overrides";
#jumpToAdvancedSettings = "jump-link-advanced-settings";
#jumpToAuthFlowOverride = "jump-link-authentication-flow-overrides";
setRevocationToNow() {
cy.get(this.setToNowBtn).click();
cy.get(this.#setToNowBtn).click();
return this;
}
clearRevocation() {
cy.get(this.clearBtn).click();
cy.get(this.#clearBtn).click();
return this;
}
pushRevocation() {
cy.get(this.pushBtn).click();
cy.get(this.#pushBtn).click();
return this;
}
checkRevacationIsNone() {
cy.get(this.notBeforeInput).should("have.value", "None");
cy.get(this.#notBeforeInput).should("have.value", "None");
return this;
}
checkRevocationIsSetToNow() {
cy.get(this.notBeforeInput).should(
cy.get(this.#notBeforeInput).should(
"have.value",
new Date().toLocaleString("en-US", {
dateStyle: "long",
@ -82,12 +82,12 @@ export default class AdvancedTab extends PageObject {
}
expandClusterNode() {
cy.get(this.clusterNodesExpandBtn).click();
cy.get(this.#clusterNodesExpandBtn).click();
return this;
}
checkTestClusterAvailability(active: boolean) {
cy.get(this.testClusterAvailability).should(
cy.get(this.#testClusterAvailability).should(
(active ? "not." : "") + "have.class",
"pf-m-disabled",
);
@ -95,34 +95,34 @@ export default class AdvancedTab extends PageObject {
}
checkEmptyClusterNode() {
cy.findByTestId(this.emptyClusterElement).should("exist");
cy.findByTestId(this.#emptyClusterElement).should("exist");
return this;
}
registerNodeManually() {
cy.findByTestId(this.registerNodeManuallyBtn).click();
cy.findByTestId(this.#registerNodeManuallyBtn).click();
return this;
}
deleteClusterNode() {
cy.get(this.deleteClusterNodeDrpDwn).click();
cy.get(this.deleteClusterNodeBtn).click();
cy.get(this.#deleteClusterNodeDrpDwn).click();
cy.get(this.#deleteClusterNodeBtn).click();
return this;
}
fillHost(host: string) {
cy.get(this.nodeHostInput).type(host);
cy.get(this.#nodeHostInput).type(host);
return this;
}
saveHost() {
cy.get(this.addNodeConfirmBtn).click();
cy.get(this.#addNodeConfirmBtn).click();
return this;
}
selectAccessTokenSignatureAlgorithm(algorithm: string) {
cy.get(this.accessTokenSignatureAlgorithmInput).click();
cy.get(this.accessTokenSignatureAlgorithmInput + " + ul")
cy.get(this.#accessTokenSignatureAlgorithmInput).click();
cy.get(this.#accessTokenSignatureAlgorithmInput + " + ul")
.contains(algorithm)
.click();
@ -130,7 +130,7 @@ export default class AdvancedTab extends PageObject {
}
checkAccessTokenSignatureAlgorithm(algorithm: string) {
cy.get(this.accessTokenSignatureAlgorithmInput).should(
cy.get(this.#accessTokenSignatureAlgorithmInput).should(
"have.text",
algorithm,
);
@ -138,152 +138,152 @@ export default class AdvancedTab extends PageObject {
}
saveFineGrain() {
cy.get(this.fineGrainSaveBtn).click();
cy.get(this.#fineGrainSaveBtn).click();
return this;
}
revertFineGrain() {
cy.get(this.fineGrainRevertBtn).click();
cy.get(this.#fineGrainRevertBtn).click();
return this;
}
saveCompatibility() {
cy.findByTestId(this.OIDCCompatabilitySaveBtn).click();
cy.findByTestId(this.#OIDCCompatabilitySaveBtn).click();
return this;
}
revertCompatibility() {
cy.findByTestId(this.OIDCCompatabilityRevertBtn).click();
cy.findByTestId(this.jumpToOIDCCompatabilitySettings).click();
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));
this.assertSwitchStateOn(cy.get(this.#excludeSessionStateSwitch));
return this;
}
jumpToCompatability() {
cy.findByTestId(this.jumpToOIDCCompatabilitySettings).click();
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)
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.#useRefreshTokenForClientCredentialsGrantSwitch),
);
cy.get(this.useLowerCaseBearerTypeSwitch).parent().click();
this.assertSwitchStateOn(cy.get(this.useLowerCaseBearerTypeSwitch));
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));
cy.get(this.#excludeSessionStateSwitch).parent().click();
this.assertSwitchStateOff(cy.get(this.#excludeSessionStateSwitch));
}
clickUseRefreshTokenForClientCredentialsGrantSwitch() {
cy.get(this.useRefreshTokenForClientCredentialsGrantSwitch)
cy.get(this.#useRefreshTokenForClientCredentialsGrantSwitch)
.parent()
.click();
this.assertSwitchStateOff(
cy.get(this.useRefreshTokenForClientCredentialsGrantSwitch),
cy.get(this.#useRefreshTokenForClientCredentialsGrantSwitch),
);
}
saveAdvanced() {
cy.findByTestId(this.OIDCAdvancedSaveBtn).click();
cy.findByTestId(this.#OIDCAdvancedSaveBtn).click();
return this;
}
revertAdvanced() {
cy.findByTestId(this.OIDCAdvancedRevertBtn).click();
cy.findByTestId(this.#OIDCAdvancedRevertBtn).click();
return this;
}
jumpToAdvanced() {
cy.findByTestId(this.jumpToAdvancedSettings).click();
cy.findByTestId(this.#jumpToAdvancedSettings).click();
return this;
}
clickAdvancedSwitches() {
cy.get(this.oAuthMutualSwitch).parent().click();
cy.get(this.pushedAuthorizationRequestRequiredSwitch).parent().click();
cy.get(this.#oAuthMutualSwitch).parent().click();
cy.get(this.#pushedAuthorizationRequestRequiredSwitch).parent().click();
return this;
}
checkAdvancedSwitchesOn() {
cy.get(this.oAuthMutualSwitch).scrollIntoView();
this.assertSwitchStateOn(cy.get(this.oAuthMutualSwitch));
cy.get(this.#oAuthMutualSwitch).scrollIntoView();
this.assertSwitchStateOn(cy.get(this.#oAuthMutualSwitch));
this.assertSwitchStateOn(
cy.get(this.pushedAuthorizationRequestRequiredSwitch),
cy.get(this.#pushedAuthorizationRequestRequiredSwitch),
);
return this;
}
checkAdvancedSwitchesOff() {
this.assertSwitchStateOff(cy.get(this.oAuthMutualSwitch));
this.assertSwitchStateOff(cy.get(this.#oAuthMutualSwitch));
this.assertSwitchStateOff(
cy.get(this.pushedAuthorizationRequestRequiredSwitch),
cy.get(this.#pushedAuthorizationRequestRequiredSwitch),
);
return this;
}
selectKeyForCodeExchangeInput(input: string) {
cy.get(this.keyForCodeExchangeInput).click();
cy.get(this.keyForCodeExchangeInput + " + ul")
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);
cy.get(this.#keyForCodeExchangeInput).should("have.text", input);
return this;
}
saveAuthFlowOverride() {
cy.findByTestId(this.OIDCAuthFlowOverrideSaveBtn).click();
cy.findByTestId(this.#OIDCAuthFlowOverrideSaveBtn).click();
return this;
}
revertAuthFlowOverride() {
cy.findByTestId(this.OIDCAuthFlowOverrideRevertBtn).click();
cy.findByTestId(this.#OIDCAuthFlowOverrideRevertBtn).click();
return this;
}
jumpToAuthFlow() {
cy.findByTestId(this.jumpToAuthFlowOverride).click();
cy.findByTestId(this.#jumpToAuthFlowOverride).click();
return this;
}
selectBrowserFlowInput(input: string) {
cy.get(this.browserFlowInput).click();
cy.get(this.browserFlowInput + " + ul")
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")
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);
cy.get(this.#browserFlowInput).should("have.text", input);
return this;
}
checkDirectGrantInput(input: string) {
cy.get(this.directGrantInput).should("have.text", input);
cy.get(this.#directGrantInput).should("have.text", input);
return this;
}
}

View file

@ -18,46 +18,46 @@ enum AuthorizationSubTab {
}
export default class AuthorizationTab extends CommonPage {
private settingsSubTab = new SettingsTab();
private resourcesSubTab = new ResourcesTab();
private scopesSubTab = new ScopesTab();
private policiesSubTab = new PoliciesTab();
private permissionsSubTab = new PermissionsTab();
private evaluateSubTab = new EvaluateTab();
private exportSubTab = new ExportTab();
#settingsSubTab = new SettingsTab();
#resourcesSubTab = new ResourcesTab();
#scopesSubTab = new ScopesTab();
#policiesSubTab = new PoliciesTab();
#permissionsSubTab = new PermissionsTab();
#evaluateSubTab = new EvaluateTab();
#exportSubTab = new ExportTab();
goToSettingsSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Settings, 1);
return this.settingsSubTab;
return this.#settingsSubTab;
}
goToResourcesSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Resources, 1);
return this.resourcesSubTab;
return this.#resourcesSubTab;
}
goToScopesSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Scopes, 1);
return this.scopesSubTab;
return this.#scopesSubTab;
}
goToPoliciesSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Policies, 1);
return this.policiesSubTab;
return this.#policiesSubTab;
}
goToPermissionsSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Permissions, 1);
return this.permissionsSubTab;
return this.#permissionsSubTab;
}
goToEvaluateSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Evaluate, 1);
return this.evaluateSubTab;
return this.#evaluateSubTab;
}
goToExportSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Export, 1);
return this.exportSubTab;
return this.#exportSubTab;
}
}

View file

@ -9,24 +9,24 @@ enum ClientScopesSubTab {
}
export default class ClientScopesTab extends CommonPage {
private setupSubTab = new SetupTab();
private evaluateSubTab = new EvaluateTab();
private dedicatedScopesPage = new DedicatedScopesPage();
#setupSubTab = new SetupTab();
#evaluateSubTab = new EvaluateTab();
#dedicatedScopesPage = new DedicatedScopesPage();
goToSetupSubTab() {
this.tabUtils().clickTab(ClientScopesSubTab.Setup);
return this.setupSubTab;
return this.#setupSubTab;
}
goToEvaluateSubTab() {
this.tabUtils().clickTab(ClientScopesSubTab.Evaluate);
return this.evaluateSubTab;
return this.#evaluateSubTab;
}
clickDedicatedScope(clientId: string) {
cy.intercept("/admin/realms/master/clients/*").as("get");
cy.findByText(`${clientId}-dedicated`).click();
cy.wait("@get");
return this.dedicatedScopesPage;
return this.#dedicatedScopesPage;
}
}

View file

@ -1,26 +1,25 @@
import CommonPage from "../../../../../CommonPage";
export default class KeysTab extends CommonPage {
private generateBtn = "generate";
private confirmBtn = "confirm";
private useJwksUrl = "useJwksUrl";
private archiveFormat = "archiveFormat";
private keyAlias = "keyAlias";
private keyPassword = "keyPassword";
private storePassword = "storePassword";
#generateBtn = "generate";
#confirmBtn = "confirm";
#useJwksUrl = "useJwksUrl";
#keyAlias = "keyAlias";
#keyPassword = "keyPassword";
#storePassword = "storePassword";
toggleUseJwksUrl() {
cy.findByTestId(this.useJwksUrl).click({ force: true });
cy.findByTestId(this.#useJwksUrl).click({ force: true });
return this;
}
clickGenerate() {
cy.findByTestId(this.generateBtn).click();
cy.findByTestId(this.#generateBtn).click();
return this;
}
clickConfirm() {
cy.findByTestId(this.confirmBtn).click();
cy.findByTestId(this.#confirmBtn).click();
return this;
}
@ -32,9 +31,9 @@ export default class KeysTab extends CommonPage {
) {
cy.get("#archiveFormat").click();
cy.findAllByRole("option").contains(archiveFormat).click();
cy.findByTestId(this.keyAlias).type(keyAlias);
cy.findByTestId(this.keyPassword).type(keyPassword);
cy.findByTestId(this.storePassword).type(storePassword);
cy.findByTestId(this.#keyAlias).type(keyAlias);
cy.findByTestId(this.#keyPassword).type(keyPassword);
cy.findByTestId(this.#storePassword).type(storePassword);
return this;
}
}

View file

@ -11,120 +11,119 @@ export enum NameIdFormat {
const masthead = new Masthead();
export default class SettingsTab extends PageObject {
private samlNameIdFormat = "#samlNameIdFormat";
private forceNameIdFormat = "forceNameIdFormat";
private forcePostBinding = "forcePostBinding";
private forceArtifactBinding = "forceArtifactBinding";
private includeAuthnStatement = "includeAuthnStatement";
private includeOneTimeUseCondition = "includeOneTimeUseCondition";
private optimizeLookup = "optimizeLookup";
#samlNameIdFormat = "#samlNameIdFormat";
#forceNameIdFormat = "forceNameIdFormat";
#forcePostBinding = "forcePostBinding";
#forceArtifactBinding = "forceArtifactBinding";
#includeAuthnStatement = "includeAuthnStatement";
#includeOneTimeUseCondition = "includeOneTimeUseCondition";
#optimizeLookup = "optimizeLookup";
private signDocumentsSwitch = "signDocuments";
private signAssertionsSwitch = "signAssertions";
private signatureAlgorithm = "#signatureAlgorithm";
private signatureKeyName = "#signatureKeyName";
private canonicalization = "#canonicalization";
#signDocumentsSwitch = "signDocuments";
#signAssertionsSwitch = "signAssertions";
#signatureAlgorithm = "#signatureAlgorithm";
#signatureKeyName = "#signatureKeyName";
#canonicalization = "#canonicalization";
private loginTheme = "#loginTheme";
private consentSwitch = "#kc-consent-switch";
private displayClientSwitch = "#kc-display-on-client-switch";
private consentScreenText = "#kc-consent-screen-text";
#loginTheme = "#loginTheme";
#consentSwitch = "#kc-consent-switch";
#displayClientSwitch = "#kc-display-on-client-switch";
#consentScreenText = "#kc-consent-screen-text";
private saveBtn = "settings-save";
private revertBtn = "settingsRevert";
#saveBtn = "settings-save";
#revertBtn = "settingsRevert";
private redirectUris = "redirectUris";
private postLogoutRedirectUris = "attributes.post.logout.redirect.uris";
#redirectUris = "redirectUris";
private idpInitiatedSsoUrlName = "idpInitiatedSsoUrlName";
private idpInitiatedSsoRelayState = "idpInitiatedSsoRelayState";
private masterSamlProcessingUrl = "masterSamlProcessingUrl";
#idpInitiatedSsoUrlName = "idpInitiatedSsoUrlName";
#idpInitiatedSsoRelayState = "idpInitiatedSsoRelayState";
#masterSamlProcessingUrl = "masterSamlProcessingUrl";
public clickSaveBtn() {
cy.findByTestId(this.saveBtn).click();
cy.findByTestId(this.#saveBtn).click();
return this;
}
public clickRevertBtn() {
cy.findByTestId(this.revertBtn).click();
cy.findByTestId(this.#revertBtn).click();
return this;
}
public selectNameIdFormatDropdown(nameId: NameIdFormat) {
cy.get(this.samlNameIdFormat).click();
cy.get(this.#samlNameIdFormat).click();
cy.findByText(nameId).click();
return this;
}
public selectSignatureAlgorithmDropdown(sign: string) {
cy.get(this.signatureAlgorithm).click();
cy.get(this.#signatureAlgorithm).click();
cy.findByText(sign).click();
return this;
}
public selectSignatureKeyNameDropdown(keyName: string) {
cy.get(this.signatureKeyName).click();
cy.get(this.#signatureKeyName).click();
cy.findByText(keyName).click();
return this;
}
public selectCanonicalizationDropdown(canon: string) {
cy.get(this.canonicalization).click();
cy.get(this.#canonicalization).click();
cy.findByText(canon).click();
}
public selectLoginThemeDropdown(theme: string) {
cy.get(this.loginTheme).click();
cy.get(this.#loginTheme).click();
cy.findByText(theme).click();
}
public clickForceNameIdFormatSwitch() {
cy.findByTestId(this.forceNameIdFormat).parent().click();
cy.findByTestId(this.#forceNameIdFormat).parent().click();
return this;
}
public clickForcePostBindingSwitch() {
cy.findByTestId(this.forcePostBinding).parent().click();
cy.findByTestId(this.#forcePostBinding).parent().click();
return this;
}
public clickForceArtifactBindingSwitch() {
cy.findByTestId(this.forceArtifactBinding).parent().click();
cy.findByTestId(this.#forceArtifactBinding).parent().click();
return this;
}
public clickIncludeAuthnStatementSwitch() {
cy.findByTestId(this.includeAuthnStatement).parent().click();
cy.findByTestId(this.#includeAuthnStatement).parent().click();
return this;
}
public clickIncludeOneTimeUseConditionSwitch() {
cy.findByTestId(this.includeOneTimeUseCondition).parent().click();
cy.findByTestId(this.#includeOneTimeUseCondition).parent().click();
return this;
}
public clickOptimizeLookupSwitch() {
cy.findByTestId(this.optimizeLookup).parent().click();
cy.findByTestId(this.#optimizeLookup).parent().click();
return this;
}
public clickSignDocumentsSwitch() {
cy.findByTestId(this.signDocumentsSwitch).parent().click();
cy.findByTestId(this.#signDocumentsSwitch).parent().click();
return this;
}
public clickSignAssertionsSwitch() {
cy.findByTestId(this.signAssertionsSwitch).parent().click();
cy.findByTestId(this.#signAssertionsSwitch).parent().click();
return this;
}
public clickConsentSwitch() {
cy.get(this.consentSwitch).parent().click();
cy.get(this.#consentSwitch).parent().click();
return this;
}
public clickDisplayClientSwitch() {
cy.get(this.displayClientSwitch).parent().click();
cy.get(this.#displayClientSwitch).parent().click();
return this;
}
@ -169,51 +168,51 @@ export default class SettingsTab extends PageObject {
public assertSAMLCapabilitiesSwitches() {
this.clickForceNameIdFormatSwitch();
this.assertSwitchStateOn(cy.findByTestId(this.forceNameIdFormat));
this.assertSwitchStateOn(cy.findByTestId(this.#forceNameIdFormat));
this.clickForcePostBindingSwitch();
this.assertSwitchStateOff(cy.findByTestId(this.forcePostBinding));
this.assertSwitchStateOff(cy.findByTestId(this.#forcePostBinding));
this.clickForceArtifactBindingSwitch();
this.assertSwitchStateOn(cy.findByTestId(this.forceArtifactBinding));
this.assertSwitchStateOn(cy.findByTestId(this.#forceArtifactBinding));
this.clickIncludeAuthnStatementSwitch();
this.assertSwitchStateOff(cy.findByTestId(this.includeAuthnStatement));
this.assertSwitchStateOff(cy.findByTestId(this.#includeAuthnStatement));
this.clickIncludeOneTimeUseConditionSwitch();
this.assertSwitchStateOn(cy.findByTestId(this.includeOneTimeUseCondition));
this.assertSwitchStateOn(cy.findByTestId(this.#includeOneTimeUseCondition));
this.clickOptimizeLookupSwitch();
this.assertSwitchStateOn(cy.findByTestId(this.optimizeLookup));
this.assertSwitchStateOn(cy.findByTestId(this.#optimizeLookup));
return this;
}
public assertSignatureEncryptionSwitches() {
cy.get(this.signatureAlgorithm).should("exist");
cy.get(this.#signatureAlgorithm).should("exist");
this.clickSignDocumentsSwitch();
this.assertSwitchStateOff(cy.findByTestId(this.signDocumentsSwitch));
cy.get(this.signatureAlgorithm).should("not.exist");
this.assertSwitchStateOff(cy.findByTestId(this.#signDocumentsSwitch));
cy.get(this.#signatureAlgorithm).should("not.exist");
this.clickSignAssertionsSwitch();
this.assertSwitchStateOn(cy.findByTestId(this.signAssertionsSwitch));
cy.get(this.signatureAlgorithm).should("exist");
this.assertSwitchStateOn(cy.findByTestId(this.#signAssertionsSwitch));
cy.get(this.#signatureAlgorithm).should("exist");
return this;
}
public assertLoginSettings() {
cy.get(this.displayClientSwitch).should("be.disabled");
cy.get(this.consentScreenText).should("be.disabled");
cy.get(this.#displayClientSwitch).should("be.disabled");
cy.get(this.#consentScreenText).should("be.disabled");
this.clickConsentSwitch();
cy.get(this.displayClientSwitch).should("not.be.disabled");
cy.get(this.#displayClientSwitch).should("not.be.disabled");
this.clickDisplayClientSwitch();
cy.get(this.consentScreenText).should("not.be.disabled");
cy.get(this.consentScreenText).click().type("Consent Screen Text");
cy.get(this.#consentScreenText).should("not.be.disabled");
cy.get(this.#consentScreenText).click().type("Consent Screen Text");
return this;
}
public selectRedirectUriTextField(number: number, text: string) {
cy.findByTestId(this.redirectUris + number)
cy.findByTestId(this.#redirectUris + number)
.click()
.clear()
.type(text);
@ -224,9 +223,9 @@ export default class SettingsTab extends PageObject {
const redirectUriError =
"Client could not be updated: A redirect URI is not a valid URI";
cy.findByTestId(this.idpInitiatedSsoUrlName).click().type("a");
cy.findByTestId(this.idpInitiatedSsoRelayState).click().type("b");
cy.findByTestId(this.masterSamlProcessingUrl).click().type("c");
cy.findByTestId(this.#idpInitiatedSsoUrlName).click().type("a");
cy.findByTestId(this.#idpInitiatedSsoRelayState).click().type("b");
cy.findByTestId(this.#masterSamlProcessingUrl).click().type("c");
this.selectRedirectUriTextField(0, "Redirect Uri");
cy.findByText("Add valid redirect URIs").click();

View file

@ -2,17 +2,17 @@ import grantClipboardAccess from "../../../../../../../util/grantClipboardAccess
import CommonPage from "../../../../../../CommonPage";
export default class ExportTab extends CommonPage {
private exportDownloadBtn = "authorization-export-download";
private exportCopyBtn = "authorization-export-copy";
#exportDownloadBtn = "authorization-export-download";
#exportCopyBtn = "authorization-export-copy";
copy() {
grantClipboardAccess();
cy.findByTestId(this.exportCopyBtn).click();
cy.findByTestId(this.#exportCopyBtn).click();
return this;
}
export() {
cy.findByTestId(this.exportDownloadBtn).click();
cy.findByTestId(this.#exportDownloadBtn).click();
return this;
}
}

View file

@ -3,18 +3,18 @@ import CreatePermissionPage from "../../CreatePermissionPage";
type PermissionType = "resource" | "scope";
export default class PermissionsTab extends CommonPage {
private createPermissionPage = new CreatePermissionPage();
private createPermissionDrpDwn = "permissionCreateDropdown";
private permissionResourceDrpDwn = "#resources";
#createPermissionPage = new CreatePermissionPage();
#createPermissionDrpDwn = "permissionCreateDropdown";
#permissionResourceDrpDwn = "#resources";
createPermission(type: PermissionType) {
cy.findByTestId(this.createPermissionDrpDwn).click();
cy.findByTestId(this.#createPermissionDrpDwn).click();
cy.findByTestId(`create-${type}`).click();
return this.createPermissionPage;
return this.#createPermissionPage;
}
selectResource(name: string) {
cy.get(this.permissionResourceDrpDwn)
cy.get(this.#permissionResourceDrpDwn)
.click()
.parent()
.parent()

View file

@ -1,14 +1,14 @@
import CommonPage from "../../../../../../CommonPage";
export default class PoliciesTab extends CommonPage {
private emptyPolicyCreateBtn = "no-policies-empty-action";
private createPolicyBtn = "createPolicy";
#emptyPolicyCreateBtn = "no-policies-empty-action";
#createPolicyBtn = "createPolicy";
createPolicy(type: string, first = false) {
if (first) {
cy.findByTestId(this.emptyPolicyCreateBtn).click();
cy.findByTestId(this.#emptyPolicyCreateBtn).click();
} else {
cy.findByTestId(this.createPolicyBtn).click();
cy.findByTestId(this.#createPolicyBtn).click();
}
cy.findByTestId(type).click();
return this;

View file

@ -2,12 +2,12 @@ import CommonPage from "../../../../../../CommonPage";
import CreateResourcePage from "../../CreateResourcePage";
export default class ResourcesTab extends CommonPage {
private createResourcePage = new CreateResourcePage();
private createResourceBtn = "createResource";
#createResourcePage = new CreateResourcePage();
#createResourceBtn = "createResource";
createResource() {
cy.findByTestId(this.createResourceBtn).click();
cy.findByTestId(this.#createResourceBtn).click();
return this.createResourcePage;
return this.#createResourcePage;
}
}

View file

@ -2,11 +2,11 @@ import CommonPage from "../../../../../../CommonPage";
import CreateAuthorizationScopePage from "../../CreateAuthorizationScopePage";
export default class ScopesTab extends CommonPage {
private createAuthorizationScopePage = new CreateAuthorizationScopePage();
private createScopeBtn = "no-authorization-scopes-empty-action";
#createAuthorizationScopePage = new CreateAuthorizationScopePage();
#createScopeBtn = "no-authorization-scopes-empty-action";
createAuthorizationScope() {
cy.findByTestId(this.createScopeBtn).click();
return this.createAuthorizationScopePage;
cy.findByTestId(this.#createScopeBtn).click();
return this.#createAuthorizationScopePage;
}
}

View file

@ -1,29 +1,29 @@
import CommonPage from "../../../../CommonPage";
export default class InitialAccessTokenTab extends CommonPage {
private initialAccessTokenTab = "initialAccessToken";
#initialAccessTokenTab = "initialAccessToken";
private emptyAction = "no-initial-access-tokens-empty-action";
#emptyAction = "no-initial-access-tokens-empty-action";
private expirationNumberInput = "expiration";
private expirationInput = 'input[name="count"]';
private expirationText = "#expiration-helper";
private countInput = '[data-testid="count"] input';
private countPlusBtn = '[data-testid="count"] [aria-label="Plus"]';
private saveBtn = "save";
#expirationNumberInput = "expiration";
#expirationInput = 'input[name="count"]';
#expirationText = "#expiration-helper";
#countInput = '[data-testid="count"] input';
#countPlusBtn = '[data-testid="count"] [aria-label="Plus"]';
#saveBtn = "save";
goToInitialAccessTokenTab() {
cy.findByTestId(this.initialAccessTokenTab).click();
cy.findByTestId(this.#initialAccessTokenTab).click();
return this;
}
shouldBeEmpty() {
cy.findByTestId(this.emptyAction).should("exist");
cy.findByTestId(this.#emptyAction).should("exist");
return this;
}
shouldNotBeEmpty() {
cy.findByTestId(this.emptyAction).should("not.exist");
cy.findByTestId(this.#emptyAction).should("not.exist");
return this;
}
@ -37,28 +37,28 @@ export default class InitialAccessTokenTab extends CommonPage {
}
goToCreateFromEmptyList() {
cy.findByTestId(this.emptyAction).click();
cy.findByTestId(this.#emptyAction).click();
return this;
}
fillNewTokenData(expiration: number, count: number) {
cy.findByTestId(this.expirationNumberInput).clear().type(`${expiration}`);
cy.get(this.countInput).clear();
cy.findByTestId(this.#expirationNumberInput).clear().type(`${expiration}`);
cy.get(this.#countInput).clear();
for (let i = 0; i < count; i++) {
cy.get(this.countPlusBtn).click();
cy.get(this.#countPlusBtn).click();
}
return this;
}
save() {
cy.findByTestId(this.saveBtn).click();
cy.findByTestId(this.#saveBtn).click();
return this;
}
checkExpirationGreaterThanZeroError() {
cy.get(this.expirationText).should(
cy.get(this.#expirationText).should(
"have.text",
"Value should should be greater or equal to 1",
);
@ -66,12 +66,12 @@ export default class InitialAccessTokenTab extends CommonPage {
}
checkCountValue(value: number) {
cy.get(this.expirationInput).should("have.value", value);
cy.get(this.#expirationInput).should("have.value", value);
return this;
}
checkSaveButtonIsDisabled() {
cy.findByTestId(this.saveBtn).should("be.disabled");
cy.findByTestId(this.#saveBtn).should("be.disabled");
return this;
}
}

View file

@ -8,16 +8,16 @@ export enum EventsTab {
}
export default class EventsPage extends CommonPage {
private userEventsTab = new UserEventsTab();
private adminEventsTab = new AdminEventsTab();
#userEventsTab = new UserEventsTab();
#adminEventsTab = new AdminEventsTab();
goToUserEventsTab() {
this.tabUtils().clickTab(EventsTab.UserEvents);
return this.userEventsTab;
return this.#userEventsTab;
}
goToAdminEventsTab() {
this.tabUtils().clickTab(EventsTab.AdminEvents);
return this.adminEventsTab;
return this.#adminEventsTab;
}
}

View file

@ -30,28 +30,30 @@ const emptyStatePage = new EmptyStatePage();
const modalUtils = new ModalUtils();
export default class AdminEventsTab extends PageObject {
private searchAdminEventDrpDwnBtn = "adminEventsSearchSelectorToggle";
private searchEventsBtn = "search-events-btn";
private operationTypesInputFld =
".pf-c-form-control.pf-c-select__toggle-typeahead";
private authAttrDataRow = 'tbody > tr > [data-label="Attribute"]';
private authValDataRow = 'tbody > tr > [data-label="Value"]';
private refreshBtn = "refresh-btn";
private resourcePathInput = "#kc-resourcePath";
private realmInput = "#kc-realm";
private clienInput = "#kc-client";
private userInput = "#kc-user";
private ipAddressInput = "#kc-ipAddress";
private dateFromInput = "#kc-dateFrom";
private dateToInput = "#kc-dateTo";
#searchAdminEventDrpDwnBtn = "adminEventsSearchSelectorToggle";
#searchEventsBtn = "search-events-btn";
#operationTypesInputFld = ".pf-c-form-control.pf-c-select__toggle-typeahead";
#authAttrDataRow = 'tbody > tr > [data-label="Attribute"]';
#authValDataRow = 'tbody > tr > [data-label="Value"]';
#refreshBtn = "refresh-btn";
#resourcePathInput = "#kc-resourcePath";
#realmInput = "#kc-realm";
#clientInput = "#kc-client";
#userInput = "#kc-user";
#ipAddressInput = "#kc-ipAddress";
#dateFromInput = "#kc-dateFrom";
#dateToInput = "#kc-dateTo";
public refresh() {
cy.findByTestId(this.refreshBtn).click();
cy.findByTestId(this.#refreshBtn).click();
return this;
}
public openSearchAdminEventDropdownMenu() {
super.openDropdownMenu("", cy.findByTestId(this.searchAdminEventDrpDwnBtn));
super.openDropdownMenu(
"",
cy.findByTestId(this.#searchAdminEventDrpDwnBtn),
);
return this;
}
@ -63,27 +65,27 @@ export default class AdminEventsTab extends PageObject {
}
public openResourceTypesSelectMenu() {
cy.get(this.operationTypesInputFld).first().click();
cy.get(this.#operationTypesInputFld).first().click();
return this;
}
public closeResourceTypesSelectMenu() {
cy.get(this.operationTypesInputFld).first().click();
cy.get(this.#operationTypesInputFld).first().click();
return this;
}
public openOperationTypesSelectMenu() {
cy.get(this.operationTypesInputFld).last().click();
cy.get(this.#operationTypesInputFld).last().click();
return this;
}
public closeOperationTypesSelectMenu() {
cy.get(this.operationTypesInputFld).last().click();
cy.get(this.#operationTypesInputFld).last().click();
return this;
}
public typeIpAddress(ipAddress: string) {
cy.get(this.ipAddressInput).type(ipAddress);
cy.get(this.#ipAddressInput).type(ipAddress);
return this;
}
@ -104,32 +106,32 @@ export default class AdminEventsTab extends PageObject {
this.closeOperationTypesSelectMenu();
}
if (searchData.resourcePath) {
cy.get(this.resourcePathInput).type(searchData.resourcePath);
cy.get(this.#resourcePathInput).type(searchData.resourcePath);
}
if (searchData.realm) {
cy.get(this.realmInput).type(searchData.realm);
cy.get(this.#realmInput).type(searchData.realm);
}
if (searchData.client) {
cy.get(this.clienInput).type(searchData.client);
cy.get(this.#clientInput).type(searchData.client);
}
if (searchData.user) {
cy.get(this.userInput).type(searchData.user);
cy.get(this.#userInput).type(searchData.user);
}
if (searchData.ipAddress) {
cy.get(this.ipAddressInput).type(searchData.ipAddress);
cy.get(this.#ipAddressInput).type(searchData.ipAddress);
}
if (searchData.dateFrom) {
cy.get(this.dateFromInput).type(searchData.dateFrom);
cy.get(this.#dateFromInput).type(searchData.dateFrom);
}
if (searchData.dateTo) {
cy.get(this.dateToInput).type(searchData.dateTo);
cy.get(this.#dateToInput).type(searchData.dateTo);
}
cy.findByTestId(this.searchEventsBtn).click();
cy.findByTestId(this.#searchEventsBtn).click();
return this;
}
public assertSearchAdminBtnEnabled(disabled: boolean) {
super.assertIsEnabled(cy.findByTestId(this.searchEventsBtn), disabled);
super.assertIsEnabled(cy.findByTestId(this.#searchEventsBtn), disabled);
return this;
}
@ -289,8 +291,8 @@ export default class AdminEventsTab extends PageObject {
.assertModalMessageContainText("Client")
.assertModalMessageContainText("User")
.assertModalMessageContainText("IP address")
.assertModalHasElement(this.authAttrDataRow, true)
.assertModalHasElement(this.authValDataRow, true)
.assertModalHasElement(this.#authAttrDataRow, true)
.assertModalHasElement(this.#authValDataRow, true)
.closeModal();
return this;
}

View file

@ -22,32 +22,32 @@ export class UserEventSearchData {
const emptyStatePage = new EmptyStatePage();
export default class UserEventsTab extends PageObject {
private searchUserEventDrpDwnToggle = "userEventsSearchSelectorToggle";
private searchUserIdInput = "#kc-userId";
private searchEventTypeSelectToggle =
#searchUserEventDrpDwnToggle = "userEventsSearchSelectorToggle";
#searchUserIdInput = "#kc-userId";
#searchEventTypeSelectToggle =
".pf-c-select.keycloak__events_search__type_select";
private searchClientInput = "#kc-client";
private searchDateFromInput = "#kc-dateFrom";
private searchDateToInput = "#kc-dateTo";
private searchIpAddress = "#kc-ipAddress";
private searchEventsBtn = "search-events-btn";
private refreshBtn = "refresh-btn";
#searchClientInput = "#kc-client";
#searchDateFromInput = "#kc-dateFrom";
#searchDateToInput = "#kc-dateTo";
#searchIpAddress = "#kc-ipAddress";
#searchEventsBtn = "search-events-btn";
#refreshBtn = "refresh-btn";
public openSearchUserEventDropdownMenu() {
super.openDropdownMenu(
"",
cy.findByTestId(this.searchUserEventDrpDwnToggle),
cy.findByTestId(this.#searchUserEventDrpDwnToggle),
);
return this;
}
public openEventTypeSelectMenu() {
super.openSelectMenu("", cy.get(this.searchEventTypeSelectToggle));
super.openSelectMenu("", cy.get(this.#searchEventTypeSelectToggle));
return this;
}
public closeEventTypeSelectMenu() {
super.closeSelectMenu("", cy.get(this.searchEventTypeSelectToggle));
super.closeSelectMenu("", cy.get(this.#searchEventTypeSelectToggle));
return this;
}
@ -57,7 +57,7 @@ export default class UserEventsTab extends PageObject {
}
public assertSearchEventBtnIsEnabled(enabled: boolean) {
super.assertIsEnabled(cy.findByTestId(this.searchEventsBtn), enabled);
super.assertIsEnabled(cy.findByTestId(this.#searchEventsBtn), enabled);
return this;
}
@ -69,22 +69,25 @@ export default class UserEventsTab extends PageObject {
}
public assertSearchUserEventDropdownMenuExist(exist: boolean) {
super.assertExist(cy.findByTestId(this.searchUserEventDrpDwnToggle), exist);
super.assertExist(
cy.findByTestId(this.#searchUserEventDrpDwnToggle),
exist,
);
return this;
}
public refresh() {
cy.findByTestId(this.refreshBtn).click();
cy.findByTestId(this.#refreshBtn).click();
return this;
}
public typeUserId(userId: string) {
cy.get(this.searchUserIdInput).type(userId);
cy.get(this.#searchUserIdInput).type(userId);
return this;
}
public typeIpAddress(ipAddress: string) {
cy.get(this.searchIpAddress).type(ipAddress);
cy.get(this.#searchIpAddress).type(ipAddress);
return this;
}
@ -101,18 +104,18 @@ export default class UserEventsTab extends PageObject {
this.closeEventTypeSelectMenu();
}
if (searchData.client) {
cy.get(this.searchClientInput).type(searchData.client);
cy.get(this.#searchClientInput).type(searchData.client);
}
if (searchData.dateFrom) {
cy.get(this.searchDateFromInput).type(searchData.dateFrom);
cy.get(this.#searchDateFromInput).type(searchData.dateFrom);
}
if (searchData.dateTo) {
cy.get(this.searchDateToInput).type(searchData.dateTo);
cy.get(this.#searchDateToInput).type(searchData.dateTo);
}
if (searchData.ipAddress) {
cy.get(this.searchIpAddress).type(searchData.ipAddress);
cy.get(this.#searchIpAddress).type(searchData.ipAddress);
}
cy.findByTestId(this.searchEventsBtn).click();
cy.findByTestId(this.#searchEventsBtn).click();
return this;
}

View file

@ -1,30 +1,30 @@
import ModalUtils from "../../../../util/ModalUtils";
export default class GroupModal extends ModalUtils {
private createGroupModalTitle = "Create a group";
private groupNameInput = "groupNameInput";
private createGroupBnt = "createGroup";
private renameButton = "renameGroup";
#createGroupModalTitle = "Create a group";
#groupNameInput = "groupNameInput";
#createGroupBnt = "createGroup";
#renameButton = "renameGroup";
public setGroupNameInput(name: string) {
cy.findByTestId(this.groupNameInput).clear().type(name);
cy.findByTestId(this.#groupNameInput).clear().type(name);
return this;
}
public create() {
cy.findByTestId(this.createGroupBnt).click();
cy.findByTestId(this.#createGroupBnt).click();
return this;
}
public rename() {
cy.findByTestId(this.renameButton).click();
cy.findByTestId(this.#renameButton).click();
return this;
}
public assertCreateGroupModalVisible(isVisible: boolean) {
super
.assertModalVisible(isVisible)
.assertModalTitleEqual(this.createGroupModalTitle);
.assertModalTitleEqual(this.#createGroupModalTitle);
return this;
}
}

View file

@ -13,15 +13,15 @@ const sidebarPage = new SidebarPage();
export default class GroupPage extends PageObject {
protected createGroupEmptyStateBtn = "no-groups-in-this-realm-empty-action";
private createGroupBtn = "openCreateGroupModal";
#createGroupBtn = "openCreateGroupModal";
protected actionDrpDwnButton = "action-dropdown";
private searchField = "[data-testid='group-search']";
#searchField = "[data-testid='group-search']";
public openCreateGroupModal(emptyState: boolean) {
if (emptyState) {
cy.findByTestId(this.createGroupEmptyStateBtn).click();
} else {
cy.findByTestId(this.createGroupBtn).click();
cy.findByTestId(this.#createGroupBtn).click();
}
return this;
}
@ -37,7 +37,7 @@ export default class GroupPage extends PageObject {
}
public searchGroup(searchValue: string, wait: boolean = false) {
this.search(this.searchField, searchValue, wait);
this.search(this.#searchField, searchValue, wait);
return this;
}

View file

@ -1,8 +1,8 @@
import ModalUtils from "../../../../util/ModalUtils";
export default class MoveGroupModal extends ModalUtils {
private moveButton = "moveHere-button";
private title = ".pf-c-modal-box__title";
#moveButton = "moveHere-button";
#title = ".pf-c-modal-box__title";
clickRow(groupName: string) {
cy.findByTestId(groupName).click();
@ -15,12 +15,12 @@ export default class MoveGroupModal extends ModalUtils {
}
checkTitle(title: string) {
cy.get(this.title).should("have.text", title);
cy.get(this.#title).should("have.text", title);
return this;
}
clickMove() {
cy.findByTestId(this.moveButton).click();
cy.findByTestId(this.#moveButton).click();
return this;
}
}

View file

@ -2,9 +2,9 @@ import SidebarPage from "../../SidebarPage";
import GroupPage from "./GroupPage";
export class SearchGroupPage extends GroupPage {
private groupSearchField = "group-search";
private searchButton = "[data-testid='group-search'] > button";
private sidebarPage = new SidebarPage();
#groupSearchField = "group-search";
#searchButton = "[data-testid='group-search'] > button";
#sidebarPage = new SidebarPage();
public searchGroup(groupName: string) {
this.typeSearchInput(groupName);
@ -20,17 +20,17 @@ export class SearchGroupPage extends GroupPage {
public goToGroupChildGroupsFromTree(item: string) {
cy.get(".pf-c-tree-view__content").contains(item).click();
this.sidebarPage.waitForPageLoad();
this.#sidebarPage.waitForPageLoad();
return this;
}
public typeSearchInput(value: string) {
cy.findByTestId(this.groupSearchField).type(value);
cy.findByTestId(this.#groupSearchField).type(value);
return this;
}
public clickSearchButton() {
cy.get(this.searchButton).click();
cy.get(this.#searchButton).click();
return this;
}

View file

@ -7,45 +7,45 @@ const listingPage = new ListingPage();
const groupPage = new GroupPage();
export default class GroupDetailPage extends GroupPage {
private groupNamesColumn = '[data-label="Group name"] > a';
private memberTab = "members";
private childGroupsTab = "groups";
private attributesTab = "attributes";
private roleMappingTab = "role-mapping-tab";
private permissionsTab = "permissionsTab";
private memberNameColumn =
#groupNamesColumn = '[data-label="Group name"] > a';
#memberTab = "members";
#childGroupsTab = "groups";
#attributesTab = "attributes";
#roleMappingTab = "role-mapping-tab";
#permissionsTab = "permissionsTab";
#memberNameColumn =
'[data-testid="members-table"] > tbody > tr > [data-label="Name"]';
private addMembers = "addMember";
private memberUsernameColumn = 'tbody > tr > [data-label="Username"]';
private actionDrpDwnItemRenameGroup = "renameGroupAction";
private actionDrpDwnItemDeleteGroup = "deleteGroup";
private headerGroupName = ".pf-l-level.pf-m-gutter";
private renameGroupModalGroupNameInput = "groupNameInput";
private renameGroupModalRenameBtn = "renameGroup";
private permissionSwitch = "permissionSwitch";
#addMembers = "addMember";
#memberUsernameColumn = 'tbody > tr > [data-label="Username"]';
#actionDrpDwnItemRenameGroup = "renameGroupAction";
#actionDrpDwnItemDeleteGroup = "deleteGroup";
#headerGroupName = ".pf-l-level.pf-m-gutter";
#renameGroupModalGroupNameInput = "groupNameInput";
#renameGroupModalRenameBtn = "renameGroup";
#permissionSwitch = "permissionSwitch";
public goToChildGroupsTab() {
cy.findByTestId(this.childGroupsTab).click();
cy.findByTestId(this.#childGroupsTab).click();
return this;
}
public goToMembersTab() {
cy.findByTestId(this.memberTab).click();
cy.findByTestId(this.#memberTab).click();
return this;
}
public goToAttributesTab() {
cy.findByTestId(this.attributesTab).click();
cy.findByTestId(this.#attributesTab).click();
return this;
}
public goToRoleMappingTab() {
cy.findByTestId(this.roleMappingTab).click();
cy.findByTestId(this.#roleMappingTab).click();
return this;
}
public goToPermissionsTab() {
cy.findByTestId(this.permissionsTab).click();
cy.findByTestId(this.#permissionsTab).click();
return this;
}
@ -53,7 +53,7 @@ export default class GroupDetailPage extends GroupPage {
super.openDropdownMenu("", cy.findByTestId(this.actionDrpDwnButton));
super.clickDropdownMenuItem(
"",
cy.findByTestId(this.actionDrpDwnItemRenameGroup),
cy.findByTestId(this.#actionDrpDwnItemRenameGroup),
);
return this;
}
@ -62,7 +62,7 @@ export default class GroupDetailPage extends GroupPage {
super.openDropdownMenu("", cy.findByTestId(this.actionDrpDwnButton));
super.clickDropdownMenuItem(
"",
cy.findByTestId(this.actionDrpDwnItemDeleteGroup),
cy.findByTestId(this.#actionDrpDwnItemDeleteGroup),
);
modalUtils.confirmModal();
return this;
@ -71,10 +71,10 @@ export default class GroupDetailPage extends GroupPage {
public renameGroup(newGroupName: string) {
this.headerActionRenameGroup();
modalUtils.checkModalTitle("Rename group");
cy.findByTestId(this.renameGroupModalGroupNameInput)
cy.findByTestId(this.#renameGroupModalGroupNameInput)
.clear()
.type(newGroupName);
cy.findByTestId(this.renameGroupModalRenameBtn).click();
cy.findByTestId(this.#renameGroupModalRenameBtn).click();
return this;
}
@ -84,12 +84,12 @@ export default class GroupDetailPage extends GroupPage {
}
public assertHeaderGroupNameEqual(groupName: string) {
cy.get(this.headerGroupName).find("h1").should("have.text", groupName);
cy.get(this.#headerGroupName).find("h1").should("have.text", groupName);
return this;
}
checkListSubGroup(subGroups: string[]) {
cy.get(this.groupNamesColumn).should((groups) => {
cy.get(this.#groupNamesColumn).should((groups) => {
expect(groups).to.have.length(subGroups.length);
for (let index = 0; index < subGroups.length; index++) {
const subGroup = subGroups[index];
@ -100,12 +100,12 @@ export default class GroupDetailPage extends GroupPage {
}
clickMembersTab() {
cy.findByTestId(this.memberTab).click();
cy.findByTestId(this.#memberTab).click();
return this;
}
checkListMembers(members: string[]) {
cy.get(this.memberNameColumn).should((member) => {
cy.get(this.#memberNameColumn).should((member) => {
expect(member).to.have.length(members.length);
for (let index = 0; index < members.length; index++) {
expect(member.eq(index)).to.contain(members[index]);
@ -115,7 +115,7 @@ export default class GroupDetailPage extends GroupPage {
}
checkSelectableMembers(members: string[]) {
cy.get(this.memberUsernameColumn).should((member) => {
cy.get(this.#memberUsernameColumn).should((member) => {
for (const user of members) {
expect(member).to.contain(user);
}
@ -125,7 +125,7 @@ export default class GroupDetailPage extends GroupPage {
selectUsers(users: string[]) {
for (const user of users) {
cy.get(this.memberUsernameColumn)
cy.get(this.#memberUsernameColumn)
.contains(user)
.parent()
.find("input")
@ -135,19 +135,19 @@ export default class GroupDetailPage extends GroupPage {
}
clickAddMembers() {
cy.findByTestId(this.addMembers).click();
cy.findByTestId(this.#addMembers).click();
return this;
}
enablePermissionSwitch() {
cy.findByTestId(this.permissionSwitch).parent().click();
this.assertSwitchStateOn(cy.findByTestId(this.permissionSwitch));
cy.findByTestId(this.permissionSwitch).parent().click();
cy.findByTestId(this.#permissionSwitch).parent().click();
this.assertSwitchStateOn(cy.findByTestId(this.#permissionSwitch));
cy.findByTestId(this.#permissionSwitch).parent().click();
modalUtils
.checkModalTitle("Disable permissions?")
.checkConfirmButtonText("Confirm")
.confirmModal();
this.assertSwitchStateOff(cy.findByTestId(this.permissionSwitch));
this.assertSwitchStateOff(cy.findByTestId(this.#permissionSwitch));
return this;
}

View file

@ -10,16 +10,16 @@ const masthead = new Masthead();
const sidebarPage = new SidebarPage();
export default class MembersTab extends GroupDetailPage {
private addMemberEmptyStateBtn = "no-users-found-empty-action";
private addMemberBtn = "addMember";
private includeSubGroupsCheck = "includeSubGroupsCheck";
#addMemberEmptyStateBtn = "no-users-found-empty-action";
#addMemberBtn = "addMember";
#includeSubGroupsCheck = "includeSubGroupsCheck";
public openAddMemberModal(emptyState: boolean) {
cy.intercept("GET", "*/admin/realms/master/users?first=*").as("get");
if (emptyState) {
cy.findByTestId(this.addMemberEmptyStateBtn).click();
cy.findByTestId(this.#addMemberEmptyStateBtn).click();
} else {
cy.findByTestId(this.addMemberBtn).click();
cy.findByTestId(this.#addMemberBtn).click();
}
sidebarPage.waitForPageLoad();
return this;
@ -55,7 +55,7 @@ export default class MembersTab extends GroupDetailPage {
}
public clickCheckboxIncludeSubGroupUsers() {
cy.findByTestId(this.includeSubGroupsCheck).click();
cy.findByTestId(this.#includeSubGroupsCheck).click();
return this;
}

View file

@ -1,45 +1,45 @@
import LegacyKeyValueInput from "../LegacyKeyValueInput";
export default class AddMapperPage {
private mappersTab = "mappers-tab";
private noMappersAddMapperButton = "no-mappers-empty-action";
private idpMapperSelectToggle = "#identityProviderMapper";
private idpMapperSelect = "idp-mapper-select";
private addMapperButton = "#add-mapper-button";
#mappersTab = "mappers-tab";
#noMappersAddMapperButton = "no-mappers-empty-action";
#idpMapperSelectToggle = "#identityProviderMapper";
#idpMapperSelect = "idp-mapper-select";
#addMapperButton = "#add-mapper-button";
private mapperNameInput = "#kc-name";
private attribute = "user.attribute";
private attributeName = "attribute.name";
private attributeFriendlyName = "attribute.friendly.name";
private claimInput = "claim";
private socialProfileJSONfieldPath = "jsonField";
private userAttribute = "attribute";
private userAttributeName = "userAttribute";
private userAttributeValue = "attribute.value";
private userSessionAttribute = "attribute";
private userSessionAttributeValue = "attribute.value";
private newMapperSaveButton = "new-mapper-save-button";
private newMapperCancelButton = "new-mapper-cancel-button";
private mappersUrl = "/oidc/mappers";
private regexAttributeValuesSwitch = "are.attribute.values.regex";
private syncmodeSelectToggle = "#syncMode";
private attributesKeyInput = '[data-testid="config.attributes.0.key"]';
private attributesValueInput = '[data-testid="config.attributes.0.value"]';
private template = "template";
private target = "#target";
#mapperNameInput = "#kc-name";
#attribute = "user.attribute";
#attributeName = "attribute.name";
#attributeFriendlyName = "attribute.friendly.name";
#claimInput = "claim";
#socialProfileJSONfieldPath = "jsonField";
#userAttribute = "attribute";
#userAttributeName = "userAttribute";
#userAttributeValue = "attribute.value";
#userSessionAttribute = "attribute";
#userSessionAttributeValue = "attribute.value";
#newMapperSaveButton = "new-mapper-save-button";
#newMapperCancelButton = "new-mapper-cancel-button";
#mappersUrl = "/oidc/mappers";
#regexAttributeValuesSwitch = "are.attribute.values.regex";
#syncmodeSelectToggle = "#syncMode";
#attributesKeyInput = '[data-testid="config.attributes.0.key"]';
#attributesValueInput = '[data-testid="config.attributes.0.value"]';
#template = "template";
#target = "#target";
goToMappersTab() {
cy.findByTestId(this.mappersTab).click();
cy.findByTestId(this.#mappersTab).click();
return this;
}
emptyStateAddMapper() {
cy.findByTestId(this.noMappersAddMapperButton).click();
cy.findByTestId(this.#noMappersAddMapperButton).click();
return this;
}
addMapper() {
cy.get(this.addMapperButton).click();
cy.get(this.#addMapperButton).click();
return this;
}
@ -49,12 +49,12 @@ export default class AddMapperPage {
}
saveNewMapper() {
cy.findByTestId(this.newMapperSaveButton).click();
cy.findByTestId(this.#newMapperSaveButton).click();
return this;
}
cancelNewMapper() {
cy.findByTestId(this.newMapperCancelButton).click();
cy.findByTestId(this.#newMapperCancelButton).click();
return this;
}
@ -65,28 +65,28 @@ export default class AddMapperPage {
}
fillSocialMapper(name: string) {
cy.get(this.mapperNameInput).clear();
cy.get(this.#mapperNameInput).clear();
cy.get(this.mapperNameInput).clear().type(name);
cy.get(this.#mapperNameInput).clear().type(name);
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("legacy").click();
cy.get(this.idpMapperSelectToggle).click();
cy.get(this.#idpMapperSelectToggle).click();
cy.findByTestId(this.idpMapperSelect)
cy.findByTestId(this.#idpMapperSelect)
.contains("Attribute Importer")
.click();
cy.findByTestId(this.socialProfileJSONfieldPath).clear();
cy.findByTestId(this.socialProfileJSONfieldPath).type(
cy.findByTestId(this.#socialProfileJSONfieldPath).clear();
cy.findByTestId(this.#socialProfileJSONfieldPath).type(
"social profile JSON field path",
);
cy.findByTestId(this.userAttributeName).clear();
cy.findByTestId(this.#userAttributeName).clear();
cy.findByTestId(this.userAttributeName).type("user attribute name");
cy.findByTestId(this.#userAttributeName).type("user attribute name");
this.saveNewMapper();
@ -101,27 +101,27 @@ export default class AddMapperPage {
}
addAdvancedAttrToRoleMapper(name: string) {
cy.get(this.mapperNameInput).clear();
cy.get(this.#mapperNameInput).clear();
cy.get(this.mapperNameInput).clear().type(name);
cy.get(this.#mapperNameInput).clear().type(name);
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("inherit").click();
cy.get(this.idpMapperSelectToggle).click();
cy.get(this.#idpMapperSelectToggle).click();
cy.findByTestId(this.idpMapperSelect)
cy.findByTestId(this.#idpMapperSelect)
.contains("Advanced Attribute to Role")
.click();
cy.get(this.attributesKeyInput).clear();
cy.get(this.attributesKeyInput).type("key");
cy.get(this.#attributesKeyInput).clear();
cy.get(this.#attributesKeyInput).type("key");
cy.get(this.attributesValueInput).clear();
cy.get(this.attributesValueInput).type("value");
cy.get(this.#attributesValueInput).clear();
cy.get(this.#attributesValueInput).type("value");
this.toggleSwitch(this.regexAttributeValuesSwitch);
this.toggleSwitch(this.#regexAttributeValuesSwitch);
this.addRoleToMapperForm();
@ -131,24 +131,24 @@ export default class AddMapperPage {
}
addUsernameTemplateImporterMapper(name: string) {
cy.get(this.mapperNameInput).clear();
cy.get(this.#mapperNameInput).clear();
cy.get(this.mapperNameInput).clear().type(name);
cy.get(this.#mapperNameInput).clear().type(name);
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("inherit").click();
cy.get(this.idpMapperSelectToggle).click();
cy.get(this.#idpMapperSelectToggle).click();
cy.findByTestId(this.idpMapperSelect)
cy.findByTestId(this.#idpMapperSelect)
.contains("Username Template Importer")
.click();
cy.findByTestId(this.template).clear();
cy.findByTestId(this.template).type("Template");
cy.findByTestId(this.#template).clear();
cy.findByTestId(this.#template).type("Template");
cy.get(this.target).click().parent().contains("BROKER_ID").click();
cy.get(this.#target).click().parent().contains("BROKER_ID").click();
this.saveNewMapper();
@ -156,25 +156,25 @@ export default class AddMapperPage {
}
addHardcodedUserSessionAttrMapper(name: string) {
cy.get(this.mapperNameInput).clear();
cy.get(this.#mapperNameInput).clear();
cy.get(this.mapperNameInput).clear().type(name);
cy.get(this.#mapperNameInput).clear().type(name);
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("inherit").click();
cy.get(this.idpMapperSelectToggle).click();
cy.get(this.#idpMapperSelectToggle).click();
cy.findByTestId(this.idpMapperSelect)
cy.findByTestId(this.#idpMapperSelect)
.contains("Hardcoded User Session Attribute")
.click();
cy.findByTestId(this.userSessionAttribute).clear();
cy.findByTestId(this.userSessionAttribute).type("user session attribute");
cy.findByTestId(this.#userSessionAttribute).clear();
cy.findByTestId(this.#userSessionAttribute).type("user session attribute");
cy.findByTestId(this.userSessionAttributeValue).clear();
cy.findByTestId(this.userSessionAttributeValue).type(
cy.findByTestId(this.#userSessionAttributeValue).clear();
cy.findByTestId(this.#userSessionAttributeValue).type(
"user session attribute value",
);
@ -184,27 +184,29 @@ export default class AddMapperPage {
}
addSAMLAttrImporterMapper(name: string) {
cy.get(this.mapperNameInput).clear();
cy.get(this.#mapperNameInput).clear();
cy.get(this.mapperNameInput).clear().type(name);
cy.get(this.#mapperNameInput).clear().type(name);
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("inherit").click();
cy.get(this.idpMapperSelectToggle).click();
cy.get(this.#idpMapperSelectToggle).click();
cy.findByTestId(this.idpMapperSelect)
cy.findByTestId(this.#idpMapperSelect)
.contains("Attribute Importer")
.click();
cy.findByTestId(this.attributeName).clear();
cy.findByTestId(this.attributeName).type("attribute name");
cy.findByTestId(this.#attributeName).clear();
cy.findByTestId(this.#attributeName).type("attribute name");
cy.findByTestId(this.attributeFriendlyName).clear();
cy.findByTestId(this.attributeFriendlyName).type("attribute friendly name");
cy.findByTestId(this.#attributeFriendlyName).clear();
cy.findByTestId(this.#attributeFriendlyName).type(
"attribute friendly name",
);
cy.findByTestId(this.attribute).clear().type("user attribute name");
cy.findByTestId(this.#attribute).clear().type("user attribute name");
this.saveNewMapper();
@ -212,22 +214,22 @@ export default class AddMapperPage {
}
addOIDCAttrImporterMapper(name: string) {
cy.get(this.mapperNameInput).clear();
cy.get(this.#mapperNameInput).clear();
cy.get(this.mapperNameInput).clear().type(name);
cy.get(this.#mapperNameInput).clear().type(name);
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("inherit").click();
cy.get(this.idpMapperSelectToggle).click();
cy.get(this.#idpMapperSelectToggle).click();
cy.findByTestId(this.idpMapperSelect)
cy.findByTestId(this.#idpMapperSelect)
.contains("Attribute Importer")
.click();
cy.findByTestId(this.claimInput).clear().type("claim");
cy.findByTestId(this.attribute).clear().type("user attribute name");
cy.findByTestId(this.#claimInput).clear().type("claim");
cy.findByTestId(this.#attribute).clear().type("user attribute name");
this.saveNewMapper();
@ -235,17 +237,17 @@ export default class AddMapperPage {
}
addHardcodedRoleMapper(name: string) {
cy.get(this.mapperNameInput).clear();
cy.get(this.#mapperNameInput).clear();
cy.get(this.mapperNameInput).clear().type(name);
cy.get(this.#mapperNameInput).clear().type(name);
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("inherit").click();
cy.get(this.idpMapperSelectToggle).click();
cy.get(this.#idpMapperSelectToggle).click();
cy.findByTestId(this.idpMapperSelect).contains("Hardcoded Role").click();
cy.findByTestId(this.#idpMapperSelect).contains("Hardcoded Role").click();
this.addRoleToMapperForm();
this.saveNewMapper();
@ -254,23 +256,23 @@ export default class AddMapperPage {
}
addHardcodedAttrMapper(name: string) {
cy.get(this.mapperNameInput).clear();
cy.get(this.#mapperNameInput).clear();
cy.get(this.mapperNameInput).clear().type(name);
cy.get(this.#mapperNameInput).clear().type(name);
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("inherit").click();
cy.get(this.idpMapperSelectToggle).click();
cy.get(this.#idpMapperSelectToggle).click();
cy.findByTestId(this.idpMapperSelect)
cy.findByTestId(this.#idpMapperSelect)
.contains("Hardcoded Attribute")
.click();
cy.findByTestId(this.userAttribute).clear().type("user session attribute");
cy.findByTestId(this.#userAttribute).clear().type("user session attribute");
cy.findByTestId(this.userAttributeValue)
cy.findByTestId(this.#userAttributeValue)
.clear()
.type("user session attribute value");
@ -280,17 +282,17 @@ export default class AddMapperPage {
}
addSAMLAttributeToRoleMapper(name: string) {
cy.get(this.mapperNameInput).clear();
cy.get(this.#mapperNameInput).clear();
cy.get(this.mapperNameInput).clear().type(name);
cy.get(this.#mapperNameInput).clear().type(name);
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("inherit").click();
cy.get(this.idpMapperSelectToggle).click();
cy.get(this.#idpMapperSelectToggle).click();
cy.findByTestId(this.idpMapperSelect)
cy.findByTestId(this.#idpMapperSelect)
.contains("SAML Attribute to Role")
.click();
@ -302,13 +304,13 @@ export default class AddMapperPage {
}
editUsernameTemplateImporterMapper() {
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("legacy").click();
cy.findByTestId(this.template).type("_edited");
cy.findByTestId(this.#template).type("_edited");
cy.get(this.target).click().parent().contains("BROKER_USERNAME").click();
cy.get(this.#target).click().parent().contains("BROKER_USERNAME").click();
this.saveNewMapper();
@ -316,19 +318,19 @@ export default class AddMapperPage {
}
editSocialMapper() {
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("inherit").click();
cy.findByTestId(this.socialProfileJSONfieldPath).clear();
cy.findByTestId(this.#socialProfileJSONfieldPath).clear();
cy.findByTestId(this.socialProfileJSONfieldPath).type(
cy.findByTestId(this.#socialProfileJSONfieldPath).type(
"social profile JSON field path edited",
);
cy.findByTestId(this.userAttributeName).clear();
cy.findByTestId(this.#userAttributeName).clear();
cy.findByTestId(this.userAttributeName).type("user attribute name edited");
cy.findByTestId(this.#userAttributeName).type("user attribute name edited");
this.saveNewMapper();
@ -336,17 +338,17 @@ export default class AddMapperPage {
}
editSAMLorOIDCMapper() {
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("legacy").click();
cy.get(this.attributesKeyInput).clear();
cy.get(this.attributesKeyInput).type("key_edited");
cy.get(this.#attributesKeyInput).clear();
cy.get(this.#attributesKeyInput).type("key_edited");
cy.get(this.attributesValueInput).clear();
cy.get(this.attributesValueInput).type("value_edited");
cy.get(this.#attributesValueInput).clear();
cy.get(this.#attributesValueInput).type("value_edited");
this.toggleSwitch(this.regexAttributeValuesSwitch);
this.toggleSwitch(this.#regexAttributeValuesSwitch);
this.saveNewMapper();
@ -354,25 +356,25 @@ export default class AddMapperPage {
}
addOIDCAttributeImporterMapper(name: string) {
cy.get(this.mapperNameInput).clear();
cy.get(this.#mapperNameInput).clear();
cy.get(this.mapperNameInput).clear().type(name);
cy.get(this.#mapperNameInput).clear().type(name);
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("inherit").click();
cy.get(this.idpMapperSelectToggle).click();
cy.get(this.#idpMapperSelectToggle).click();
cy.findByTestId(this.idpMapperSelect)
cy.findByTestId(this.#idpMapperSelect)
.contains("Attribute Importer")
.click();
cy.findByTestId(this.claimInput).clear();
cy.findByTestId(this.claimInput).type("claim");
cy.findByTestId(this.#claimInput).clear();
cy.findByTestId(this.#claimInput).type("claim");
cy.findByTestId(this.userAttributeName).clear();
cy.findByTestId(this.userAttributeName).type("user attribute name");
cy.findByTestId(this.#userAttributeName).clear();
cy.findByTestId(this.#userAttributeName).type("user attribute name");
this.saveNewMapper();
@ -380,17 +382,17 @@ export default class AddMapperPage {
}
addOIDCClaimToRoleMapper(name: string) {
cy.get(this.mapperNameInput).clear();
cy.get(this.#mapperNameInput).clear();
cy.get(this.mapperNameInput).clear().type(name);
cy.get(this.#mapperNameInput).clear().type(name);
cy.get(this.syncmodeSelectToggle).click();
cy.get(this.#syncmodeSelectToggle).click();
cy.findByTestId("inherit").click();
cy.get(this.idpMapperSelectToggle).click();
cy.get(this.#idpMapperSelectToggle).click();
cy.findByTestId(this.idpMapperSelect).contains("Claim to Role").click();
cy.findByTestId(this.#idpMapperSelect).contains("Claim to Role").click();
const keyValue = new LegacyKeyValueInput("config.claims");
@ -405,7 +407,7 @@ export default class AddMapperPage {
}
shouldGoToMappersTab() {
cy.url().should("include", this.mappersUrl);
cy.url().should("include", this.#mappersUrl);
return this;
}

View file

@ -1,19 +1,19 @@
export default class CreateProviderPage {
private github = "github";
private clientIdField = "clientId";
private clientIdError = "#kc-client-secret-helper";
private clientSecretField = "clientSecret";
private displayName = "displayName";
private discoveryEndpoint = "discoveryEndpoint";
private authorizationUrl = "authorizationUrl";
private addButton = "createProvider";
private saveButton = "idp-details-save";
private ssoServiceUrl = "sso-service-url";
private authnContextClassRefs = "classref-field";
private authnContextDeclRefs = "declref-field";
private addProvider = "Add provider";
private addClassRef = "Add AuthnContext ClassRef";
private addDeclRef = "Add AuthnContext DeclRef";
#github = "github";
#clientIdField = "clientId";
#clientIdError = "#kc-client-secret-helper";
#clientSecretField = "clientSecret";
#displayName = "displayName";
#discoveryEndpoint = "discoveryEndpoint";
#authorizationUrl = "authorizationUrl";
#addButton = "createProvider";
#saveButton = "idp-details-save";
#ssoServiceUrl = "sso-service-url";
#authnContextClassRefs = "classref-field";
#authnContextDeclRefs = "declref-field";
#addProvider = "Add provider";
#addClassRef = "Add AuthnContext ClassRef";
#addDeclRef = "Add AuthnContext DeclRef";
checkVisible(name: string) {
cy.findByTestId(`${name}-card`).should("exist");
@ -26,50 +26,50 @@ export default class CreateProviderPage {
}
clickGitHubCard() {
this.clickCard(this.github);
this.clickCard(this.#github);
return this;
}
checkGitHubCardVisible() {
this.checkVisible(this.github);
this.checkVisible(this.#github);
return this;
}
checkClientIdRequiredMessage(exist = true) {
cy.get(this.clientIdError).should((!exist ? "not." : "") + "exist");
cy.get(this.#clientIdError).should((!exist ? "not." : "") + "exist");
return this;
}
checkAddButtonDisabled(disabled = true) {
cy.findByTestId(this.addButton).should(
cy.findByTestId(this.#addButton).should(
!disabled ? "not." : "" + "be.disabled",
);
return this;
}
clickAdd() {
cy.findByTestId(this.addButton).click();
cy.findByTestId(this.#addButton).click();
return this;
}
clickSave() {
cy.findByTestId(this.saveButton).click();
cy.findByTestId(this.#saveButton).click();
return this;
}
clickClassRefsAdd() {
cy.contains(this.addClassRef).click();
cy.contains(this.#addClassRef).click();
return this;
}
clickDeclRefsAdd() {
cy.contains(this.addDeclRef).click();
cy.contains(this.#addDeclRef).click();
return this;
}
clickCreateDropdown() {
cy.contains(this.addProvider).click();
cy.contains(this.#addProvider).click();
return this;
}
@ -79,51 +79,51 @@ export default class CreateProviderPage {
}
fill(id: string, secret = "") {
cy.findByTestId(this.clientIdField).clear();
cy.findByTestId(this.#clientIdField).clear();
if (id) {
cy.findByTestId(this.clientIdField).type(id);
cy.findByTestId(this.#clientIdField).type(id);
}
if (secret) {
cy.findByTestId(this.clientSecretField).type(secret);
cy.findByTestId(this.#clientSecretField).type(secret);
}
return this;
}
fillDisplayName(value: string) {
cy.findByTestId(this.displayName).type("x");
cy.findByTestId(this.displayName).clear().type(value).blur();
cy.findByTestId(this.#displayName).type("x");
cy.findByTestId(this.#displayName).clear().type(value).blur();
return this;
}
fillDiscoveryUrl(value: string) {
cy.findByTestId(this.discoveryEndpoint).type("x");
cy.findByTestId(this.discoveryEndpoint).clear().type(value).blur();
cy.findByTestId(this.#discoveryEndpoint).type("x");
cy.findByTestId(this.#discoveryEndpoint).clear().type(value).blur();
return this;
}
fillAuthnContextClassRefs(value: string) {
cy.findByTestId(this.authnContextClassRefs).type("x");
cy.findByTestId(this.authnContextClassRefs).clear().type(value).blur();
cy.findByTestId(this.#authnContextClassRefs).type("x");
cy.findByTestId(this.#authnContextClassRefs).clear().type(value).blur();
return this;
}
fillAuthnContextDeclRefs(value: string) {
cy.findByTestId(this.authnContextDeclRefs).type("x");
cy.findByTestId(this.authnContextDeclRefs).clear().type(value).blur();
cy.findByTestId(this.#authnContextDeclRefs).type("x");
cy.findByTestId(this.#authnContextDeclRefs).clear().type(value).blur();
return this;
}
fillSsoServiceUrl(value: string) {
cy.findByTestId(this.ssoServiceUrl).type("x");
cy.findByTestId(this.ssoServiceUrl).clear().type(value).blur();
cy.findByTestId(this.#ssoServiceUrl).type("x");
cy.findByTestId(this.#ssoServiceUrl).clear().type(value).blur();
return this;
}
shouldBeSuccessful() {
cy.findByTestId(this.discoveryEndpoint).should(
cy.findByTestId(this.#discoveryEndpoint).should(
"have.class",
"pf-m-success",
);
@ -131,7 +131,7 @@ export default class CreateProviderPage {
}
shouldHaveAuthorizationUrl(value: string) {
cy.findByTestId(this.authorizationUrl).should("have.value", value);
cy.findByTestId(this.#authorizationUrl).should("have.value", value);
return this;
}
}

View file

@ -1,11 +1,11 @@
const expect = chai.expect;
export default class OrderDialog {
private manageDisplayOrder = "manageDisplayOrder";
private list = "manageOrderDataList";
#manageDisplayOrder = "manageDisplayOrder";
#list = "manageOrderDataList";
openDialog() {
cy.findByTestId(this.manageDisplayOrder).click({ force: true });
cy.findByTestId(this.#manageDisplayOrder).click({ force: true });
return this;
}
@ -21,7 +21,7 @@ export default class OrderDialog {
}
checkOrder(providerNames: string[]) {
cy.get(`[data-testid=${this.list}] li`).should((providers) => {
cy.get(`[data-testid=${this.#list}] li`).should((providers) => {
expect(providers).to.have.length(providerNames.length);
for (let index = 0; index < providerNames.length; index++) {
expect(providers.eq(index)).to.contain(providerNames[index]);

View file

@ -52,49 +52,49 @@ export enum ClientAssertionSigningAlg {
}
export default class ProviderBaseGeneralSettingsPage extends PageObject {
private scopesInput = "#scopes";
private storeTokensSwitch = "#storeTokens";
private storedTokensReadable = "#storedTokensReadable";
private isAccessTokenJWT = "#isAccessTokenJWT";
private acceptsPromptNoneForwardFromClientSwitch = "#acceptsPromptNone";
private advancedSettingsToggle = ".pf-c-expandable-section__toggle";
private passLoginHintSwitch = "#passLoginHint";
private passMaxAgeSwitch = "#passMaxAge";
private passCurrentLocaleSwitch = "#passCurrentLocale";
private backchannelLogoutSwitch = "#backchannelLogout";
private promptSelect = "#prompt";
private disableUserInfoSwitch = "#disableUserInfo";
private trustEmailSwitch = "#trustEmail";
private accountLinkingOnlySwitch = "#accountLinkingOnly";
private hideOnLoginPageSwitch = "#hideOnLoginPage";
private firstLoginFlowSelect = "#firstBrokerLoginFlowAlias";
private postLoginFlowSelect = "#postBrokerLoginFlowAlias";
private syncModeSelect = "#syncMode";
private essentialClaimSwitch = "#filteredByClaim";
private claimNameInput = "#kc-claim-filter-name";
private claimValueInput = "#kc-claim-filter-value";
private addBtn = "createProvider";
private saveBtn = "idp-details-save";
private revertBtn = "idp-details-revert";
#scopesInput = "#scopes";
#storeTokensSwitch = "#storeTokens";
#storedTokensReadable = "#storedTokensReadable";
#isAccessTokenJWT = "#isAccessTokenJWT";
#acceptsPromptNoneForwardFromClientSwitch = "#acceptsPromptNone";
#advancedSettingsToggle = ".pf-c-expandable-section__toggle";
#passLoginHintSwitch = "#passLoginHint";
#passMaxAgeSwitch = "#passMaxAge";
#passCurrentLocaleSwitch = "#passCurrentLocale";
#backchannelLogoutSwitch = "#backchannelLogout";
#promptSelect = "#prompt";
#disableUserInfoSwitch = "#disableUserInfo";
#trustEmailSwitch = "#trustEmail";
#accountLinkingOnlySwitch = "#accountLinkingOnly";
#hideOnLoginPageSwitch = "#hideOnLoginPage";
#firstLoginFlowSelect = "#firstBrokerLoginFlowAlias";
#postLoginFlowSelect = "#postBrokerLoginFlowAlias";
#syncModeSelect = "#syncMode";
#essentialClaimSwitch = "#filteredByClaim";
#claimNameInput = "#kc-claim-filter-name";
#claimValueInput = "#kc-claim-filter-value";
#addBtn = "createProvider";
#saveBtn = "idp-details-save";
#revertBtn = "idp-details-revert";
private validateSignature = "#validateSignature";
private JwksSwitch = "#useJwksUrl";
private jwksUrl = "jwksUrl";
private pkceSwitch = "#pkceEnabled";
private pkceMethod = "#pkceMethod";
private clientAuth = "#clientAuthentication";
private clientAssertionSigningAlg = "#clientAssertionSigningAlg";
#validateSignature = "#validateSignature";
#jwksSwitch = "#useJwksUrl";
#jwksUrl = "jwksUrl";
#pkceSwitch = "#pkceEnabled";
#pkceMethod = "#pkceMethod";
#clientAuth = "#clientAuthentication";
#clientAssertionSigningAlg = "#clientAssertionSigningAlg";
public clickSaveBtn() {
cy.findByTestId(this.saveBtn).click();
cy.findByTestId(this.#saveBtn).click();
}
public clickRevertBtn() {
cy.findByTestId(this.revertBtn).click();
cy.findByTestId(this.#revertBtn).click();
}
public typeScopesInput(text: string) {
cy.get(this.scopesInput).type(text).blur();
cy.get(this.#scopesInput).type(text).blur();
return this;
}
@ -104,62 +104,62 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public clickStoreTokensSwitch() {
cy.get(this.storeTokensSwitch).parent().click();
cy.get(this.#storeTokensSwitch).parent().click();
return this;
}
public clickStoredTokensReadableSwitch() {
cy.get(this.storedTokensReadable).parent().click();
cy.get(this.#storedTokensReadable).parent().click();
return this;
}
public clickIsAccessTokenJWTSwitch() {
cy.get(this.isAccessTokenJWT).parent().click();
cy.get(this.#isAccessTokenJWT).parent().click();
return this;
}
public clickAcceptsPromptNoneForwardFromClientSwitch() {
cy.get(this.acceptsPromptNoneForwardFromClientSwitch).parent().click();
cy.get(this.#acceptsPromptNoneForwardFromClientSwitch).parent().click();
return this;
}
public clickDisableUserInfoSwitch() {
cy.get(this.disableUserInfoSwitch).parent().click();
cy.get(this.#disableUserInfoSwitch).parent().click();
return this;
}
public clickTrustEmailSwitch() {
cy.get(this.trustEmailSwitch).parent().click();
cy.get(this.#trustEmailSwitch).parent().click();
return this;
}
public clickAccountLinkingOnlySwitch() {
cy.get(this.accountLinkingOnlySwitch).parent().click();
cy.get(this.#accountLinkingOnlySwitch).parent().click();
return this;
}
public clickHideOnLoginPageSwitch() {
cy.get(this.hideOnLoginPageSwitch).parent().click();
cy.get(this.#hideOnLoginPageSwitch).parent().click();
return this;
}
public clickEssentialClaimSwitch() {
cy.get(this.essentialClaimSwitch).parent().click();
cy.get(this.#essentialClaimSwitch).parent().click();
return this;
}
public typeClaimNameInput(text: string) {
cy.get(this.claimNameInput).type(text).blur();
cy.get(this.#claimNameInput).type(text).blur();
return this;
}
public typeClaimValueInput(text: string) {
cy.get(this.claimValueInput).type(text).blur();
cy.get(this.#claimValueInput).type(text).blur();
return this;
}
public selectFirstLoginFlowOption(loginFlowOption: LoginFlowOption) {
cy.get(this.firstLoginFlowSelect).click();
cy.get(this.#firstLoginFlowSelect).click();
super.clickSelectMenuItem(
loginFlowOption,
cy.get(".pf-c-select__menu-item").contains(loginFlowOption),
@ -168,7 +168,7 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public selectPostLoginFlowOption(loginFlowOption: LoginFlowOption) {
cy.get(this.postLoginFlowSelect).click();
cy.get(this.#postLoginFlowSelect).click();
super.clickSelectMenuItem(
loginFlowOption,
cy.get(".pf-c-select__menu-item").contains(loginFlowOption),
@ -179,7 +179,7 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
public selectClientAssertSignAlg(
clientAssertionSigningAlg: ClientAssertionSigningAlg,
) {
cy.get(this.clientAssertionSigningAlg).click();
cy.get(this.#clientAssertionSigningAlg).click();
super.clickSelectMenuItem(
clientAssertionSigningAlg,
cy.get(".pf-c-select__menu-item").contains(clientAssertionSigningAlg),
@ -188,7 +188,7 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public selectSyncModeOption(syncModeOption: SyncModeOption) {
cy.get(this.syncModeSelect).click();
cy.get(this.#syncModeSelect).click();
super.clickSelectMenuItem(
syncModeOption,
cy.get(".pf-c-select__menu-item").contains(syncModeOption),
@ -197,7 +197,7 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public selectPromptOption(promptOption: PromptSelect) {
cy.get(this.promptSelect).click();
cy.get(this.#promptSelect).click();
super.clickSelectMenuItem(
promptOption,
cy.get(".pf-c-select__menu-item").contains(promptOption).parent(),
@ -206,33 +206,36 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public clickAdd() {
cy.findByTestId(this.addBtn).click();
cy.findByTestId(this.#addBtn).click();
return this;
}
public assertScopesInputEqual(text: string) {
cy.get(this.scopesInput).should("have.value", text).parent();
cy.get(this.#scopesInput).should("have.value", text).parent();
return this;
}
public assertStoreTokensSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.get(this.storeTokensSwitch), isOn);
super.assertSwitchStateOn(cy.get(this.#storeTokensSwitch), isOn);
return this;
}
public assertStoredTokensReadableTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.get(this.storedTokensReadable).parent(), isOn);
super.assertSwitchStateOn(
cy.get(this.#storedTokensReadable).parent(),
isOn,
);
return this;
}
public assertIsAccessTokenJWTTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.get(this.isAccessTokenJWT).parent(), isOn);
super.assertSwitchStateOn(cy.get(this.#isAccessTokenJWT).parent(), isOn);
return this;
}
public assertAcceptsPromptNoneForwardFromClientSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(
cy.get(this.acceptsPromptNoneForwardFromClientSwitch).parent(),
cy.get(this.#acceptsPromptNoneForwardFromClientSwitch).parent(),
isOn,
);
return this;
@ -240,68 +243,71 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
public assertDisableUserInfoSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(
cy.get(this.disableUserInfoSwitch).parent(),
cy.get(this.#disableUserInfoSwitch).parent(),
isOn,
);
return this;
}
public assertTrustEmailSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.get(this.trustEmailSwitch).parent(), isOn);
super.assertSwitchStateOn(cy.get(this.#trustEmailSwitch).parent(), isOn);
return this;
}
public assertAccountLinkingOnlySwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.get(this.accountLinkingOnlySwitch), isOn);
super.assertSwitchStateOn(cy.get(this.#accountLinkingOnlySwitch), isOn);
return this;
}
public assertHideOnLoginPageSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(
cy.get(this.hideOnLoginPageSwitch).parent(),
cy.get(this.#hideOnLoginPageSwitch).parent(),
isOn,
);
return this;
}
public assertEssentialClaimSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.get(this.essentialClaimSwitch).parent(), isOn);
super.assertSwitchStateOn(
cy.get(this.#essentialClaimSwitch).parent(),
isOn,
);
return this;
}
public assertClaimInputEqual(text: string) {
cy.get(this.claimNameInput).should("have.value", text).parent();
cy.get(this.#claimNameInput).should("have.value", text).parent();
return this;
}
public assertClaimValueInputEqual(text: string) {
cy.get(this.claimValueInput).should("have.value", text).parent();
cy.get(this.#claimValueInput).should("have.value", text).parent();
return this;
}
public assertFirstLoginFlowSelectOptionEqual(
loginFlowOption: LoginFlowOption,
) {
cy.get(this.firstLoginFlowSelect).should("have.text", loginFlowOption);
cy.get(this.#firstLoginFlowSelect).should("have.text", loginFlowOption);
return this;
}
public assertPostLoginFlowSelectOptionEqual(
loginFlowOption: LoginFlowOption,
) {
cy.get(this.postLoginFlowSelect).should("have.text", loginFlowOption);
cy.get(this.#postLoginFlowSelect).should("have.text", loginFlowOption);
return this;
}
public assertSyncModeSelectOptionEqual(syncModeOption: SyncModeOption) {
cy.get(this.syncModeSelect).should("have.text", syncModeOption);
cy.get(this.#syncModeSelect).should("have.text", syncModeOption);
return this;
}
public assertClientAssertSigAlgSelectOptionEqual(
clientAssertionSigningAlg: ClientAssertionSigningAlg,
) {
cy.get(this.clientAssertionSigningAlg).should(
cy.get(this.#clientAssertionSigningAlg).should(
"have.text",
clientAssertionSigningAlg,
);
@ -326,36 +332,36 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
public assertOIDCSignatureSwitch() {
cy.findByTestId("jump-link-openid-connect-settings").click();
cy.findByTestId(this.jwksUrl).should("exist");
super.assertSwitchStateOn(cy.get(this.JwksSwitch));
cy.findByTestId(this.#jwksUrl).should("exist");
super.assertSwitchStateOn(cy.get(this.#jwksSwitch));
cy.get(this.JwksSwitch).parent().click();
cy.findByTestId(this.jwksUrl).should("not.exist");
super.assertSwitchStateOff(cy.get(this.JwksSwitch));
cy.get(this.#jwksSwitch).parent().click();
cy.findByTestId(this.#jwksUrl).should("not.exist");
super.assertSwitchStateOff(cy.get(this.#jwksSwitch));
cy.get(this.validateSignature).parent().click();
cy.findByTestId(this.jwksUrl).should("not.exist");
super.assertSwitchStateOff(cy.get(this.validateSignature));
cy.get(this.#validateSignature).parent().click();
cy.findByTestId(this.#jwksUrl).should("not.exist");
super.assertSwitchStateOff(cy.get(this.#validateSignature));
this.clickRevertBtn();
cy.findByTestId(this.jwksUrl).should("exist");
cy.findByTestId(this.#jwksUrl).should("exist");
return this;
}
public assertOIDCPKCESwitch() {
cy.findByTestId("jump-link-openid-connect-settings").click();
super.assertSwitchStateOff(cy.get(this.pkceSwitch));
cy.get(this.pkceMethod).should("not.exist");
cy.get(this.pkceSwitch).parent().click();
super.assertSwitchStateOff(cy.get(this.#pkceSwitch));
cy.get(this.#pkceMethod).should("not.exist");
cy.get(this.#pkceSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.pkceSwitch));
cy.get(this.pkceMethod).should("exist");
super.assertSwitchStateOn(cy.get(this.#pkceSwitch));
cy.get(this.#pkceMethod).should("exist");
return this;
}
public assertOIDCClientAuthentication(option: ClientAuthentication) {
cy.findByTestId("jump-link-openid-connect-settings").click();
cy.get(this.clientAuth)
cy.get(this.#clientAuth)
.click()
.get(".pf-c-select__menu-item")
.contains(option)
@ -365,7 +371,7 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
public assertOIDCClientAuthSignAlg(alg: string) {
cy.findByTestId("jump-link-openid-connect-settings").click();
cy.get(this.clientAssertionSigningAlg)
cy.get(this.#clientAssertionSigningAlg)
.click()
.get(".pf-c-select__menu-item")
.contains(alg)
@ -374,26 +380,26 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public assertOIDCSettingsAdvancedSwitches() {
cy.get(this.advancedSettingsToggle).scrollIntoView().click();
cy.get(this.#advancedSettingsToggle).scrollIntoView().click();
cy.get(this.passLoginHintSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.passLoginHintSwitch));
cy.get(this.#passLoginHintSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.#passLoginHintSwitch));
cy.get(this.passMaxAgeSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.passMaxAgeSwitch));
cy.get(this.#passMaxAgeSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.#passMaxAgeSwitch));
cy.get(this.passCurrentLocaleSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.passCurrentLocaleSwitch));
cy.get(this.#passCurrentLocaleSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.#passCurrentLocaleSwitch));
cy.get(this.backchannelLogoutSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.backchannelLogoutSwitch));
cy.get(this.#backchannelLogoutSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.#backchannelLogoutSwitch));
cy.get(this.disableUserInfoSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.disableUserInfoSwitch));
cy.get(this.#disableUserInfoSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.#disableUserInfoSwitch));
this.clickAcceptsPromptNoneForwardFromClientSwitch();
super.assertSwitchStateOn(
cy.get(this.acceptsPromptNoneForwardFromClientSwitch),
cy.get(this.#acceptsPromptNoneForwardFromClientSwitch),
);
return this;
}
@ -419,7 +425,7 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
this.selectSyncModeOption(SyncModeOption.legacy);
this.clickRevertBtn();
cy.get(this.advancedSettingsToggle).scrollIntoView().click();
cy.get(this.#advancedSettingsToggle).scrollIntoView().click();
this.assertStoreTokensSwitchTurnedOn(false);
this.assertStoredTokensReadableTurnedOn(false);
this.assertIsAccessTokenJWTTurnedOn(false);

View file

@ -4,13 +4,13 @@ import Masthead from "../../Masthead";
const masthead = new Masthead();
export default class ProviderBaseGeneralSettingsPage extends PageObject {
private redirectUriGroup = ".pf-c-clipboard-copy__group";
#redirectUriGroup = ".pf-c-clipboard-copy__group";
protected clientIdInput = "#kc-client-id";
protected clientSecretInput = "#kc-client-secret";
private displayOrderInput = "#kc-display-order";
private addBtn = "createProvider";
private cancelBtn = "cancel";
private requiredFieldErrorMsg = ".pf-c-form__helper-text.pf-m-error";
#displayOrderInput = "#kc-display-order";
#addBtn = "createProvider";
#cancelBtn = "cancel";
#requiredFieldErrorMsg = ".pf-c-form__helper-text.pf-m-error";
protected requiredFields: string[] = [
this.clientIdInput,
this.clientSecretInput,
@ -32,7 +32,7 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public typeDisplayOrder(displayOrder: string) {
cy.get(this.displayOrderInput).type(displayOrder).blur();
cy.get(this.#displayOrderInput).type(displayOrder).blur();
return this;
}
@ -43,22 +43,22 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public clickCopyToClipboard() {
cy.get(this.redirectUriGroup).find("button").click();
cy.get(this.#redirectUriGroup).find("button").click();
return this;
}
public clickAdd() {
cy.findByTestId(this.addBtn).click();
cy.findByTestId(this.#addBtn).click();
return this;
}
public clickCancel() {
cy.findByTestId(this.cancelBtn).click();
cy.findByTestId(this.#cancelBtn).click();
return this;
}
public assertRedirectUriInputEqual(value: string) {
cy.get(this.redirectUriGroup).find("input").should("have.value", value);
cy.get(this.#redirectUriGroup).find("input").should("have.value", value);
return this;
}
@ -88,13 +88,13 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
cy.get(elementLocator)
.parent()
.parent()
.find(this.requiredFieldErrorMsg)
.find(this.#requiredFieldErrorMsg)
.should("exist");
} else {
cy.findByTestId(elementLocator)
.parent()
.parent()
.find(this.requiredFieldErrorMsg)
.find(this.#requiredFieldErrorMsg)
.should("exist");
}
});
@ -125,7 +125,7 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
this.testData["ClientId"] + idpName,
);
cy.get(this.clientSecretInput).should("contain.value", "****");
cy.get(this.displayOrderInput).should(
cy.get(this.#displayOrderInput).should(
"have.value",
this.testData["DisplayOrder"],
);

View file

@ -4,16 +4,16 @@ const additionalUsersProfile_input_test_value =
"additionalUsersProfile_input_test_value";
export default class ProviderFacebookGeneralSettings extends ProviderBaseGeneralSettingsPage {
private additionalUsersProfileFieldsInput = "fetchedFields";
#additionalUsersProfileFieldsInput = "fetchedFields";
public typeAdditionalUsersProfileFieldsInput(value: string) {
cy.findByTestId(this.additionalUsersProfileFieldsInput).type(value);
cy.findByTestId(this.additionalUsersProfileFieldsInput).blur();
cy.findByTestId(this.#additionalUsersProfileFieldsInput).type(value);
cy.findByTestId(this.#additionalUsersProfileFieldsInput).blur();
return this;
}
public assertAdditionalUsersProfileFieldsInputEqual(value: string) {
cy.findByTestId(this.additionalUsersProfileFieldsInput).should(
cy.findByTestId(this.#additionalUsersProfileFieldsInput).should(
"have.value",
value,
);

View file

@ -4,28 +4,28 @@ const base_url_input_test_value = "base_url_input_test_value";
const api_url_input_test_value = "api_url_input_test_value";
export default class ProviderGithubGeneralSettings extends ProviderBaseGeneralSettingsPage {
private baseUrlInput = "baseUrl";
private apiUrlInput = "apiUrl";
#baseUrlInput = "baseUrl";
#apiUrlInput = "apiUrl";
public typeBaseUrlInput(value: string) {
cy.findByTestId(this.baseUrlInput).type(value);
cy.findByTestId(this.baseUrlInput).blur();
cy.findByTestId(this.#baseUrlInput).type(value);
cy.findByTestId(this.#baseUrlInput).blur();
return this;
}
public typeApiUrlInput(value: string) {
cy.findByTestId(this.apiUrlInput).type(value);
cy.findByTestId(this.apiUrlInput).blur();
cy.findByTestId(this.#apiUrlInput).type(value);
cy.findByTestId(this.#apiUrlInput).blur();
return this;
}
public assertBaseUrlInputInputEqual(value: string) {
cy.findByTestId(this.baseUrlInput).should("have.value", value);
cy.findByTestId(this.#baseUrlInput).should("have.value", value);
return this;
}
public assertApiUrlInputEqual(value: string) {
cy.findByTestId(this.apiUrlInput).should("have.value", value);
cy.findByTestId(this.#apiUrlInput).should("have.value", value);
return this;
}

View file

@ -3,39 +3,42 @@ import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage"
const hosted_domain_input_test_value = "hosted_domain_input_test_value";
export default class ProviderGoogleGeneralSettings extends ProviderBaseGeneralSettingsPage {
private hostedDomainInput = "hostedDomain";
private useUserIpParamSwitch = "userIp";
private requestRefreshTokenSwitch = "offlineAccess";
#hostedDomainInput = "hostedDomain";
#useUserIpParamSwitch = "userIp";
#requestRefreshTokenSwitch = "offlineAccess";
public typeHostedDomainInput(value: string) {
cy.findByTestId(this.hostedDomainInput).type(value);
cy.findByTestId(this.hostedDomainInput).blur();
cy.findByTestId(this.#hostedDomainInput).type(value);
cy.findByTestId(this.#hostedDomainInput).blur();
return this;
}
public clickUseUserIpParamSwitch() {
cy.findByTestId(this.useUserIpParamSwitch).parent().click();
cy.findByTestId(this.#useUserIpParamSwitch).parent().click();
return this;
}
public clickRequestRefreshTokenSwitch() {
cy.findByTestId(this.requestRefreshTokenSwitch).parent().click();
cy.findByTestId(this.#requestRefreshTokenSwitch).parent().click();
return this;
}
public assertHostedDomainInputEqual(value: string) {
cy.findByTestId(this.hostedDomainInput).should("have.value", value);
cy.findByTestId(this.#hostedDomainInput).should("have.value", value);
return this;
}
public assertUseUserIpParamSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.findByTestId(this.useUserIpParamSwitch), isOn);
super.assertSwitchStateOn(
cy.findByTestId(this.#useUserIpParamSwitch),
isOn,
);
return this;
}
public assertRequestRefreshTokenSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(
cy.findByTestId(this.requestRefreshTokenSwitch),
cy.findByTestId(this.#requestRefreshTokenSwitch),
isOn,
);
return this;
@ -52,8 +55,8 @@ export default class ProviderGoogleGeneralSettings extends ProviderBaseGeneralSe
public assertFilledDataEqual(idpName: string) {
this.assertCommonFilledDataEqual(idpName);
this.assertHostedDomainInputEqual(hosted_domain_input_test_value);
this.assertSwitchStateOn(cy.findByTestId(this.useUserIpParamSwitch));
this.assertSwitchStateOn(cy.findByTestId(this.requestRefreshTokenSwitch));
this.assertSwitchStateOn(cy.findByTestId(this.#useUserIpParamSwitch));
this.assertSwitchStateOn(cy.findByTestId(this.#requestRefreshTokenSwitch));
return this;
}
}

View file

@ -3,15 +3,15 @@ import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage"
const TENANT_ID_VALUE = "12345678-9abc-def0-1234-56789abcdef0";
export default class ProviderMicrosoftGeneralSettings extends ProviderBaseGeneralSettingsPage {
private tenantIdTestId = "tenantId";
#tenantIdTestId = "tenantId";
public typeTenantIdInput(value: string) {
cy.findByTestId(this.tenantIdTestId).type(value).blur();
cy.findByTestId(this.#tenantIdTestId).type(value).blur();
return this;
}
public assertTenantIdInputEqual(value: string) {
cy.findByTestId(this.tenantIdTestId).should("have.value", value);
cy.findByTestId(this.#tenantIdTestId).should("have.value", value);
return this;
}

View file

@ -3,20 +3,20 @@ import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage"
const base_url_input_test_value = "base_url_input_test_value";
export default class ProviderOpenshiftGeneralSettings extends ProviderBaseGeneralSettingsPage {
private baseUrlInput = "baseUrl";
#baseUrlInput = "baseUrl";
constructor() {
super();
}
public typeBaseUrlInput(value: string) {
cy.findByTestId(this.baseUrlInput).type(value);
cy.findByTestId(this.baseUrlInput).blur();
cy.findByTestId(this.#baseUrlInput).type(value);
cy.findByTestId(this.#baseUrlInput).blur();
return this;
}
public assertbaseUrlInputEqual(value: string) {
cy.findByTestId(this.baseUrlInput).should("have.value", value);
cy.findByTestId(this.#baseUrlInput).should("have.value", value);
return this;
}
@ -26,7 +26,7 @@ export default class ProviderOpenshiftGeneralSettings extends ProviderBaseGenera
public fillData(idpName: string) {
this.fillCommonFields(idpName);
cy.findByTestId(this.baseUrlInput).type(
cy.findByTestId(this.#baseUrlInput).type(
idpName + base_url_input_test_value,
);
return this;

View file

@ -1,15 +1,15 @@
import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage";
export default class ProviderPaypalGeneralSettings extends ProviderBaseGeneralSettingsPage {
private targetSandboxSwitch = "sandbox";
#targetSandboxSwitch = "sandbox";
public clickTargetSandboxSwitch() {
cy.findByTestId(this.targetSandboxSwitch).parent().click();
cy.findByTestId(this.#targetSandboxSwitch).parent().click();
return this;
}
public assertTargetSandboxSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.findByTestId(this.targetSandboxSwitch), isOn);
super.assertSwitchStateOn(cy.findByTestId(this.#targetSandboxSwitch), isOn);
return this;
}
@ -21,7 +21,7 @@ export default class ProviderPaypalGeneralSettings extends ProviderBaseGeneralSe
public assertFilledDataEqual(idpName: string) {
this.assertCommonFilledDataEqual(idpName);
this.assertSwitchStateOn(cy.findByTestId(this.targetSandboxSwitch));
this.assertSwitchStateOn(cy.findByTestId(this.#targetSandboxSwitch));
return this;
}
}

View file

@ -4,72 +4,72 @@ import Masthead from "../../../Masthead";
const masthead = new Masthead();
export default class ProviderSAMLSettings extends PageObject {
private samlSwitch = "Saml-switch";
private modalConfirm = "#modal-confirm";
private serviceProviderEntityID = "serviceProviderEntityId";
private identityProviderEntityId = "identityProviderEntityId";
private ssoServiceUrl = "sso-service-url";
private singleLogoutServiceUrl = "single-logout-service-url";
private nameIdPolicyFormat = "#kc-nameIdPolicyFormat";
private principalType = "#kc-principalType";
private principalAttribute = "principalAttribute";
private principalSubjectNameId = "subjectNameId-option";
private principalAttributeName = "attributeName-option";
private principalFriendlyAttribute = "attributeFriendlyName-option";
#samlSwitch = "Saml-switch";
#modalConfirm = "#modal-confirm";
#serviceProviderEntityID = "serviceProviderEntityId";
#identityProviderEntityId = "identityProviderEntityId";
#ssoServiceUrl = "sso-service-url";
#singleLogoutServiceUrl = "single-logout-service-url";
#nameIdPolicyFormat = "#kc-nameIdPolicyFormat";
#principalType = "#kc-principalType";
#principalAttribute = "principalAttribute";
#principalSubjectNameId = "subjectNameId-option";
#principalAttributeName = "attributeName-option";
#principalFriendlyAttribute = "attributeFriendlyName-option";
private transientPolicy = "transient-option";
private emailPolicy = "email-option";
private kerberosPolicy = "kerberos-option";
private x509Policy = "x509-option";
private windowsDomainQNPolicy = "windowsDomainQN-option";
private unspecifiedPolicy = "unspecified-option";
private persistentPolicy = "persistent-option";
#transientPolicy = "transient-option";
#emailPolicy = "email-option";
#kerberosPolicy = "kerberos-option";
#x509Policy = "x509-option";
#windowsDomainQNPolicy = "windowsDomainQN-option";
#unspecifiedPolicy = "unspecified-option";
#persistentPolicy = "persistent-option";
private allowCreate = "#allowCreate";
private httpPostBindingResponse = "#httpPostBindingResponse";
private httpPostBindingAuthnRequest = "#httpPostBindingAuthnRequest";
private httpPostBindingLogout = "#httpPostBindingLogout";
private wantAuthnRequestsSigned = "#wantAuthnRequestsSigned";
#allowCreate = "#allowCreate";
#httpPostBindingResponse = "#httpPostBindingResponse";
#httpPostBindingAuthnRequest = "#httpPostBindingAuthnRequest";
#httpPostBindingLogout = "#httpPostBindingLogout";
#wantAuthnRequestsSigned = "#wantAuthnRequestsSigned";
private signatureAlgorithm = "#kc-signatureAlgorithm";
private samlSignatureKeyName = "#kc-samlSignatureKeyName";
#signatureAlgorithm = "#kc-signatureAlgorithm";
#samlSignatureKeyName = "#kc-samlSignatureKeyName";
private wantAssertionsSigned = "#wantAssertionsSigned";
private wantAssertionsEncrypted = "#wantAssertionsEncrypted";
private forceAuthentication = "#forceAuthentication";
private validateSignature = "#validateSignature";
private validatingX509Certs = "validatingX509Certs";
private signServiceProviderMetadata = "#signServiceProviderMetadata";
private passSubject = "#passSubject";
private allowedClockSkew = "allowedClockSkew";
private attributeConsumingServiceIndex = "attributeConsumingServiceIndex";
private attributeConsumingServiceName = "attributeConsumingServiceName";
#wantAssertionsSigned = "#wantAssertionsSigned";
#wantAssertionsEncrypted = "#wantAssertionsEncrypted";
#forceAuthentication = "#forceAuthentication";
#validateSignature = "#validateSignature";
#validatingX509Certs = "validatingX509Certs";
#signServiceProviderMetadata = "#signServiceProviderMetadata";
#passSubject = "#passSubject";
#allowedClockSkew = "allowedClockSkew";
#attributeConsumingServiceIndex = "attributeConsumingServiceIndex";
#attributeConsumingServiceName = "attributeConsumingServiceName";
private comparison = "#comparison";
private saveBtn = "idp-details-save";
private revertBtn = "idp-details-revert";
#comparison = "#comparison";
#saveBtn = "idp-details-save";
#revertBtn = "idp-details-revert";
public clickSaveBtn() {
cy.findByTestId(this.saveBtn).click();
cy.findByTestId(this.#saveBtn).click();
}
public clickRevertBtn() {
cy.findByTestId(this.revertBtn).click();
cy.findByTestId(this.#revertBtn).click();
}
public enableProviderSwitch() {
cy.findByTestId(this.samlSwitch).parent().click();
cy.findByTestId(this.#samlSwitch).parent().click();
masthead.checkNotificationMessage("Provider successfully updated");
}
public disableProviderSwitch() {
cy.findByTestId(this.samlSwitch).parent().click();
cy.get(this.modalConfirm).click();
cy.findByTestId(this.#samlSwitch).parent().click();
cy.get(this.#modalConfirm).click();
masthead.checkNotificationMessage("Provider successfully updated");
}
public typeServiceProviderEntityId(entityId: string) {
cy.findByTestId(this.serviceProviderEntityID)
cy.findByTestId(this.#serviceProviderEntityID)
.click()
.clear()
.type(entityId);
@ -77,7 +77,7 @@ export default class ProviderSAMLSettings extends PageObject {
}
public typeIdentityProviderEntityId(entityId: string) {
cy.findByTestId(this.identityProviderEntityId)
cy.findByTestId(this.#identityProviderEntityId)
.click()
.clear()
.type(entityId);
@ -85,40 +85,40 @@ export default class ProviderSAMLSettings extends PageObject {
}
public typeSsoServiceUrl(url: string) {
cy.findByTestId(this.ssoServiceUrl).clear().type(url);
cy.findByTestId(this.#ssoServiceUrl).clear().type(url);
return this;
}
public typeSingleLogoutServiceUrl(url: string) {
cy.findByTestId(this.singleLogoutServiceUrl).clear().type(url);
cy.findByTestId(this.#singleLogoutServiceUrl).clear().type(url);
return this;
}
public typeX509Certs(cert: string) {
cy.findByTestId(this.validatingX509Certs).clear().type(cert);
cy.findByTestId(this.#validatingX509Certs).clear().type(cert);
return this;
}
public selectNamePolicyIdFormat() {
cy.get(this.nameIdPolicyFormat).scrollIntoView().click();
cy.get(this.#nameIdPolicyFormat).scrollIntoView().click();
}
public selectPrincipalFormat() {
cy.get(this.principalType).scrollIntoView().click();
cy.get(this.#principalType).scrollIntoView().click();
}
public selectSignatureAlgorithm(algorithm: string) {
cy.get(this.signatureAlgorithm).scrollIntoView().click();
cy.get(this.#signatureAlgorithm).scrollIntoView().click();
cy.findByText(algorithm).click();
}
public selectSAMLSignature(key: string) {
cy.get(this.samlSignatureKeyName).scrollIntoView().click();
cy.get(this.#samlSignatureKeyName).scrollIntoView().click();
cy.findByText(key).click();
}
public selectComparison(comparison: string) {
cy.get(this.comparison).scrollIntoView().click();
cy.get(this.#comparison).scrollIntoView().click();
cy.findByText(comparison).scrollIntoView().click();
}
@ -144,29 +144,29 @@ export default class ProviderSAMLSettings extends PageObject {
public assertNameIdPolicyFormat() {
this.selectNamePolicyIdFormat();
cy.findByTestId(this.transientPolicy).click();
cy.findByTestId(this.#transientPolicy).click();
this.selectNamePolicyIdFormat();
cy.findByTestId(this.emailPolicy).click();
cy.findByTestId(this.#emailPolicy).click();
this.selectNamePolicyIdFormat();
cy.findByTestId(this.kerberosPolicy).click();
cy.findByTestId(this.#kerberosPolicy).click();
this.selectNamePolicyIdFormat();
cy.findByTestId(this.x509Policy).click();
cy.findByTestId(this.#x509Policy).click();
this.selectNamePolicyIdFormat();
cy.findByTestId(this.windowsDomainQNPolicy).click();
cy.findByTestId(this.#windowsDomainQNPolicy).click();
this.selectNamePolicyIdFormat();
cy.findByTestId(this.unspecifiedPolicy).click();
cy.findByTestId(this.#unspecifiedPolicy).click();
this.selectNamePolicyIdFormat();
cy.findByTestId(this.persistentPolicy).click();
cy.findByTestId(this.#persistentPolicy).click();
return this;
}
public assertSignatureAlgorithm() {
cy.get(this.wantAuthnRequestsSigned).parent().click();
cy.get(this.signatureAlgorithm).should("not.exist");
cy.get(this.samlSignatureKeyName).should("not.exist");
cy.get(this.#wantAuthnRequestsSigned).parent().click();
cy.get(this.#signatureAlgorithm).should("not.exist");
cy.get(this.#samlSignatureKeyName).should("not.exist");
this.clickRevertBtn();
cy.get(this.signatureAlgorithm).should("exist");
cy.get(this.samlSignatureKeyName).should("exist");
cy.get(this.#signatureAlgorithm).should("exist");
cy.get(this.#samlSignatureKeyName).should("exist");
this.selectSignatureAlgorithm("RSA_SHA1");
this.selectSignatureAlgorithm("RSA_SHA256");
@ -184,58 +184,58 @@ export default class ProviderSAMLSettings extends PageObject {
public assertPrincipalType() {
this.selectPrincipalFormat();
cy.findByTestId(this.principalAttributeName).click();
cy.findByTestId(this.principalAttribute).should("exist").scrollIntoView();
cy.findByTestId(this.#principalAttributeName).click();
cy.findByTestId(this.#principalAttribute).should("exist").scrollIntoView();
this.selectPrincipalFormat();
cy.findByTestId(this.principalFriendlyAttribute).click();
cy.findByTestId(this.principalAttribute).should("exist");
cy.findByTestId(this.#principalFriendlyAttribute).click();
cy.findByTestId(this.#principalAttribute).should("exist");
this.selectPrincipalFormat();
cy.findByTestId(this.principalSubjectNameId).click();
cy.findByTestId(this.principalAttribute).should("not.exist");
cy.findByTestId(this.#principalSubjectNameId).click();
cy.findByTestId(this.#principalAttribute).should("not.exist");
return this;
}
public assertSAMLSwitches() {
cy.get(this.allowCreate).parent().click();
cy.get(this.httpPostBindingResponse).parent().click();
cy.get(this.httpPostBindingLogout).parent().click();
cy.get(this.httpPostBindingAuthnRequest).parent().click();
cy.get(this.#allowCreate).parent().click();
cy.get(this.#httpPostBindingResponse).parent().click();
cy.get(this.#httpPostBindingLogout).parent().click();
cy.get(this.#httpPostBindingAuthnRequest).parent().click();
cy.get(this.wantAssertionsSigned).parent().click();
cy.get(this.wantAssertionsEncrypted).parent().click();
cy.get(this.forceAuthentication).parent().click();
cy.get(this.#wantAssertionsSigned).parent().click();
cy.get(this.#wantAssertionsEncrypted).parent().click();
cy.get(this.#forceAuthentication).parent().click();
cy.get(this.signServiceProviderMetadata).parent().click();
cy.get(this.passSubject).parent().click();
cy.get(this.#signServiceProviderMetadata).parent().click();
cy.get(this.#passSubject).parent().click();
return this;
}
public assertValidateSignatures() {
cy.get(this.validateSignature).parent().click();
cy.findByTestId(this.validatingX509Certs).should("not.exist");
cy.get(this.validateSignature).parent().click();
cy.get(this.#validateSignature).parent().click();
cy.findByTestId(this.#validatingX509Certs).should("not.exist");
cy.get(this.#validateSignature).parent().click();
this.typeX509Certs("X509 Certificate");
this.clickRevertBtn();
cy.findByTestId(this.validatingX509Certs);
cy.findByTestId(this.#validatingX509Certs);
this.clickSaveBtn();
return this;
}
public assertTextFields() {
cy.findByTestId(this.allowedClockSkew)
cy.findByTestId(this.#allowedClockSkew)
.find("input")
.should("have.value", 0)
.clear()
.type("111");
cy.findByTestId(this.attributeConsumingServiceIndex)
cy.findByTestId(this.#attributeConsumingServiceIndex)
.find("input")
.should("have.value", 0)
.clear()
.type("111");
cy.findByTestId(this.attributeConsumingServiceName).click().type("name");
cy.findByTestId(this.#attributeConsumingServiceName).click().type("name");
}
public assertAuthnContext() {

View file

@ -3,20 +3,20 @@ import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage"
const key_input_test_value = "key_input_test_value";
export default class ProviderStackoverflowGeneralSettings extends ProviderBaseGeneralSettingsPage {
private keyInput = "key";
#keyInput = "key";
constructor() {
super();
}
public typeKeyInput(value: string) {
cy.findByTestId(this.keyInput).type(value);
cy.findByTestId(this.keyInput).blur();
cy.findByTestId(this.#keyInput).type(value);
cy.findByTestId(this.#keyInput).blur();
return this;
}
public assertKeyInputEqual(value: string) {
cy.findByTestId(this.keyInput).should("have.value", value);
cy.findByTestId(this.#keyInput).should("have.value", value);
return this;
}

View file

@ -1,11 +1,11 @@
const expect = chai.expect;
export default class PriorityDialog {
private managePriorityOrder = "viewHeader-lower-btn";
private list = "manageOrderDataList";
#managePriorityOrder = "viewHeader-lower-btn";
#list = "manageOrderDataList";
openDialog() {
cy.findByTestId(this.managePriorityOrder).click({ force: true });
cy.findByTestId(this.#managePriorityOrder).click({ force: true });
return this;
}
@ -21,7 +21,7 @@ export default class PriorityDialog {
}
checkOrder(providerNames: string[]) {
cy.get(`[data-testid=${this.list}] li`).should((providers) => {
cy.get(`[data-testid=${this.#list}] li`).should((providers) => {
expect(providers).to.have.length(providerNames.length);
for (let index = 0; index < providerNames.length; index++) {
expect(providers.eq(index)).to.contain(providerNames[index]);

View file

@ -1,14 +1,14 @@
export default class ProviderPage {
// KerberosSettingsRequired input values
private kerberosNameInput = "kerberos-name";
private kerberosRealmInput = "kerberos-realm";
private kerberosPrincipalInput = "kerberos-principal";
private kerberosKeytabInput = "kerberos-keytab";
#kerberosNameInput = "kerberos-name";
#kerberosRealmInput = "kerberos-realm";
#kerberosPrincipalInput = "kerberos-principal";
#kerberosKeytabInput = "kerberos-keytab";
// LdapSettingsGeneral input values
private ldapNameInput = "ldap-name";
private ldapVendorInput = "#kc-vendor";
private ldapVendorList = "#kc-vendor + ul";
#ldapNameInput = "ldap-name";
#ldapVendorInput = "#kc-vendor";
#ldapVendorList = "#kc-vendor + ul";
// LdapSettingsConnection input values
connectionUrlInput = "ldap-connection-url";
@ -16,17 +16,17 @@ export default class ProviderPage {
truststoreSpiList = "#kc-use-truststore-spi + ul";
connectionTimeoutInput = "connection-timeout";
bindTypeInput = "#kc-bind-type";
private bindTypeList = "#kc-bind-type + ul";
#bindTypeList = "#kc-bind-type + ul";
bindDnInput = "ldap-bind-dn";
bindCredsInput = "ldap-bind-credentials";
private testConnectionBtn = "test-connection-button";
private testAuthBtn = "test-auth-button";
#testConnectionBtn = "test-connection-button";
#testAuthBtn = "test-auth-button";
// LdapSettingsSearching input values
ldapEditModeInput = "#kc-edit-mode";
private ldapEditModeList = "#kc-edit-mode + ul";
#ldapEditModeList = "#kc-edit-mode + ul";
ldapSearchScopeInput = "#kc-search-scope";
private ldapSearchScopeInputList = "#kc-search-scope + ul";
#ldapSearchScopeInputList = "#kc-search-scope + ul";
ldapPagination = "ui-pagination";
ldapUsersDnInput = "ldap-users-dn";
ldapUserLdapAttInput = "ldap-username-attribute";
@ -53,53 +53,53 @@ export default class ProviderPage {
periodicUsersSync = "periodic-changed-users-sync";
// SettingsCache input values
private cacheDayInput = "#kc-eviction-day";
private cacheDayList = "#kc-eviction-day + ul";
private cacheHourInput = "#kc-eviction-hour";
private cacheHourList = "#kc-eviction-hour + ul";
private cacheMinuteInput = "#kc-eviction-minute";
private cacheMinuteList = "#kc-eviction-minute + ul";
private cachePolicyInput = "#kc-cache-policy";
private cachePolicyList = "#kc-cache-policy + ul";
#cacheDayInput = "#kc-eviction-day";
#cacheDayList = "#kc-eviction-day + ul";
#cacheHourInput = "#kc-eviction-hour";
#cacheHourList = "#kc-eviction-hour + ul";
#cacheMinuteInput = "#kc-eviction-minute";
#cacheMinuteList = "#kc-eviction-minute + ul";
#cachePolicyInput = "#kc-cache-policy";
#cachePolicyList = "#kc-cache-policy + ul";
// Mapper input values
private userModelAttInput = "user.model.attribute";
private ldapAttInput = "ldap.attribute";
private userModelAttNameInput = "user.model.attribute";
private attValueInput = "attribute.value";
private ldapFullNameAttInput = "ldap.full.name.attribute";
private ldapAttNameInput = "ldap.attribute.name";
private ldapAttValueInput = "ldap.attribute.value";
private groupInput = "group";
private ldapGroupsDnInput = "groups.dn";
private ldapRolesDnInput = "roles.dn";
#userModelAttInput = "user.model.attribute";
#ldapAttInput = "ldap.attribute";
#userModelAttNameInput = "user.model.attribute";
#attValueInput = "attribute.value";
#ldapFullNameAttInput = "ldap.full.name.attribute";
#ldapAttNameInput = "ldap.attribute.name";
#ldapAttValueInput = "ldap.attribute.value";
#groupInput = "group";
#ldapGroupsDnInput = "groups.dn";
#ldapRolesDnInput = "roles.dn";
// Mapper types
private msadUserAcctMapper = "msad-user-account-control-mapper";
private msadLdsUserAcctMapper = "msad-lds-user-account-control-mapper";
private userAttLdapMapper = "user-attribute-ldap-mapper";
private hcAttMapper = "hardcoded-attribute-mapper";
private certLdapMapper = "certificate-ldap-mapper";
private fullNameLdapMapper = "full-name-ldap-mapper";
private hcLdapAttMapper = "hardcoded-ldap-attribute-mapper";
private hcLdapGroupMapper = "hardcoded-ldap-group-mapper";
private groupLdapMapper = "group-ldap-mapper";
private roleLdapMapper = "role-ldap-mapper";
private hcLdapRoleMapper = "hardcoded-ldap-role-mapper";
#msadUserAcctMapper = "msad-user-account-control-mapper";
#msadLdsUserAcctMapper = "msad-lds-user-account-control-mapper";
#userAttLdapMapper = "user-attribute-ldap-mapper";
#hcAttMapper = "hardcoded-attribute-mapper";
#certLdapMapper = "certificate-ldap-mapper";
#fullNameLdapMapper = "full-name-ldap-mapper";
#hcLdapAttMapper = "hardcoded-ldap-attribute-mapper";
#hcLdapGroupMapper = "hardcoded-ldap-group-mapper";
#groupLdapMapper = "group-ldap-mapper";
#roleLdapMapper = "role-ldap-mapper";
#hcLdapRoleMapper = "hardcoded-ldap-role-mapper";
private actionDropdown = "action-dropdown";
private deleteCmd = "delete-cmd";
#actionDropdown = "action-dropdown";
#deleteCmd = "delete-cmd";
private mappersTab = "ldap-mappers-tab";
private rolesTab = "rolesTab";
private createRoleBtn = "no-roles-for-this-client-empty-action";
private roleSaveBtn = "save";
private roleNameField = "#kc-name";
#mappersTab = "ldap-mappers-tab";
#rolesTab = "rolesTab";
#createRoleBtn = "no-roles-for-this-client-empty-action";
#roleSaveBtn = "save";
#roleNameField = "#kc-name";
private groupName = "aa-uf-mappers-group";
private clientName = "aa-uf-mappers-client";
#groupName = "aa-uf-mappers-group";
#clientName = "aa-uf-mappers-client";
private maxLifespan = "kerberos-cache-lifespan";
#maxLifespan = "kerberos-cache-lifespan";
// Kerberos settings switch input values
debugSwitch = "debug";
@ -118,16 +118,16 @@ export default class ProviderPage {
changeCacheTime(unit: string, time: string) {
switch (unit) {
case "day":
cy.get(this.cacheDayInput).click();
cy.get(this.cacheDayList).contains(time).click();
cy.get(this.#cacheDayInput).click();
cy.get(this.#cacheDayList).contains(time).click();
break;
case "hour":
cy.get(this.cacheHourInput).click();
cy.get(this.cacheHourList).contains(time).click();
cy.get(this.#cacheHourInput).click();
cy.get(this.#cacheHourList).contains(time).click();
break;
case "minute":
cy.get(this.cacheMinuteInput).click();
cy.get(this.cacheMinuteList).contains(time).click();
cy.get(this.#cacheMinuteInput).click();
cy.get(this.#cacheMinuteList).contains(time).click();
break;
default:
console.log("Invalid cache time, must be 'day', 'hour', or 'minute'.");
@ -137,9 +137,9 @@ export default class ProviderPage {
}
verifyChangedHourInput(expected: string, unexpected: string) {
expect(cy.get(this.cacheHourInput).contains(expected).should("exist"));
expect(cy.get(this.#cacheHourInput).contains(expected).should("exist"));
expect(
cy.get(this.cacheHourInput).contains(unexpected).should("not.exist"),
cy.get(this.#cacheHourInput).contains(unexpected).should("not.exist"),
);
return this;
}
@ -152,8 +152,8 @@ export default class ProviderPage {
deleteCardFromMenu(card: string) {
this.clickExistingCard(card);
cy.findByTestId(this.actionDropdown).click();
cy.findByTestId(this.deleteCmd).click();
cy.findByTestId(this.#actionDropdown).click();
cy.findByTestId(this.#deleteCmd).click();
return this;
}
@ -164,23 +164,23 @@ export default class ProviderPage {
keytab: string,
) {
if (name) {
cy.findByTestId(this.kerberosNameInput).clear().type(name);
cy.findByTestId(this.#kerberosNameInput).clear().type(name);
}
if (realm) {
cy.findByTestId(this.kerberosRealmInput).clear().type(realm);
cy.findByTestId(this.#kerberosRealmInput).clear().type(realm);
}
if (principal) {
cy.findByTestId(this.kerberosPrincipalInput).clear().type(principal);
cy.findByTestId(this.#kerberosPrincipalInput).clear().type(principal);
}
if (keytab) {
cy.findByTestId(this.kerberosKeytabInput).clear().type(keytab);
cy.findByTestId(this.#kerberosKeytabInput).clear().type(keytab);
}
return this;
}
fillMaxLifespanData(lifespan: number) {
for (let i = 0; i < lifespan; i++) {
cy.findByTestId(this.maxLifespan).click();
cy.findByTestId(this.#maxLifespan).click();
}
return this;
}
@ -215,10 +215,10 @@ export default class ProviderPage {
}
fillLdapGeneralData(name: string, vendor?: string) {
cy.findByTestId(this.ldapNameInput).clear().type(name);
cy.findByTestId(this.#ldapNameInput).clear().type(name);
if (vendor) {
cy.get(this.ldapVendorInput).click();
cy.get(this.ldapVendorList).contains(vendor).click();
cy.get(this.#ldapVendorInput).click();
cy.get(this.#ldapVendorList).contains(vendor).click();
}
return this;
}
@ -234,7 +234,7 @@ export default class ProviderPage {
cy.findByTestId(this.connectionUrlInput).clear().type(connectionUrl);
cy.get(this.bindTypeInput).click();
cy.get(this.bindTypeList).contains(bindType).click();
cy.get(this.#bindTypeList).contains(bindType).click();
if (truststoreSpi) {
cy.get(this.truststoreSpiInput).click();
@ -266,7 +266,7 @@ export default class ProviderPage {
readTimeout?: string,
) {
cy.get(this.ldapEditModeInput).click();
cy.get(this.ldapEditModeList).contains(editMode).click();
cy.get(this.#ldapEditModeList).contains(editMode).click();
cy.findByTestId(this.ldapUsersDnInput).clear().type(usersDn);
if (userLdapAtt) {
cy.findByTestId(this.ldapUserLdapAttInput).clear().type(userLdapAtt);
@ -287,7 +287,7 @@ export default class ProviderPage {
}
if (searchScope) {
cy.get(this.ldapSearchScopeInput).click();
cy.get(this.ldapSearchScopeInputList).contains(searchScope).click();
cy.get(this.#ldapSearchScopeInputList).contains(searchScope).click();
}
if (readTimeout) {
cy.findByTestId(this.ldapReadTimeout).clear().type(readTimeout);
@ -296,23 +296,23 @@ export default class ProviderPage {
}
selectCacheType(cacheType: string) {
cy.get(this.cachePolicyInput).click();
cy.get(this.cachePolicyList).contains(cacheType).click();
cy.get(this.#cachePolicyInput).click();
cy.get(this.#cachePolicyList).contains(cacheType).click();
return this;
}
goToMappers() {
cy.findByTestId(this.mappersTab).click();
cy.findByTestId(this.#mappersTab).click();
}
createRole(roleName: string) {
cy.findByTestId(this.rolesTab).click();
cy.findByTestId(this.#rolesTab).click();
cy.wait(1000);
cy.findByTestId(this.createRoleBtn).click();
cy.findByTestId(this.#createRoleBtn).click();
cy.wait(1000);
cy.get(this.roleNameField).clear().type(roleName);
cy.get(this.#roleNameField).clear().type(roleName);
cy.wait(1000);
cy.findByTestId(this.roleSaveBtn).click();
cy.findByTestId(this.#roleSaveBtn).click();
cy.wait(1000);
}
@ -330,46 +330,48 @@ export default class ProviderPage {
cy.findByTestId("ldap-mapper-name").clear().type(`${mapperType}-test`);
switch (mapperType) {
case this.msadUserAcctMapper:
case this.msadLdsUserAcctMapper:
case this.#msadUserAcctMapper:
case this.#msadLdsUserAcctMapper:
break;
case this.userAttLdapMapper:
case this.certLdapMapper:
cy.findByTestId(this.userModelAttInput).clear().type(userModelAttValue);
cy.findByTestId(this.ldapAttInput).clear().type(ldapAttValue);
break;
case this.hcAttMapper:
cy.findByTestId(this.userModelAttNameInput)
case this.#userAttLdapMapper:
case this.#certLdapMapper:
cy.findByTestId(this.#userModelAttInput)
.clear()
.type(userModelAttValue);
cy.findByTestId(this.attValueInput).clear().type(ldapAttValue);
cy.findByTestId(this.#ldapAttInput).clear().type(ldapAttValue);
break;
case this.fullNameLdapMapper:
cy.findByTestId(this.ldapFullNameAttInput).clear().type(ldapAttValue);
case this.#hcAttMapper:
cy.findByTestId(this.#userModelAttNameInput)
.clear()
.type(userModelAttValue);
cy.findByTestId(this.#attValueInput).clear().type(ldapAttValue);
break;
case this.hcLdapAttMapper:
cy.findByTestId(this.ldapAttNameInput).clear().type(userModelAttValue);
cy.findByTestId(this.ldapAttValueInput).clear().type(ldapAttValue);
case this.#fullNameLdapMapper:
cy.findByTestId(this.#ldapFullNameAttInput).clear().type(ldapAttValue);
break;
case this.hcLdapGroupMapper:
cy.findByTestId(this.groupInput).clear().type(this.groupName);
case this.#hcLdapAttMapper:
cy.findByTestId(this.#ldapAttNameInput).clear().type(userModelAttValue);
cy.findByTestId(this.#ldapAttValueInput).clear().type(ldapAttValue);
break;
case this.groupLdapMapper:
cy.findByTestId(this.ldapGroupsDnInput).clear().type(ldapDnValue);
case this.#hcLdapGroupMapper:
cy.findByTestId(this.#groupInput).clear().type(this.#groupName);
break;
case this.#groupLdapMapper:
cy.findByTestId(this.#ldapGroupsDnInput).clear().type(ldapDnValue);
break;
case this.roleLdapMapper:
cy.findByTestId(this.ldapRolesDnInput).clear().type(ldapDnValue);
case this.#roleLdapMapper:
cy.findByTestId(this.#ldapRolesDnInput).clear().type(ldapDnValue);
cy.get(".pf-c-form__group")
.contains("Client ID")
.parent()
.parent()
.find("input")
.click();
cy.get("button").contains(this.clientName).click({ force: true });
cy.get("button").contains(this.#clientName).click({ force: true });
break;
case this.hcLdapRoleMapper:
case this.#hcLdapRoleMapper:
cy.findByTestId("add-roles").click();
cy.get("[aria-label='Select row 1']").click();
cy.findByTestId("assign").click();
@ -385,26 +387,28 @@ export default class ProviderPage {
const ldapAttValue = "sn";
switch (mapperType) {
case this.msadUserAcctMapper:
case this.msadLdsUserAcctMapper:
case this.#msadUserAcctMapper:
case this.#msadLdsUserAcctMapper:
break;
case this.userAttLdapMapper:
case this.certLdapMapper:
cy.findByTestId(this.userModelAttInput).clear().type(userModelAttValue);
cy.findByTestId(this.ldapAttInput).clear().type(ldapAttValue);
break;
case this.hcAttMapper:
cy.findByTestId(this.userModelAttNameInput)
case this.#userAttLdapMapper:
case this.#certLdapMapper:
cy.findByTestId(this.#userModelAttInput)
.clear()
.type(userModelAttValue);
cy.findByTestId(this.attValueInput).clear().type(ldapAttValue);
cy.findByTestId(this.#ldapAttInput).clear().type(ldapAttValue);
break;
case this.fullNameLdapMapper:
cy.findByTestId(this.ldapFullNameAttInput).clear().type(ldapAttValue);
case this.#hcAttMapper:
cy.findByTestId(this.#userModelAttNameInput)
.clear()
.type(userModelAttValue);
cy.findByTestId(this.#attValueInput).clear().type(ldapAttValue);
break;
case this.hcLdapAttMapper:
cy.findByTestId(this.ldapAttNameInput).clear().type(userModelAttValue);
cy.findByTestId(this.ldapAttValueInput).clear().type(ldapAttValue);
case this.#fullNameLdapMapper:
cy.findByTestId(this.#ldapFullNameAttInput).clear().type(ldapAttValue);
break;
case this.#hcLdapAttMapper:
cy.findByTestId(this.#ldapAttNameInput).clear().type(userModelAttValue);
cy.findByTestId(this.#ldapAttValueInput).clear().type(ldapAttValue);
break;
default:
console.log("Invalid mapper name.");
@ -456,12 +460,12 @@ export default class ProviderPage {
}
testConnection() {
cy.findByTestId(this.testConnectionBtn).click();
cy.findByTestId(this.#testConnectionBtn).click();
return this;
}
testAuthorization() {
cy.findByTestId(this.testAuthBtn).click();
cy.findByTestId(this.#testAuthBtn).click();
return this;
}
}

View file

@ -1,31 +1,31 @@
export default class AssociatedRolesPage {
private actionDropdown = "action-dropdown";
private addRolesDropdownItem = "add-roles";
private addRoleToolbarButton = "assignRole";
private addAssociatedRolesModalButton = "assign";
private compositeRoleBadge = "composite-role-badge";
private filterTypeDropdown = "filter-type-dropdown";
private filterTypeDropdownItem = "roles";
private usersPage = "users-page";
private removeRolesButton = "unAssignRole";
private addRoleTable = '[aria-label="Roles"] td[data-label="Name"]';
#actionDropdown = "action-dropdown";
#addRolesDropdownItem = "add-roles";
#addRoleToolbarButton = "assignRole";
#addAssociatedRolesModalButton = "assign";
#compositeRoleBadge = "composite-role-badge";
#filterTypeDropdown = "filter-type-dropdown";
#filterTypeDropdownItem = "roles";
#usersPage = "users-page";
#removeRolesButton = "unAssignRole";
#addRoleTable = '[aria-label="Roles"] td[data-label="Name"]';
addAssociatedRealmRole(roleName: string) {
cy.findByTestId(this.actionDropdown).last().click();
cy.findByTestId(this.#actionDropdown).last().click();
cy.findByTestId(this.addRolesDropdownItem).click();
cy.findByTestId(this.#addRolesDropdownItem).click();
cy.get(this.addRoleTable)
cy.get(this.#addRoleTable)
.contains(roleName)
.parent()
.within(() => {
cy.get("input").click();
});
cy.findByTestId(this.addAssociatedRolesModalButton).click();
cy.findByTestId(this.#addAssociatedRolesModalButton).click();
cy.url().should("include", "/associated-roles");
cy.findByTestId(this.compositeRoleBadge).should(
cy.findByTestId(this.#compositeRoleBadge).should(
"contain.text",
"Composite",
);
@ -34,57 +34,57 @@ export default class AssociatedRolesPage {
}
addAssociatedRoleFromSearchBar(roleName: string, isClientRole?: boolean) {
cy.findByTestId(this.addRoleToolbarButton).click({ force: true });
cy.findByTestId(this.#addRoleToolbarButton).click({ force: true });
if (isClientRole) {
cy.findByTestId(this.filterTypeDropdown).click();
cy.findByTestId(this.filterTypeDropdownItem).click();
cy.findByTestId(this.#filterTypeDropdown).click();
cy.findByTestId(this.#filterTypeDropdownItem).click();
}
cy.findByTestId(".pf-c-spinner__tail-ball").should("not.exist");
cy.get(this.addRoleTable)
cy.get(this.#addRoleTable)
.contains(roleName)
.parent()
.within(() => {
cy.get("input").click();
});
cy.findByTestId(this.addAssociatedRolesModalButton).click();
cy.findByTestId(this.#addAssociatedRolesModalButton).click();
cy.contains("Users in role").click();
cy.findByTestId(this.usersPage).should("exist");
cy.findByTestId(this.#usersPage).should("exist");
}
addAssociatedClientRole(roleName: string) {
cy.findByTestId(this.addRoleToolbarButton).click();
cy.findByTestId(this.#addRoleToolbarButton).click();
cy.findByTestId(this.filterTypeDropdown).click();
cy.findByTestId(this.#filterTypeDropdown).click();
cy.findByTestId(this.filterTypeDropdownItem).click();
cy.findByTestId(this.#filterTypeDropdownItem).click();
cy.findByTestId(".pf-c-spinner__tail-ball").should("not.exist");
cy.get(this.addRoleTable)
cy.get(this.#addRoleTable)
.contains(roleName)
.parent()
.within(() => {
cy.get("input").click();
});
cy.findByTestId(this.addAssociatedRolesModalButton).click();
cy.findByTestId(this.#addAssociatedRolesModalButton).click();
cy.contains("Users in role").click();
cy.findByTestId(this.usersPage).should("exist");
cy.findByTestId(this.#usersPage).should("exist");
}
removeAssociatedRoles() {
cy.findByTestId(this.removeRolesButton).click();
cy.findByTestId(this.#removeRolesButton).click();
return this;
}
isRemoveAssociatedRolesBtnDisabled() {
cy.findByTestId(this.removeRolesButton).should(
cy.findByTestId(this.#removeRolesButton).should(
"have.class",
"pf-m-disabled",
);

View file

@ -1,16 +1,16 @@
class CreateRealmRolePage {
private realmRoleNameInput = "#kc-name";
private realmRoleNameError = "#kc-name-helper";
private realmRoleDescriptionInput = "#kc-description";
private saveBtn = "save";
private cancelBtn = "cancel";
#realmRoleNameInput = "#kc-name";
#realmRoleNameError = "#kc-name-helper";
#realmRoleDescriptionInput = "#kc-description";
#saveBtn = "save";
#cancelBtn = "cancel";
//#region General Settings
fillRealmRoleData(name: string, description = "") {
cy.get(this.realmRoleNameInput).clear();
cy.get(this.#realmRoleNameInput).clear();
if (name) {
cy.get(this.realmRoleNameInput).type(name);
cy.get(this.#realmRoleNameInput).type(name);
}
if (description !== "") {
@ -20,7 +20,7 @@ class CreateRealmRolePage {
}
checkRealmRoleNameRequiredMessage(exist = true) {
cy.get(this.realmRoleNameError).should((!exist ? "not." : "") + "exist");
cy.get(this.#realmRoleNameError).should((!exist ? "not." : "") + "exist");
return this;
}
@ -36,29 +36,33 @@ class CreateRealmRolePage {
}
checkNameDisabled() {
cy.get(this.realmRoleNameInput).should("have.attr", "readonly", "readonly");
cy.get(this.#realmRoleNameInput).should(
"have.attr",
"readonly",
"readonly",
);
return this;
}
checkDescription(description: string) {
cy.get(this.realmRoleDescriptionInput).should("have.value", description);
cy.get(this.#realmRoleDescriptionInput).should("have.value", description);
return this;
}
updateDescription(description: string) {
cy.get(this.realmRoleDescriptionInput).clear();
cy.get(this.realmRoleDescriptionInput).type(description);
cy.get(this.#realmRoleDescriptionInput).clear();
cy.get(this.#realmRoleDescriptionInput).type(description);
return this;
}
save() {
cy.findByTestId(this.saveBtn).click();
cy.findByTestId(this.#saveBtn).click();
return this;
}
cancel() {
cy.findByTestId(this.cancelBtn).click();
cy.findByTestId(this.#cancelBtn).click();
return this;
}

View file

@ -1,23 +1,23 @@
export default class KeysTab {
private readonly keysTab = "rs-keys-tab";
private readonly providersTab = "rs-providers-tab";
private readonly addProviderDropdown = "addProviderDropdown";
readonly #keysTab = "rs-keys-tab";
readonly #providersTab = "rs-providers-tab";
readonly #addProviderDropdown = "addProviderDropdown";
goToKeysTab() {
cy.findByTestId(this.keysTab).click();
cy.findByTestId(this.#keysTab).click();
return this;
}
goToProvidersTab() {
this.goToKeysTab();
cy.findByTestId(this.providersTab).click();
cy.findByTestId(this.#providersTab).click();
return this;
}
addProvider(provider: string) {
cy.findByTestId(this.addProviderDropdown).click();
cy.findByTestId(this.#addProviderDropdown).click();
cy.findByTestId(`option-${provider}`).click();
return this;

View file

@ -166,98 +166,94 @@ export default class RealmSettingsPage extends CommonPage {
executeActionsSelectMenu = "#kc-execute-actions-select-menu";
executeActionsSelectMenuList = "#kc-execute-actions-select-menu > div > ul";
private formViewProfilesView = "formView-profilesView";
private jsonEditorProfilesView = "jsonEditor-profilesView";
private createProfileBtn = "createProfile";
private formViewSelect = "formView-profilesView";
private jsonEditorSelect = "jsonEditor-profilesView";
private formViewSelectPolicies = "formView-policiesView";
private jsonEditorSelectPolicies = "jsonEditor-policiesView";
private newClientProfileNameInput = "client-profile-name";
private newClientProfileDescriptionInput = "client-profile-description";
private saveNewClientProfileBtn = "saveCreateProfile";
private cancelNewClientProfile = "cancelCreateProfile";
private createPolicyEmptyStateBtn = "no-client-policies-empty-action";
private createPolicyBtn = "createPolicy";
private newClientPolicyNameInput = "client-policy-name";
private newClientPolicyDescriptionInput = "client-policy-description";
private saveNewClientPolicyBtn = "saveCreatePolicy";
private cancelNewClientPolicyBtn = "cancelCreatePolicy";
private alertMessage = ".pf-c-alert__title";
private modalDialogTitle = ".pf-c-modal-box__title-text";
private modalDialogBodyText = ".pf-c-modal-box__body";
private deleteDialogCancelBtn = "#modal-cancel";
private jsonEditorSaveBtn = "jsonEditor-saveBtn";
private jsonEditorSavePoliciesBtn = "jsonEditor-policies-saveBtn";
private jsonEditorReloadBtn = "jsonEditor-reloadBtn";
private jsonEditor = ".monaco-scrollable-element.editor-scrollable.vs";
private clientPolicyDrpDwn = '[data-testid="action-dropdown"] button';
private deleteclientPolicyDrpDwn = "deleteClientPolicyDropdown";
private clientProfileOne =
#formViewProfilesView = "formView-profilesView";
#jsonEditorProfilesView = "jsonEditor-profilesView";
#createProfileBtn = "createProfile";
#formViewSelect = "formView-profilesView";
#jsonEditorSelect = "jsonEditor-profilesView";
#formViewSelectPolicies = "formView-policiesView";
#jsonEditorSelectPolicies = "jsonEditor-policiesView";
#newClientProfileNameInput = "client-profile-name";
#newClientProfileDescriptionInput = "client-profile-description";
#saveNewClientProfileBtn = "saveCreateProfile";
#cancelNewClientProfile = "cancelCreateProfile";
#createPolicyEmptyStateBtn = "no-client-policies-empty-action";
#createPolicyBtn = "createPolicy";
#newClientPolicyNameInput = "client-policy-name";
#newClientPolicyDescriptionInput = "client-policy-description";
#saveNewClientPolicyBtn = "saveCreatePolicy";
#cancelNewClientPolicyBtn = "cancelCreatePolicy";
#alertMessage = ".pf-c-alert__title";
#modalDialogTitle = ".pf-c-modal-box__title-text";
#modalDialogBodyText = ".pf-c-modal-box__body";
#deleteDialogCancelBtn = "#modal-cancel";
#jsonEditorSaveBtn = "jsonEditor-saveBtn";
#jsonEditorSavePoliciesBtn = "jsonEditor-policies-saveBtn";
#jsonEditorReloadBtn = "jsonEditor-reloadBtn";
#jsonEditor = ".monaco-scrollable-element.editor-scrollable.vs";
#clientPolicyDrpDwn = '[data-testid="action-dropdown"] button';
#deleteclientPolicyDrpDwn = "deleteClientPolicyDropdown";
#clientProfileOne =
'a[href*="realm-settings/client-policies/Test/edit-profile"]';
private clientProfileTwo =
#clientProfileTwo =
'a[href*="realm-settings/client-policies/Edit/edit-profile"]';
private clientPolicy =
'a[href*="realm-settings/client-policies/Test/edit-policy"]';
private reloadBtn = "reloadProfile";
private addExecutor = "addExecutor";
private addExecutorDrpDwn = ".pf-c-select__toggle";
private addExecutorDrpDwnOption = "executorType-select";
private addExecutorCancelBtn = ".pf-c-form__actions a";
private addExecutorSaveBtn = "addExecutor-saveBtn";
private availablePeriodExecutorFld = "available-period";
private editExecutorBtn =
#clientPolicy = 'a[href*="realm-settings/client-policies/Test/edit-policy"]';
#reloadBtn = "reloadProfile";
#addExecutor = "addExecutor";
#addExecutorDrpDwn = ".pf-c-select__toggle";
#addExecutorDrpDwnOption = "executorType-select";
#addExecutorCancelBtn = ".pf-c-form__actions a";
#addExecutorSaveBtn = "addExecutor-saveBtn";
#availablePeriodExecutorFld = "available-period";
#editExecutorBtn =
'[aria-label="Executors"] > li > div:first-child [data-testid="editExecutor"]';
private executorAvailablePeriodInput = "#available-period";
#executorAvailablePeriodInput = "#available-period";
private listingPage = new ListingPage();
private addCondition = "addCondition";
private addConditionDrpDwn = ".pf-c-select__toggle";
private addConditionDrpDwnOption = "conditionType-select";
private addConditionCancelBtn = "addCondition-cancelBtn";
private addConditionSaveBtn = "addCondition-saveBtn";
private clientRolesConditionLink = "client-roles-condition-link";
private clientScopesConditionLink = "client-scopes-condition-link";
private eventListenersFormLabel = ".pf-c-form__label-text";
private eventListenersDrpDwn = ".pf-c-select.kc_eventListeners_select";
private eventListenersSaveBtn = "saveEventListenerBtn";
private eventListenersRevertBtn = "revertEventListenerBtn";
private eventListenersInputFld =
".pf-c-form-control.pf-c-select__toggle-typeahead";
private eventListenersDrpDwnOption = ".pf-c-select__menu-item";
private eventListenersDrwDwnSelect =
#listingPage = new ListingPage();
#addCondition = "addCondition";
#addConditionDrpDwn = ".pf-c-select__toggle";
#addConditionDrpDwnOption = "conditionType-select";
#addConditionCancelBtn = "addCondition-cancelBtn";
#addConditionSaveBtn = "addCondition-saveBtn";
#clientRolesConditionLink = "client-roles-condition-link";
#clientScopesConditionLink = "client-scopes-condition-link";
#eventListenersFormLabel = ".pf-c-form__label-text";
#eventListenersDrpDwn = ".pf-c-select.kc_eventListeners_select";
#eventListenersSaveBtn = "saveEventListenerBtn";
#eventListenersRevertBtn = "revertEventListenerBtn";
#eventListenersInputFld = ".pf-c-form-control.pf-c-select__toggle-typeahead";
#eventListenersDrpDwnOption = ".pf-c-select__menu-item";
#eventListenersDrwDwnSelect =
".pf-c-button.pf-c-select__toggle-button.pf-m-plain";
private eventListenerRemove = '[data-ouia-component-id="Remove"]';
private roleSelect = "config.roles0";
private selectScopeButton = "addValue";
private deleteClientRolesConditionBtn = "delete-client-roles-condition";
private deleteClientScopesConditionBtn = "delete-client-scopes-condition";
private realmDisplayName = "#kc-display-name";
private frontEndURL = "#kc-frontend-url";
private requireSSL = "#kc-require-ssl";
private fromDisplayName = "from-display-name";
private replyToEmail = "#kc-reply-to";
private port = "#kc-port";
#eventListenerRemove = '[data-ouia-component-id="Remove"]';
#roleSelect = "config.roles0";
#selectScopeButton = "addValue";
#deleteClientRolesConditionBtn = "delete-client-roles-condition";
#deleteClientScopesConditionBtn = "delete-client-scopes-condition";
#realmDisplayName = "#kc-display-name";
#frontEndURL = "#kc-frontend-url";
#requireSSL = "#kc-require-ssl";
#fromDisplayName = "from-display-name";
#replyToEmail = "#kc-reply-to";
#port = "#kc-port";
private keysList = ".kc-keys-list > tbody > tr > td";
private publicKeyBtn =
".kc-keys-list > tbody > tr > td > .button-wrapper > button";
private realmSettingsEventsTab = new RealmSettingsEventsTab();
#publicKeyBtn = ".kc-keys-list > tbody > tr > td > .button-wrapper > button";
#realmSettingsEventsTab = new RealmSettingsEventsTab();
private realmName?: string;
#realmName?: string;
constructor(realmName?: string) {
super();
this.realmName = realmName;
this.#realmName = realmName;
}
goToEventsTab() {
this.tabUtils().clickTab(RealmSettingsTab.Events);
return this.realmSettingsEventsTab;
return this.#realmSettingsEventsTab;
}
disableRealm() {
cy.get(this.modalDialogTitle).contains("Disable realm?");
cy.get(this.modalDialogBodyText).contains(
cy.get(this.#modalDialogTitle).contains("Disable realm?");
cy.get(this.#modalDialogBodyText).contains(
"User and clients can't access the realm if it's disabled. Are you sure you want to continue?",
);
cy.findByTestId(this.modalConfirm).contains("Disable").click();
@ -298,47 +294,47 @@ export default class RealmSettingsPage extends CommonPage {
}
getDisplayName(name: string) {
cy.get(this.realmDisplayName).should("have.value", name);
cy.get(this.#realmDisplayName).should("have.value", name);
return this;
}
getFrontendURL(url: string) {
cy.get(this.frontEndURL).should("have.value", url);
cy.get(this.#frontEndURL).should("have.value", url);
return this;
}
getRequireSSL(option: string) {
cy.get(this.requireSSL).contains(option);
cy.get(this.#requireSSL).contains(option);
return this;
}
fillDisplayName(displayName: string) {
cy.get(this.realmDisplayName).clear().type(displayName);
cy.get(this.#realmDisplayName).clear().type(displayName);
}
fillFromDisplayName(displayName: string) {
cy.findByTestId(this.fromDisplayName).clear().type(displayName);
cy.findByTestId(this.#fromDisplayName).clear().type(displayName);
}
fillReplyToEmail(email: string) {
cy.get(this.replyToEmail).clear().type(email);
cy.get(this.#replyToEmail).clear().type(email);
}
fillPort(port: string) {
cy.get(this.port).clear().type(port);
cy.get(this.#port).clear().type(port);
}
fillFrontendURL(url: string) {
cy.get(this.frontEndURL).clear().type(url);
cy.get(this.#frontEndURL).clear().type(url);
}
clearFrontendURL() {
cy.get(this.frontEndURL).clear();
cy.get(this.#frontEndURL).clear();
}
fillRequireSSL(option: string) {
cy.get(this.requireSSL)
cy.get(this.#requireSSL)
.click()
.get(".pf-c-select__menu-item")
.contains(option)
@ -381,10 +377,10 @@ export default class RealmSettingsPage extends CommonPage {
}
deleteProvider(name: string) {
this.listingPage.deleteItem(name);
this.#listingPage.deleteItem(name);
this.modalUtils().checkModalTitle("Delete key provider?").confirmModal();
cy.get(this.alertMessage).should(
cy.get(this.#alertMessage).should(
"be.visible",
"Success. The provider has been deleted.",
);
@ -392,10 +388,10 @@ export default class RealmSettingsPage extends CommonPage {
}
checkKeyPublic() {
cy.get(this.publicKeyBtn).contains("Public key").click();
cy.get(this.#publicKeyBtn).contains("Public key").click();
this.modalUtils().checkModalTitle("Public key").confirmModal();
cy.get(this.publicKeyBtn).contains("Certificate").click();
cy.get(this.#publicKeyBtn).contains("Certificate").click();
this.modalUtils().checkModalTitle("Certificate").confirmModal();
}
@ -431,7 +427,7 @@ export default class RealmSettingsPage extends CommonPage {
}
toggleAddProviderDropdown() {
const keysUrl = `/admin/realms/${this.realmName}/keys`;
const keysUrl = `/admin/realms/${this.#realmName}/keys`;
cy.intercept(keysUrl).as("keysFetch");
cy.findByTestId(this.addProviderDropdown).click();
@ -652,86 +648,86 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldDisplayEventListenersForm() {
cy.get(this.eventListenersFormLabel)
cy.get(this.#eventListenersFormLabel)
.should("be.visible")
.contains("Event listeners");
cy.get(this.eventListenersDrpDwn).should("exist");
cy.findByTestId(this.eventListenersSaveBtn).should("exist");
cy.findAllByTestId(this.eventListenersRevertBtn).should("exist");
cy.get(this.#eventListenersDrpDwn).should("exist");
cy.findByTestId(this.#eventListenersSaveBtn).should("exist");
cy.findAllByTestId(this.#eventListenersRevertBtn).should("exist");
}
shouldRevertSavingEventListener() {
cy.get(this.eventListenersInputFld).click().type("email");
cy.get(this.eventListenersDrpDwnOption).click();
cy.get(this.eventListenersDrwDwnSelect).click();
cy.findByTestId(this.eventListenersRevertBtn).click();
cy.get(this.eventListenersDrpDwn).should("not.have.text", "email");
cy.get(this.#eventListenersInputFld).click().type("email");
cy.get(this.#eventListenersDrpDwnOption).click();
cy.get(this.#eventListenersDrwDwnSelect).click();
cy.findByTestId(this.#eventListenersRevertBtn).click();
cy.get(this.#eventListenersDrpDwn).should("not.have.text", "email");
}
shouldSaveEventListener() {
cy.get(this.eventListenersInputFld).click().type("email");
cy.get(this.eventListenersDrpDwnOption).click();
cy.get(this.eventListenersDrwDwnSelect).click();
cy.findByTestId(this.eventListenersSaveBtn).click();
cy.get(this.alertMessage).should(
cy.get(this.#eventListenersInputFld).click().type("email");
cy.get(this.#eventListenersDrpDwnOption).click();
cy.get(this.#eventListenersDrwDwnSelect).click();
cy.findByTestId(this.#eventListenersSaveBtn).click();
cy.get(this.#alertMessage).should(
"be.visible",
"Event listener has been updated.",
);
}
shouldRemoveEventFromEventListener() {
cy.get(this.eventListenerRemove).last().click({ force: true });
cy.findByTestId(this.eventListenersSaveBtn).click({ force: true });
cy.get(this.alertMessage).should(
cy.get(this.#eventListenerRemove).last().click({ force: true });
cy.findByTestId(this.#eventListenersSaveBtn).click({ force: true });
cy.get(this.#alertMessage).should(
"be.visible",
"Event listener has been updated.",
);
cy.get(this.eventListenersDrpDwn).should("not.have.text", "email");
cy.get(this.#eventListenersDrpDwn).should("not.have.text", "email");
}
shouldRemoveAllEventListeners() {
cy.get(".pf-c-button.pf-m-plain.pf-c-select__toggle-clear").click();
cy.findByTestId(this.eventListenersSaveBtn).click();
cy.get(this.eventListenersDrpDwn).should("not.have.text", "jboss-logging");
cy.get(this.eventListenersDrpDwn).should("not.have.text", "email");
cy.findByTestId(this.#eventListenersSaveBtn).click();
cy.get(this.#eventListenersDrpDwn).should("not.have.text", "jboss-logging");
cy.get(this.#eventListenersDrpDwn).should("not.have.text", "email");
}
shouldReSaveEventListener() {
cy.get(this.eventListenersInputFld).click().type("jboss-logging");
cy.get(this.eventListenersDrpDwnOption).click();
cy.get(this.eventListenersDrwDwnSelect).click();
cy.findByTestId(this.eventListenersSaveBtn).click();
cy.get(this.#eventListenersInputFld).click().type("jboss-logging");
cy.get(this.#eventListenersDrpDwnOption).click();
cy.get(this.#eventListenersDrwDwnSelect).click();
cy.findByTestId(this.#eventListenersSaveBtn).click();
}
shouldDisplayProfilesTab() {
cy.findByTestId(this.createProfileBtn).should("exist");
cy.findByTestId(this.formViewSelect).should("exist");
cy.findByTestId(this.jsonEditorSelect).should("exist");
cy.findByTestId(this.#createProfileBtn).should("exist");
cy.findByTestId(this.#formViewSelect).should("exist");
cy.findByTestId(this.#jsonEditorSelect).should("exist");
cy.get("table").should("be.visible").contains("td", "Global");
}
shouldDisplayNewClientProfileForm() {
cy.findByTestId(this.createProfileBtn).click();
cy.findByTestId(this.newClientProfileNameInput).should("exist");
cy.findByTestId(this.newClientProfileDescriptionInput).should("exist");
cy.findByTestId(this.saveNewClientProfileBtn).should("exist");
cy.findByTestId(this.cancelNewClientProfile).should("exist");
cy.findByTestId(this.#createProfileBtn).click();
cy.findByTestId(this.#newClientProfileNameInput).should("exist");
cy.findByTestId(this.#newClientProfileDescriptionInput).should("exist");
cy.findByTestId(this.#saveNewClientProfileBtn).should("exist");
cy.findByTestId(this.#cancelNewClientProfile).should("exist");
}
createClientProfile(name: string, description: string) {
cy.findByTestId(this.createProfileBtn).click();
cy.findByTestId(this.newClientProfileNameInput).type(name);
cy.findByTestId(this.newClientProfileDescriptionInput).type(description);
cy.findByTestId(this.#createProfileBtn).click();
cy.findByTestId(this.#newClientProfileNameInput).type(name);
cy.findByTestId(this.#newClientProfileDescriptionInput).type(description);
return this;
}
saveClientProfileCreation() {
cy.findByTestId(this.saveNewClientProfileBtn).click();
cy.findByTestId(this.#saveNewClientProfileBtn).click();
return this;
}
cancelClientProfileCreation() {
cy.findByTestId(this.cancelNewClientProfile).click();
cy.findByTestId(this.#cancelNewClientProfile).click();
return this;
}
@ -741,7 +737,7 @@ export default class RealmSettingsPage extends CommonPage {
}
cancelDeleteClientPolicy() {
cy.get(this.deleteDialogCancelBtn)
cy.get(this.#deleteDialogCancelBtn)
.contains("Cancel")
.click({ force: true });
cy.get("table").should("be.visible").contains("td", "Test");
@ -749,48 +745,48 @@ export default class RealmSettingsPage extends CommonPage {
}
deleteClientPolicyItemFromTable(name: string) {
this.listingPage.searchItem(name, false);
this.listingPage.clickRowDetails(name).clickDetailMenu("Delete");
this.#listingPage.searchItem(name, false);
this.#listingPage.clickRowDetails(name).clickDetailMenu("Delete");
return this;
}
shouldNavigateBetweenFormAndJSONView() {
cy.findByTestId(this.jsonEditorProfilesView).check();
cy.findByTestId(this.jsonEditorSaveBtn).contains("Save");
cy.findByTestId(this.jsonEditorReloadBtn).contains("Reload");
cy.findByTestId(this.formViewProfilesView).check();
cy.findByTestId(this.createProfileBtn).contains("Create client profile");
cy.findByTestId(this.#jsonEditorProfilesView).check();
cy.findByTestId(this.#jsonEditorSaveBtn).contains("Save");
cy.findByTestId(this.#jsonEditorReloadBtn).contains("Reload");
cy.findByTestId(this.#formViewProfilesView).check();
cy.findByTestId(this.#createProfileBtn).contains("Create client profile");
}
shouldSaveChangedJSONProfiles() {
cy.findByTestId(this.jsonEditorProfilesView).check();
cy.get(this.jsonEditor).type(`{pageup}{del} [{
cy.findByTestId(this.#jsonEditorProfilesView).check();
cy.get(this.#jsonEditor).type(`{pageup}{del} [{
"name": "Test",
"description": "Test Description",
"executors": [],
"global": false
}, {downarrow}{end}{backspace}{backspace}`);
cy.findByTestId(this.jsonEditorSaveBtn).click();
cy.get(this.alertMessage).should(
cy.findByTestId(this.#jsonEditorSaveBtn).click();
cy.get(this.#alertMessage).should(
"be.visible",
"The client profiles configuration was updated",
);
cy.findByTestId(this.formViewProfilesView).check();
cy.findByTestId(this.#formViewProfilesView).check();
cy.get("table").should("be.visible").contains("td", "Test");
}
shouldEditClientProfile() {
cy.get(this.clientProfileOne).click();
cy.findByTestId(this.newClientProfileNameInput)
cy.get(this.#clientProfileOne).click();
cy.findByTestId(this.#newClientProfileNameInput)
.click()
.clear()
.type("Edit");
cy.findByTestId(this.newClientProfileDescriptionInput)
cy.findByTestId(this.#newClientProfileDescriptionInput)
.click()
.clear()
.type("Edit Description");
cy.findByTestId(this.saveNewClientProfileBtn).click();
cy.get(this.alertMessage).should(
cy.findByTestId(this.#saveNewClientProfileBtn).click();
cy.get(this.#alertMessage).should(
"be.visible",
"Client profile updated successfully",
);
@ -802,8 +798,8 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldShowErrorWhenNameBlank() {
cy.get(this.clientProfileTwo).click();
cy.findByTestId(this.newClientProfileNameInput).click().clear();
cy.get(this.#clientProfileTwo).click();
cy.findByTestId(this.#newClientProfileNameInput).click().clear();
cy.get("form").should("not.have.text", "Required field");
}
@ -815,17 +811,17 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldReloadClientProfileEdits() {
cy.get(this.clientProfileTwo).click();
cy.findByTestId(this.newClientProfileNameInput).type("Reloading");
cy.findByTestId(this.reloadBtn).click();
cy.findByTestId(this.newClientProfileNameInput).should(
cy.get(this.#clientProfileTwo).click();
cy.findByTestId(this.#newClientProfileNameInput).type("Reloading");
cy.findByTestId(this.#reloadBtn).click();
cy.findByTestId(this.#newClientProfileNameInput).should(
"have.value",
"Edit",
);
}
shouldNotHaveExecutorsConfigured() {
cy.get(this.clientProfileTwo).click();
cy.get(this.#clientProfileTwo).click();
cy.get('h2[class*="kc-emptyExecutors"]').should(
"have.text",
"No executors configured",
@ -833,13 +829,13 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldCancelAddingExecutor() {
cy.get(this.clientProfileTwo).click();
cy.findByTestId(this.addExecutor).click();
cy.get(this.addExecutorDrpDwn).click();
cy.findByTestId(this.addExecutorDrpDwnOption)
cy.get(this.#clientProfileTwo).click();
cy.findByTestId(this.#addExecutor).click();
cy.get(this.#addExecutorDrpDwn).click();
cy.findByTestId(this.#addExecutorDrpDwnOption)
.contains("secure-ciba-signed-authn-req")
.click();
cy.get(this.addExecutorCancelBtn).click();
cy.get(this.#addExecutorCancelBtn).click();
cy.get('h2[class*="kc-emptyExecutors"]').should(
"have.text",
"No executors configured",
@ -847,14 +843,14 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldAddExecutor() {
cy.get(this.clientProfileTwo).click();
cy.findByTestId(this.addExecutor).click();
cy.get(this.addExecutorDrpDwn).click();
cy.findByTestId(this.addExecutorDrpDwnOption)
cy.get(this.#clientProfileTwo).click();
cy.findByTestId(this.#addExecutor).click();
cy.get(this.#addExecutorDrpDwn).click();
cy.findByTestId(this.#addExecutorDrpDwnOption)
.contains("secure-ciba-signed-authn-req")
.click();
cy.findByTestId(this.addExecutorSaveBtn).click();
cy.get(this.alertMessage).should(
cy.findByTestId(this.#addExecutorSaveBtn).click();
cy.get(this.#alertMessage).should(
"be.visible",
"Success! Executor created successfully",
);
@ -865,14 +861,14 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldCancelDeletingExecutor() {
cy.get(this.clientProfileTwo).click();
cy.get(this.#clientProfileTwo).click();
cy.get('svg[class*="kc-executor-trash-icon"]').click();
cy.get(this.modalDialogTitle).contains("Delete executor?");
cy.get(this.modalDialogBodyText).contains(
cy.get(this.#modalDialogTitle).contains("Delete executor?");
cy.get(this.#modalDialogBodyText).contains(
"The action will permanently delete secure-ciba-signed-authn-req. This cannot be undone.",
);
cy.findByTestId(this.modalConfirm).contains("Delete");
cy.get(this.deleteDialogCancelBtn).contains("Cancel").click();
cy.get(this.#deleteDialogCancelBtn).contains("Cancel").click();
cy.get('ul[class*="pf-c-data-list"]').should(
"have.text",
"secure-ciba-signed-authn-req",
@ -881,7 +877,7 @@ export default class RealmSettingsPage extends CommonPage {
openProfileDetails(name: string) {
cy.intercept(
`/admin/realms/${this.realmName}/client-policies/profiles*`,
`/admin/realms/${this.#realmName}/client-policies/profiles*`,
).as("profilesFetch");
cy.get(
'a[href*="realm-settings/client-policies/' + name + '/edit-profile"]',
@ -892,12 +888,12 @@ export default class RealmSettingsPage extends CommonPage {
editExecutor(availablePeriod?: number) {
cy.intercept(
`/admin/realms/${this.realmName}/client-policies/profiles*`,
`/admin/realms/${this.#realmName}/client-policies/profiles*`,
).as("profilesFetch");
cy.get(this.editExecutorBtn).click();
cy.get(this.#editExecutorBtn).click();
cy.wait("@profilesFetch");
if (availablePeriod) {
cy.get(this.executorAvailablePeriodInput)
cy.get(this.#executorAvailablePeriodInput)
.clear()
.type(availablePeriod.toString());
}
@ -905,12 +901,14 @@ export default class RealmSettingsPage extends CommonPage {
}
saveExecutor() {
cy.findByTestId(this.addExecutorSaveBtn).click();
cy.findByTestId(this.#addExecutorSaveBtn).click();
return this;
}
cancelEditingExecutor() {
cy.get(this.addExecutorCancelBtn).contains("Cancel").click({ force: true });
cy.get(this.#addExecutorCancelBtn)
.contains("Cancel")
.click({ force: true });
return this;
}
@ -923,7 +921,7 @@ export default class RealmSettingsPage extends CommonPage {
}
checkAvailablePeriodExecutor(value: number) {
cy.findByTestId(this.availablePeriodExecutorFld).should(
cy.findByTestId(this.#availablePeriodExecutorFld).should(
"have.value",
value,
);
@ -931,21 +929,21 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldEditExecutor() {
cy.get(this.clientProfileTwo).click();
cy.get(this.editExecutorBtn).click();
cy.findByTestId(this.availablePeriodExecutorFld).clear().type("4000");
cy.findByTestId(this.addExecutorSaveBtn).click();
cy.get(this.alertMessage).should(
cy.get(this.#clientProfileTwo).click();
cy.get(this.#editExecutorBtn).click();
cy.findByTestId(this.#availablePeriodExecutorFld).clear().type("4000");
cy.findByTestId(this.#addExecutorSaveBtn).click();
cy.get(this.#alertMessage).should(
"be.visible",
"Executor updated successfully",
);
}
shouldDeleteExecutor() {
cy.get(this.clientProfileTwo).click();
cy.get(this.#clientProfileTwo).click();
cy.get('svg[class*="kc-executor-trash-icon"]').click();
cy.get(this.modalDialogTitle).contains("Delete executor?");
cy.get(this.modalDialogBodyText).contains(
cy.get(this.#modalDialogTitle).contains("Delete executor?");
cy.get(this.#modalDialogBodyText).contains(
"The action will permanently delete secure-ciba-signed-authn-req. This cannot be undone.",
);
cy.findByTestId(this.modalConfirm).contains("Delete");
@ -957,23 +955,23 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldReloadJSONProfiles() {
cy.findByTestId(this.jsonEditorProfilesView).check();
cy.findByTestId(this.jsonEditorReloadBtn).contains("Reload").click();
cy.findByTestId(this.jsonEditorSaveBtn).contains("Save");
cy.findByTestId(this.jsonEditorReloadBtn).contains("Reload");
cy.findByTestId(this.#jsonEditorProfilesView).check();
cy.findByTestId(this.#jsonEditorReloadBtn).contains("Reload").click();
cy.findByTestId(this.#jsonEditorSaveBtn).contains("Save");
cy.findByTestId(this.#jsonEditorReloadBtn).contains("Reload");
}
shouldSaveChangedJSONPolicies() {
cy.findByTestId(this.jsonEditorSelectPolicies).check();
cy.findByTestId(this.jsonEditorReloadBtn).click();
cy.findByTestId(this.#jsonEditorSelectPolicies).check();
cy.findByTestId(this.#jsonEditorReloadBtn).click();
cy.get(this.jsonEditor).type(`{pageup}{del} [{
cy.get(this.#jsonEditor).type(`{pageup}{del} [{
"name": "Reload",
}, {downarrow}{end}{backspace}{backspace}{backspace}{backspace}`);
cy.findByTestId(this.jsonEditorReloadBtn).click();
cy.findByTestId(this.#jsonEditorReloadBtn).click();
cy.get(this.jsonEditor).type(`{pageup}{del} [{
cy.get(this.#jsonEditor).type(`{pageup}{del} [{
"name": "Test",
"description": "Test Description",
"enabled": false,
@ -981,43 +979,43 @@ export default class RealmSettingsPage extends CommonPage {
"profiles": [],
}, {downarrow}{end}{backspace}{backspace}{backspace}{backspace}`);
cy.findByTestId(this.jsonEditorSavePoliciesBtn).click();
cy.findByTestId(this.#jsonEditorSavePoliciesBtn).click();
cy.get(this.alertMessage).should(
cy.get(this.#alertMessage).should(
"be.visible",
"The client policy configuration was updated",
);
cy.findByTestId(this.formViewSelectPolicies).check();
cy.findByTestId(this.#formViewSelectPolicies).check();
cy.get("table").should("be.visible").contains("td", "Test");
}
shouldNavigateBetweenFormAndJSONViewPolicies() {
cy.findByTestId(this.jsonEditorSelectPolicies).check();
cy.findByTestId(this.jsonEditorSavePoliciesBtn).contains("Save");
cy.findByTestId(this.jsonEditorReloadBtn).contains("Reload");
cy.findByTestId(this.formViewSelectPolicies).check();
cy.findByTestId(this.createPolicyEmptyStateBtn).contains(
cy.findByTestId(this.#jsonEditorSelectPolicies).check();
cy.findByTestId(this.#jsonEditorSavePoliciesBtn).contains("Save");
cy.findByTestId(this.#jsonEditorReloadBtn).contains("Reload");
cy.findByTestId(this.#formViewSelectPolicies).check();
cy.findByTestId(this.#createPolicyEmptyStateBtn).contains(
"Create client policy",
);
}
checkDisplayPoliciesTab() {
cy.findByTestId(this.createPolicyEmptyStateBtn).should("exist");
cy.findByTestId(this.formViewSelectPolicies).should("exist");
cy.findByTestId(this.jsonEditorSelectPolicies).should("exist");
cy.findByTestId(this.#createPolicyEmptyStateBtn).should("exist");
cy.findByTestId(this.#formViewSelectPolicies).should("exist");
cy.findByTestId(this.#jsonEditorSelectPolicies).should("exist");
return this;
}
checkNewClientPolicyForm() {
cy.findByTestId(this.newClientPolicyNameInput).should("exist");
cy.findByTestId(this.newClientPolicyDescriptionInput).should("exist");
cy.findByTestId(this.saveNewClientPolicyBtn).should("exist");
cy.findByTestId(this.cancelNewClientPolicyBtn).should("exist");
cy.findByTestId(this.#newClientPolicyNameInput).should("exist");
cy.findByTestId(this.#newClientPolicyDescriptionInput).should("exist");
cy.findByTestId(this.#saveNewClientPolicyBtn).should("exist");
cy.findByTestId(this.#cancelNewClientPolicyBtn).should("exist");
return this;
}
cancelNewClientPolicyCreation() {
cy.findByTestId(this.cancelNewClientPolicyBtn).click();
cy.findByTestId(this.#cancelNewClientPolicyBtn).click();
return this;
}
@ -1026,11 +1024,11 @@ export default class RealmSettingsPage extends CommonPage {
description: string,
cancel?: boolean,
) {
cy.findByTestId(this.createPolicyBtn).click();
cy.findByTestId(this.newClientPolicyNameInput).type(name);
cy.findByTestId(this.newClientPolicyDescriptionInput).type(description);
cy.findByTestId(this.#createPolicyBtn).click();
cy.findByTestId(this.#newClientPolicyNameInput).type(name);
cy.findByTestId(this.#newClientPolicyDescriptionInput).type(description);
if (!cancel) {
cy.findByTestId(this.saveNewClientPolicyBtn).click();
cy.findByTestId(this.#saveNewClientPolicyBtn).click();
}
return this;
}
@ -1046,7 +1044,7 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldNotHaveConditionsConfigured() {
cy.get(this.clientPolicy).click();
cy.get(this.#clientPolicy).click();
cy.get('h2[class*="kc-emptyConditions"]').should(
"have.text",
"No conditions configured",
@ -1054,13 +1052,13 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldCancelAddingCondition() {
cy.get(this.clientPolicy).click();
cy.findByTestId(this.addCondition).click();
cy.get(this.addConditionDrpDwn).click();
cy.findByTestId(this.addConditionDrpDwnOption)
cy.get(this.#clientPolicy).click();
cy.findByTestId(this.#addCondition).click();
cy.get(this.#addConditionDrpDwn).click();
cy.findByTestId(this.#addConditionDrpDwnOption)
.contains("any-client")
.click();
cy.findByTestId(this.addConditionCancelBtn).click();
cy.findByTestId(this.#addConditionCancelBtn).click();
cy.get('h2[class*="kc-emptyConditions"]').should(
"have.text",
"No conditions configured",
@ -1068,16 +1066,16 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldAddClientRolesCondition() {
cy.get(this.clientPolicy).click();
cy.findByTestId(this.addCondition).click();
cy.get(this.addConditionDrpDwn).click();
cy.findByTestId(this.addConditionDrpDwnOption)
cy.get(this.#clientPolicy).click();
cy.findByTestId(this.#addCondition).click();
cy.get(this.#addConditionDrpDwn).click();
cy.findByTestId(this.#addConditionDrpDwnOption)
.contains("client-roles")
.click();
cy.findByTestId(this.roleSelect).clear().type("manage-realm");
cy.findByTestId(this.#roleSelect).clear().type("manage-realm");
cy.findByTestId(this.addConditionSaveBtn).click();
cy.get(this.alertMessage).should(
cy.findByTestId(this.#addConditionSaveBtn).click();
cy.get(this.#alertMessage).should(
"be.visible",
"Success! Condition created successfully",
);
@ -1086,24 +1084,24 @@ export default class RealmSettingsPage extends CommonPage {
addClientScopes() {
cy.findByTestId("config.scopes0").clear().type("one");
cy.findByTestId(this.selectScopeButton).click();
cy.findByTestId(this.#selectScopeButton).click();
cy.findByTestId("config.scopes1").clear().type("two");
cy.findByTestId(this.selectScopeButton).click();
cy.findByTestId(this.#selectScopeButton).click();
cy.findByTestId("config.scopes2").clear().type("three");
}
shouldAddClientScopesCondition() {
cy.get(this.clientPolicy).click();
cy.findByTestId(this.addCondition).click();
cy.get(this.addConditionDrpDwn).click();
cy.findByTestId(this.addConditionDrpDwnOption)
cy.get(this.#clientPolicy).click();
cy.findByTestId(this.#addCondition).click();
cy.get(this.#addConditionDrpDwn).click();
cy.findByTestId(this.#addConditionDrpDwnOption)
.contains("client-scopes")
.click();
this.addClientScopes();
cy.findByTestId(this.addConditionSaveBtn).click();
cy.get(this.alertMessage).should(
cy.findByTestId(this.#addConditionSaveBtn).click();
cy.get(this.#alertMessage).should(
"be.visible",
"Success! Condition created successfully",
);
@ -1111,29 +1109,29 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldEditClientRolesCondition() {
cy.get(this.clientPolicy).click();
cy.get(this.#clientPolicy).click();
cy.findByTestId(this.clientRolesConditionLink).click();
cy.findByTestId(this.#clientRolesConditionLink).click();
cy.findByTestId(this.roleSelect).should("have.value", "manage-realm");
cy.findByTestId(this.roleSelect).clear().type("admin");
cy.findByTestId(this.#roleSelect).should("have.value", "manage-realm");
cy.findByTestId(this.#roleSelect).clear().type("admin");
cy.findByTestId(this.addConditionSaveBtn).click();
cy.get(this.alertMessage).should(
cy.findByTestId(this.#addConditionSaveBtn).click();
cy.get(this.#alertMessage).should(
"be.visible",
"Success! Condition updated successfully",
);
}
shouldEditClientScopesCondition() {
cy.get(this.clientPolicy).click();
cy.get(this.#clientPolicy).click();
cy.findByTestId(this.clientScopesConditionLink).click();
cy.findByTestId(this.#clientScopesConditionLink).click();
cy.findByTestId("config.scopes0").clear().type("edit");
cy.findByTestId(this.addConditionSaveBtn).click();
cy.get(this.alertMessage).should(
cy.findByTestId(this.#addConditionSaveBtn).click();
cy.get(this.#alertMessage).should(
"be.visible",
"Success! Condition updated successfully",
);
@ -1145,16 +1143,16 @@ export default class RealmSettingsPage extends CommonPage {
}
deleteClientRolesCondition() {
cy.get(this.clientPolicy).click();
cy.findByTestId(this.deleteClientRolesConditionBtn).click();
cy.get(this.#clientPolicy).click();
cy.findByTestId(this.#deleteClientRolesConditionBtn).click();
return this;
}
shouldDeleteClientScopesCondition() {
cy.get(this.clientPolicy).click();
cy.findByTestId(this.deleteClientScopesConditionBtn).click();
cy.get(this.modalDialogTitle).contains("Delete condition?");
cy.get(this.modalDialogBodyText).contains(
cy.get(this.#clientPolicy).click();
cy.findByTestId(this.#deleteClientScopesConditionBtn).click();
cy.get(this.#modalDialogTitle).contains("Delete condition?");
cy.get(this.#modalDialogBodyText).contains(
"This action will permanently delete client-scopes. This cannot be undone.",
);
cy.findByTestId(this.modalConfirm).contains("Delete");
@ -1185,17 +1183,17 @@ export default class RealmSettingsPage extends CommonPage {
description: string,
cancel?: boolean,
) {
cy.findByTestId(this.createPolicyEmptyStateBtn).click();
cy.findByTestId(this.newClientPolicyNameInput).type(name);
cy.findByTestId(this.newClientPolicyDescriptionInput).type(description);
cy.findByTestId(this.#createPolicyEmptyStateBtn).click();
cy.findByTestId(this.#newClientPolicyNameInput).type(name);
cy.findByTestId(this.#newClientPolicyDescriptionInput).type(description);
if (!cancel) {
cy.findByTestId(this.saveNewClientPolicyBtn).click();
cy.findByTestId(this.#saveNewClientPolicyBtn).click();
}
return this;
}
checkEmptyPolicyList() {
cy.findByTestId(this.createPolicyEmptyStateBtn).should("exist");
cy.findByTestId(this.#createPolicyEmptyStateBtn).should("exist");
return this;
}
@ -1210,8 +1208,8 @@ export default class RealmSettingsPage extends CommonPage {
}
deleteClientPolicyFromDetails() {
cy.get(this.clientPolicyDrpDwn).click({ force: true });
cy.findByTestId(this.deleteclientPolicyDrpDwn).click({ force: true });
cy.get(this.#clientPolicyDrpDwn).click({ force: true });
cy.findByTestId(this.#deleteclientPolicyDrpDwn).click({ force: true });
return this;
}
@ -1221,10 +1219,10 @@ export default class RealmSettingsPage extends CommonPage {
}
shouldReloadJSONPolicies() {
cy.findByTestId(this.jsonEditorSelectPolicies).check();
cy.findByTestId(this.jsonEditorReloadBtn).contains("Reload").click();
cy.findByTestId(this.jsonEditorSavePoliciesBtn).contains("Save");
cy.findByTestId(this.jsonEditorReloadBtn).contains("Reload");
cy.findByTestId(this.#jsonEditorSelectPolicies).check();
cy.findByTestId(this.#jsonEditorReloadBtn).contains("Reload").click();
cy.findByTestId(this.#jsonEditorSavePoliciesBtn).contains("Save");
cy.findByTestId(this.#jsonEditorReloadBtn).contains("Reload");
}
goToLoginTab() {

View file

@ -1,159 +1,158 @@
import Select from "../../../../forms/Select";
export default class UserProfile {
private userProfileTab = "rs-user-profile-tab";
private attributesTab = "attributesTab";
private attributesGroupTab = "attributesGroupTab";
private jsonEditorTab = "jsonEditorTab";
private createAttributeButton = "createAttributeBtn";
private actionsDrpDwn = "actions-dropdown";
private deleteDrpDwnOption = "deleteDropdownAttributeItem";
private editDrpDwnOption = "editDropdownAttributeItem";
private cancelNewAttribute = "attribute-cancel";
private newAttributeNameInput = "attribute-name";
private newAttributeDisplayNameInput = "attribute-display-name";
private newAttributeEnabledWhen = 'input[name="enabledWhen"]';
private newAttributeCheckboxes = 'input[type="checkbox"]';
private newAttributeRequiredFor = 'input[name="roles"]';
private newAttributeRequiredWhen = 'input[name="requiredWhen"]';
private newAttributeEmptyValidators = ".kc-emptyValidators";
private newAttributeAnnotationBtn = "annotations-add-row";
private newAttributeAnnotationKey = "annotations.0.key";
private newAttributeAnnotationValue = "annotations.0.value";
private validatorRolesList = "#validator";
private validatorsList = 'tbody [data-label="name"]';
private saveNewAttributeBtn = "attribute-create";
private addValidatorBtn = "addValidator";
private saveValidatorBtn = "save-validator-role-button";
private removeValidatorBtn = "deleteValidator";
private deleteValidatorBtn = "confirm";
private cancelAddingValidatorBtn = "cancel-validator-role-button";
private cancelRemovingValidatorBtn = "cancel";
private validatorDialogCloseBtn = 'button[aria-label="Close"]';
#userProfileTab = "rs-user-profile-tab";
#attributesTab = "attributesTab";
#attributesGroupTab = "attributesGroupTab";
#jsonEditorTab = "jsonEditorTab";
#createAttributeButton = "createAttributeBtn";
#actionsDrpDwn = "actions-dropdown";
#deleteDrpDwnOption = "deleteDropdownAttributeItem";
#editDrpDwnOption = "editDropdownAttributeItem";
#cancelNewAttribute = "attribute-cancel";
#newAttributeNameInput = "attribute-name";
#newAttributeDisplayNameInput = "attribute-display-name";
#newAttributeEnabledWhen = 'input[name="enabledWhen"]';
#newAttributeCheckboxes = 'input[type="checkbox"]';
#newAttributeRequiredFor = 'input[name="roles"]';
#newAttributeRequiredWhen = 'input[name="requiredWhen"]';
#newAttributeEmptyValidators = ".kc-emptyValidators";
#newAttributeAnnotationBtn = "annotations-add-row";
#newAttributeAnnotationKey = "annotations.0.key";
#newAttributeAnnotationValue = "annotations.0.value";
#validatorRolesList = "#validator";
#validatorsList = 'tbody [data-label="name"]';
#saveNewAttributeBtn = "attribute-create";
#addValidatorBtn = "addValidator";
#saveValidatorBtn = "save-validator-role-button";
#removeValidatorBtn = "deleteValidator";
#deleteValidatorBtn = "confirm";
#cancelAddingValidatorBtn = "cancel-validator-role-button";
#cancelRemovingValidatorBtn = "cancel";
goToTab() {
cy.findByTestId(this.userProfileTab).click();
cy.findByTestId(this.#userProfileTab).click();
return this;
}
goToAttributesTab() {
cy.findByTestId(this.attributesTab).click();
cy.findByTestId(this.#attributesTab).click();
return this;
}
goToAttributesGroupTab() {
cy.findByTestId(this.attributesGroupTab).click();
cy.findByTestId(this.#attributesGroupTab).click();
return this;
}
goToJsonEditorTab() {
cy.findByTestId(this.jsonEditorTab).click();
cy.findByTestId(this.#jsonEditorTab).click();
return this;
}
createAttributeButtonClick() {
cy.findByTestId(this.createAttributeButton).click();
cy.findByTestId(this.#createAttributeButton).click();
return this;
}
selectDropdown() {
cy.findByTestId(this.actionsDrpDwn).click();
cy.findByTestId(this.#actionsDrpDwn).click();
return this;
}
selectDeleteOption() {
cy.findByTestId(this.deleteDrpDwnOption).click();
cy.findByTestId(this.#deleteDrpDwnOption).click();
return this;
}
selectEditOption() {
cy.findByTestId(this.editDrpDwnOption).click();
cy.findByTestId(this.#editDrpDwnOption).click();
return this;
}
cancelAttributeCreation() {
cy.findByTestId(this.cancelNewAttribute).click();
cy.findByTestId(this.#cancelNewAttribute).click();
return this;
}
createAttribute(name: string, displayName: string) {
cy.findByTestId(this.newAttributeNameInput).type(name);
cy.findByTestId(this.newAttributeDisplayNameInput).type(displayName);
cy.findByTestId(this.#newAttributeNameInput).type(name);
cy.findByTestId(this.#newAttributeDisplayNameInput).type(displayName);
return this;
}
checkElementNotInList(name: string) {
cy.get(this.validatorsList).should("not.contain.text", name);
cy.get(this.#validatorsList).should("not.contain.text", name);
return this;
}
saveAttributeCreation() {
cy.findByTestId(this.saveNewAttributeBtn).click();
cy.findByTestId(this.#saveNewAttributeBtn).click();
return this;
}
selectElementInList(name: string) {
cy.get(this.validatorsList).contains(name).click();
cy.get(this.#validatorsList).contains(name).click();
return this;
}
editAttribute(displayName: string) {
cy.findByTestId(this.newAttributeDisplayNameInput)
cy.findByTestId(this.#newAttributeDisplayNameInput)
.click()
.clear()
.type(displayName);
cy.get(this.newAttributeEnabledWhen).first().check();
cy.get(this.newAttributeCheckboxes).check({ force: true });
cy.get(this.newAttributeRequiredFor).first().check({ force: true });
cy.get(this.newAttributeRequiredWhen).first().check();
cy.get(this.newAttributeEmptyValidators).contains("No validators.");
cy.findByTestId(this.newAttributeAnnotationBtn).click();
cy.findByTestId(this.newAttributeAnnotationKey).type("test");
cy.findByTestId(this.newAttributeAnnotationValue).type("123");
cy.get(this.#newAttributeEnabledWhen).first().check();
cy.get(this.#newAttributeCheckboxes).check({ force: true });
cy.get(this.#newAttributeRequiredFor).first().check({ force: true });
cy.get(this.#newAttributeRequiredWhen).first().check();
cy.get(this.#newAttributeEmptyValidators).contains("No validators.");
cy.findByTestId(this.#newAttributeAnnotationBtn).click();
cy.findByTestId(this.#newAttributeAnnotationKey).type("test");
cy.findByTestId(this.#newAttributeAnnotationValue).type("123");
return this;
}
addValidator() {
cy.findByTestId(this.addValidatorBtn).click();
Select.selectItem(cy.get(this.validatorRolesList), "email");
cy.findByTestId(this.saveValidatorBtn).click();
cy.findByTestId(this.#addValidatorBtn).click();
Select.selectItem(cy.get(this.#validatorRolesList), "email");
cy.findByTestId(this.#saveValidatorBtn).click();
return this;
}
removeValidator() {
cy.findByTestId(this.removeValidatorBtn).click();
cy.findByTestId(this.deleteValidatorBtn).click();
cy.findByTestId(this.#removeValidatorBtn).click();
cy.findByTestId(this.#deleteValidatorBtn).click();
return this;
}
cancelAddingValidator() {
cy.findByTestId(this.addValidatorBtn).click();
Select.selectItem(cy.get(this.validatorRolesList), "email");
cy.findByTestId(this.cancelAddingValidatorBtn).click();
cy.findByTestId(this.#addValidatorBtn).click();
Select.selectItem(cy.get(this.#validatorRolesList), "email");
cy.findByTestId(this.#cancelAddingValidatorBtn).click();
return this;
}
cancelRemovingValidator() {
cy.findByTestId(this.removeValidatorBtn).click();
cy.findByTestId(this.cancelRemovingValidatorBtn).click();
cy.findByTestId(this.#removeValidatorBtn).click();
cy.findByTestId(this.#cancelRemovingValidatorBtn).click();
return this;
}
private textArea() {
#textArea() {
return cy.get(".pf-c-code-editor__code textarea");
}
private getText() {
return this.textArea().get(".view-lines");
#getText() {
return this.#textArea().get(".view-lines");
}
typeJSON(text: string) {
this.textArea().type(text, { force: true });
this.#textArea().type(text, { force: true });
return this;
}
shouldHaveText(text: string) {
this.getText().should("have.text", text);
this.#getText().should("have.text", text);
return this;
}

View file

@ -1,33 +1,33 @@
export default class UserRegistration {
private userRegistrationTab = "rs-userRegistration-tab";
private defaultGroupTab = "#pf-tab-20-groups";
private addRoleBtn = "assignRole";
private addDefaultGroupBtn = "no-default-groups-empty-action";
private namesColumn = 'tbody td[data-label="Name"]:visible';
private addBtn = "assign";
#userRegistrationTab = "rs-userRegistration-tab";
#defaultGroupTab = "#pf-tab-20-groups";
#addRoleBtn = "assignRole";
#addDefaultGroupBtn = "no-default-groups-empty-action";
#namesColumn = 'tbody td[data-label="Name"]:visible';
#addBtn = "assign";
goToTab() {
cy.findByTestId(this.userRegistrationTab).click({ force: true });
cy.findByTestId(this.#userRegistrationTab).click({ force: true });
return this;
}
goToDefaultGroupTab() {
cy.get(this.defaultGroupTab).click();
cy.get(this.#defaultGroupTab).click();
return this;
}
addRole() {
cy.findByTestId(this.addRoleBtn).click({ force: true });
cy.findByTestId(this.#addRoleBtn).click({ force: true });
return this;
}
addDefaultGroup() {
cy.findByTestId(this.addDefaultGroupBtn).click();
cy.findByTestId(this.#addDefaultGroupBtn).click();
return this;
}
selectRow(name: string) {
cy.get(this.namesColumn)
cy.get(this.#namesColumn)
.contains(name)
.parent()
.within(() => {
@ -37,14 +37,14 @@ export default class UserRegistration {
}
assign() {
cy.findByTestId(this.addBtn).click();
cy.findByTestId(this.#addBtn).click();
return this;
}
}
export class GroupPickerDialog {
private addButton = "add-button";
private title = ".pf-c-modal-box__title";
#addButton = "add-button";
#title = ".pf-c-modal-box__title";
clickRow(groupName: string) {
cy.findByTestId(groupName).within(() => cy.get("input").click());
@ -57,12 +57,12 @@ export class GroupPickerDialog {
}
checkTitle(title: string) {
cy.get(this.title).should("have.text", title);
cy.get(this.#title).should("have.text", title);
return this;
}
clickAdd() {
cy.findByTestId(this.addButton).click();
cy.findByTestId(this.#addButton).click();
return this;
}
}

View file

@ -10,22 +10,22 @@ enum RealmSettingsEventsSubTab {
}
export default class RealmSettingsEventsTab extends CommonPage {
private eventListenersTab = new EventListenersTab();
private userEventsSettingsTab = new UserEventsSettingsTab();
private adminEventsSettingsTab = new AdminEventsSettingsTab();
#eventListenersTab = new EventListenersTab();
#userEventsSettingsTab = new UserEventsSettingsTab();
#adminEventsSettingsTab = new AdminEventsSettingsTab();
goToEventListenersSubTab() {
this.tabUtils().clickTab(RealmSettingsEventsSubTab.EventListeners, 1);
return this.eventListenersTab;
return this.#eventListenersTab;
}
goToUserEventsSettingsSubTab() {
this.tabUtils().clickTab(RealmSettingsEventsSubTab.UserEventsSettings, 1);
return this.userEventsSettingsTab;
return this.#userEventsSettingsTab;
}
goToAdminEventsSettingsSubTab() {
this.tabUtils().clickTab(RealmSettingsEventsSubTab.AdminEventsSettings, 1);
return this.adminEventsSettingsTab;
return this.#adminEventsSettingsTab;
}
}

View file

@ -6,12 +6,12 @@ const masthead = new Masthead();
const modal = new ModalUtils();
export default class AdminEventsSettingsTab extends PageObject {
private saveEventsSwitch = "#adminEventsEnabled-switch";
private clearAdminEventsBtn = "#clear-admin-events";
private saveBtn = "#save-admin";
#saveEventsSwitch = "#adminEventsEnabled-switch";
#clearAdminEventsBtn = "#clear-admin-events";
#saveBtn = "#save-admin";
clearAdminEvents() {
cy.get(this.clearAdminEventsBtn).click();
cy.get(this.#clearAdminEventsBtn).click();
modal.checkModalTitle("Clear events");
cy.intercept("/admin/realms/*/admin-events").as("clearEvents");
modal.confirmModal();
@ -21,18 +21,18 @@ export default class AdminEventsSettingsTab extends PageObject {
}
disableSaveEvents() {
super.assertSwitchStateOn(cy.get(this.saveEventsSwitch));
cy.get(this.saveEventsSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.#saveEventsSwitch));
cy.get(this.#saveEventsSwitch).parent().click();
modal.checkModalTitle("Unsave events?");
modal.confirmModal();
super.assertSwitchStateOff(cy.get(this.saveEventsSwitch));
super.assertSwitchStateOff(cy.get(this.#saveEventsSwitch));
return this;
}
enableSaveEvents() {
super.assertSwitchStateOff(cy.get(this.saveEventsSwitch));
cy.get(this.saveEventsSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.saveEventsSwitch));
super.assertSwitchStateOff(cy.get(this.#saveEventsSwitch));
cy.get(this.#saveEventsSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.#saveEventsSwitch));
return this;
}
@ -46,7 +46,7 @@ export default class AdminEventsSettingsTab extends PageObject {
waitForConfig &&
cy.intercept("/admin/realms/*/events/config").as("saveConfig");
cy.get(this.saveBtn).click();
cy.get(this.#saveBtn).click();
waitForRealm && cy.wait("@saveRealm");
waitForConfig && cy.wait("@saveConfig");

View file

@ -6,12 +6,12 @@ const masthead = new Masthead();
const modal = new ModalUtils();
export default class UserEventsSettingsTab extends PageObject {
private saveEventsSwitch = "#eventsEnabled-switch";
private clearUserEventsBtn = "#clear-user-events";
private saveBtn = "#save-user";
#saveEventsSwitch = "#eventsEnabled-switch";
#clearUserEventsBtn = "#clear-user-events";
#saveBtn = "#save-user";
clearUserEvents() {
cy.get(this.clearUserEventsBtn).click();
cy.get(this.#clearUserEventsBtn).click();
modal.checkModalTitle("Clear events");
modal.confirmModal();
masthead.checkNotificationMessage("The user events have been cleared");
@ -19,23 +19,23 @@ export default class UserEventsSettingsTab extends PageObject {
}
disableSaveEventsSwitch() {
cy.get(this.saveEventsSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.saveEventsSwitch));
cy.get(this.#saveEventsSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.#saveEventsSwitch));
this.waitForPageLoad();
modal.checkModalTitle("Unsave events?");
modal.confirmModal();
super.assertSwitchStateOff(cy.get(this.saveEventsSwitch));
super.assertSwitchStateOff(cy.get(this.#saveEventsSwitch));
return this;
}
enableSaveEventsSwitch() {
cy.get(this.saveEventsSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.saveEventsSwitch));
cy.get(this.#saveEventsSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.#saveEventsSwitch));
return this;
}
save() {
cy.get(this.saveBtn).click();
cy.get(this.#saveBtn).click();
return this;
}
}

View file

@ -1,82 +1,82 @@
export default class CredentialsPage {
private readonly credentialsTab = "credentials";
private readonly emptyStatePasswordBtn = "no-credentials-empty-action";
private readonly emptyStateResetBtn = "credential-reset-empty-action";
private readonly resetBtn = "credentialResetBtn";
private readonly setPasswordBtn = "confirm";
private readonly credentialResetModal = "credential-reset-modal";
private readonly resetModalActionsToggleBtn =
readonly #credentialsTab = "credentials";
readonly #emptyStatePasswordBtn = "no-credentials-empty-action";
readonly #emptyStateResetBtn = "credential-reset-empty-action";
readonly #resetBtn = "credentialResetBtn";
readonly #setPasswordBtn = "confirm";
readonly #credentialResetModal = "credential-reset-modal";
readonly #resetModalActionsToggleBtn =
"[data-testid=credential-reset-modal] #actions-actions";
private readonly passwordField = "passwordField";
private readonly passwordConfirmationField = "passwordConfirmationField";
private readonly resetActions = [
readonly #passwordField = "passwordField";
readonly #passwordConfirmationField = "passwordConfirmationField";
readonly #resetActions = [
"VERIFY_EMAIL-option",
"UPDATE_PROFILE-option",
"CONFIGURE_TOTP-option",
"UPDATE_PASSWORD-option",
"TERMS_AND_CONDITIONS-option",
];
private readonly confirmationButton = "confirm";
private readonly editLabelBtn = "editUserLabelBtn";
private readonly labelField = "userLabelFld";
private readonly editConfirmationBtn = "editUserLabelAcceptBtn";
private readonly showDataDialogBtn = "showDataBtn";
private readonly closeDataDialogBtn = '.pf-c-modal-box [aria-label^="Close"]';
readonly #confirmationButton = "confirm";
readonly #editLabelBtn = "editUserLabelBtn";
readonly #labelField = "userLabelFld";
readonly #editConfirmationBtn = "editUserLabelAcceptBtn";
readonly #showDataDialogBtn = "showDataBtn";
readonly #closeDataDialogBtn = '.pf-c-modal-box [aria-label^="Close"]';
goToCredentialsTab() {
cy.intercept("/admin/realms/*/users/*/credentials").as("load");
cy.findByTestId(this.credentialsTab).click();
cy.findByTestId(this.#credentialsTab).click();
cy.wait("@load");
cy.wait(200);
return this;
}
clickEmptyStatePasswordBtn() {
cy.findByTestId(this.emptyStatePasswordBtn).click();
cy.findByTestId(this.#emptyStatePasswordBtn).click();
return this;
}
clickEmptyStateResetBtn() {
cy.findByTestId(this.emptyStateResetBtn).click();
cy.findByTestId(this.#emptyStateResetBtn).click();
return this;
}
clickResetBtn() {
cy.findByTestId(this.resetBtn).click();
cy.findByTestId(this.#resetBtn).click();
return this;
}
clickResetModalActionsToggleBtn() {
cy.get(this.resetModalActionsToggleBtn).click();
cy.get(this.#resetModalActionsToggleBtn).click();
return this;
}
clickResetModalAction(index: number) {
cy.findByTestId(this.resetActions[index]).click();
cy.findByTestId(this.#resetActions[index]).click();
return this;
}
clickConfirmationBtn() {
cy.findByTestId(this.confirmationButton).click();
cy.findByTestId(this.#confirmationButton).click();
return this;
}
fillPasswordForm() {
cy.findByTestId(this.passwordField).type("test");
cy.findByTestId(this.passwordConfirmationField).type("test");
cy.findByTestId(this.#passwordField).type("test");
cy.findByTestId(this.#passwordConfirmationField).type("test");
return this;
}
fillResetCredentialForm() {
cy.findByTestId(this.credentialResetModal);
cy.findByTestId(this.#credentialResetModal);
this.clickResetModalActionsToggleBtn()
.clickResetModalAction(2)
.clickResetModalAction(3)
@ -86,13 +86,13 @@ export default class CredentialsPage {
}
clickSetPasswordBtn() {
cy.findByTestId(this.setPasswordBtn).click();
cy.findByTestId(this.#setPasswordBtn).click();
return this;
}
clickEditCredentialLabelBtn() {
cy.findByTestId(this.editLabelBtn)
cy.findByTestId(this.#editLabelBtn)
.should("be.visible")
.click({ force: true });
@ -100,25 +100,25 @@ export default class CredentialsPage {
}
fillEditCredentialForm() {
cy.findByTestId(this.labelField).focus().type("test");
cy.findByTestId(this.#labelField).focus().type("test");
return this;
}
clickEditConfirmationBtn() {
cy.findByTestId(this.editConfirmationBtn).click();
cy.findByTestId(this.#editConfirmationBtn).click();
return this;
}
clickShowDataDialogBtn() {
cy.findByTestId(this.showDataDialogBtn).click();
cy.findByTestId(this.#showDataDialogBtn).click();
return this;
}
clickCloseDataDialogBtn() {
cy.get(this.closeDataDialogBtn).click({ force: true });
cy.get(this.#closeDataDialogBtn).click({ force: true });
return this;
}

View file

@ -4,17 +4,17 @@ import ListingPage from "../../ListingPage";
const listingPage = new ListingPage();
export default class UsersPage extends PageObject {
private userListTabLink = "listTab";
private permissionsTabLink = "permissionsTab";
#userListTabLink = "listTab";
#permissionsTabLink = "permissionsTab";
public goToUserListTab() {
cy.findByTestId(this.userListTabLink).click();
cy.findByTestId(this.#userListTabLink).click();
return this;
}
public goToPermissionsTab() {
cy.findByTestId(this.permissionsTabLink).click();
cy.findByTestId(this.#permissionsTabLink).click();
return this;
}

View file

@ -5,42 +5,42 @@ const modalUtils = new ModalUtils();
const masthead = new Masthead();
export default class IdentityProviderLinksTab {
private linkedProvidersSection = ".kc-linked-idps";
private availableProvidersSection = ".kc-available-idps";
private linkAccountBtn = ".pf-c-button.pf-m-link";
private linkAccountModalIdentityProviderInput = "idpNameInput";
private linkAccountModalUserIdInput = "userIdInput";
private linkAccountModalUsernameInput = "usernameInput";
#linkedProvidersSection = ".kc-linked-idps";
#availableProvidersSection = ".kc-available-idps";
#linkAccountBtn = ".pf-c-button.pf-m-link";
#linkAccountModalIdentityProviderInput = "idpNameInput";
#linkAccountModalUserIdInput = "userIdInput";
#linkAccountModalUsernameInput = "usernameInput";
public clickLinkAccount(idpName: string) {
cy.get(this.availableProvidersSection + " tr")
cy.get(this.#availableProvidersSection + " tr")
.contains(idpName)
.parent()
.find(this.linkAccountBtn)
.find(this.#linkAccountBtn)
.click();
return this;
}
public clickUnlinkAccount(idpName: string) {
cy.get(this.linkedProvidersSection + " tr")
cy.get(this.#linkedProvidersSection + " tr")
.contains(idpName)
.parent()
.parent()
.find(this.linkAccountBtn)
.find(this.#linkAccountBtn)
.click();
return this;
}
public typeLinkAccountModalUserId(userId: string) {
cy.findByTestId(this.linkAccountModalUserIdInput).type(userId);
cy.findByTestId(this.#linkAccountModalUserIdInput).type(userId);
return this;
}
public typeLinkAccountModalUsername(username: string) {
cy.findByTestId(this.linkAccountModalUsernameInput).type(username);
cy.findByTestId(this.#linkAccountModalUsernameInput).type(username);
return this;
}
@ -58,7 +58,7 @@ export default class IdentityProviderLinksTab {
}
public assertNoIdentityProvidersLinkedMessageExist(exist: boolean) {
cy.get(this.linkedProvidersSection).should(
cy.get(this.#linkedProvidersSection).should(
(exist ? "" : "not.") + "contain.text",
"No identity providers linked. Choose one from the list below.",
);
@ -67,7 +67,7 @@ export default class IdentityProviderLinksTab {
}
public assertNoAvailableIdentityProvidersMessageExist(exist: boolean) {
cy.get(this.availableProvidersSection).should(
cy.get(this.#availableProvidersSection).should(
(exist ? "" : "not.") + "contain.text",
"No available identity providers.",
);
@ -88,7 +88,7 @@ export default class IdentityProviderLinksTab {
}
public assertLinkAccountModalIdentityProviderInputEqual(idpName: string) {
cy.findByTestId(this.linkAccountModalIdentityProviderInput).should(
cy.findByTestId(this.#linkAccountModalIdentityProviderInput).should(
"have.value",
idpName,
);
@ -118,11 +118,11 @@ export default class IdentityProviderLinksTab {
public assertLinkedIdentityProvidersItemsEqual(count: number) {
if (count > 0) {
cy.get(this.linkedProvidersSection + " tbody")
cy.get(this.#linkedProvidersSection + " tbody")
.find("tr")
.should("have.length", count);
} else {
cy.get(this.linkedProvidersSection + " tbody").should("not.exist");
cy.get(this.#linkedProvidersSection + " tbody").should("not.exist");
}
return this;
@ -130,17 +130,17 @@ export default class IdentityProviderLinksTab {
public assertAvailableIdentityProvidersItemsEqual(count: number) {
if (count > 0) {
cy.get(this.availableProvidersSection + " tbody")
cy.get(this.#availableProvidersSection + " tbody")
.find("tr")
.should("have.length", count);
} else {
cy.get(this.availableProvidersSection + " tbody").should("not.exist");
cy.get(this.#availableProvidersSection + " tbody").should("not.exist");
}
return this;
}
public assertLinkedIdentityProviderExist(idpName: string, exist: boolean) {
cy.get(this.linkedProvidersSection).should(
cy.get(this.#linkedProvidersSection).should(
(exist ? "" : "not.") + "contain.text",
idpName,
);
@ -149,7 +149,7 @@ export default class IdentityProviderLinksTab {
}
public assertAvailableIdentityProviderExist(idpName: string, exist: boolean) {
cy.get(this.availableProvidersSection).should(
cy.get(this.#availableProvidersSection).should(
(exist ? "" : "not.") + "contain.text",
idpName,
);

View file

@ -9,13 +9,13 @@ import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/us
import { merge } from "lodash-es";
class AdminClient {
private readonly client = new KeycloakAdminClient({
readonly #client = new KeycloakAdminClient({
baseUrl: Cypress.env("KEYCLOAK_SERVER"),
realmName: "master",
});
private login() {
return this.client.auth({
#login() {
return this.#client.auth({
username: "admin",
password: "admin",
grantType: "password",
@ -24,7 +24,7 @@ class AdminClient {
}
async loginUser(username: string, password: string, clientId: string) {
return this.client.auth({
return this.#client.auth({
username: username,
password: password,
grantType: "password",
@ -33,55 +33,55 @@ class AdminClient {
}
async createRealm(realm: string, payload?: RealmRepresentation) {
await this.login();
await this.client.realms.create({ realm, ...payload });
await this.#login();
await this.#client.realms.create({ realm, ...payload });
}
async updateRealm(realm: string, payload: RealmRepresentation) {
await this.login();
await this.client.realms.update({ realm }, payload);
await this.#login();
await this.#client.realms.update({ realm }, payload);
}
async getRealm(realm: string) {
await this.login();
return await this.client.realms.findOne({ realm });
await this.#login();
return await this.#client.realms.findOne({ realm });
}
async deleteRealm(realm: string) {
await this.login();
await this.client.realms.del({ realm });
await this.#login();
await this.#client.realms.del({ realm });
}
async createClient(client: ClientRepresentation) {
await this.login();
await this.client.clients.create(client);
await this.#login();
await this.#client.clients.create(client);
}
async deleteClient(clientName: string) {
await this.login();
await this.#login();
const client = (
await this.client.clients.find({ clientId: clientName })
await this.#client.clients.find({ clientId: clientName })
)[0];
if (client) {
await this.client.clients.del({ id: client.id! });
await this.#client.clients.del({ id: client.id! });
}
}
async createGroup(groupName: string) {
await this.login();
return await this.client.groups.create({ name: groupName });
await this.#login();
return await this.#client.groups.create({ name: groupName });
}
async createSubGroups(groups: string[]) {
await this.login();
await this.#login();
let parentGroup = undefined;
const createdGroups = [];
for (const group of groups) {
if (!parentGroup) {
parentGroup = await this.client.groups.create({ name: group });
parentGroup = await this.#client.groups.create({ name: group });
} else {
parentGroup = await this.client.groups.createChildGroup(
parentGroup = await this.#client.groups.createChildGroup(
{ id: parentGroup.id },
{ name: group },
);
@ -92,18 +92,18 @@ class AdminClient {
}
async deleteGroups() {
await this.login();
const groups = await this.client.groups.find();
await this.#login();
const groups = await this.#client.groups.find();
for (const group of groups) {
await this.client.groups.del({ id: group.id! });
await this.#client.groups.del({ id: group.id! });
}
}
async createUser(user: UserRepresentation) {
await this.login();
await this.#login();
const { id } = await this.client.users.create(user);
const createdUser = await this.client.users.findOne({ id });
const { id } = await this.#client.users.create(user);
const createdUser = await this.#client.users.findOne({ id });
if (!createdUser) {
throw new Error(
@ -115,60 +115,62 @@ class AdminClient {
}
async updateUser(id: string, payload: UserRepresentation) {
await this.login();
return this.client.users.update({ id }, payload);
await this.#login();
return this.#client.users.update({ id }, payload);
}
async getAdminUser() {
await this.login();
const [user] = await this.client.users.find({ username: "admin" });
await this.#login();
const [user] = await this.#client.users.find({ username: "admin" });
return user;
}
async addUserToGroup(userId: string, groupId: string) {
await this.login();
await this.client.users.addToGroup({ id: userId, groupId });
await this.#login();
await this.#client.users.addToGroup({ id: userId, groupId });
}
async createUserInGroup(username: string, groupId: string) {
await this.login();
await this.#login();
const user = await this.createUser({ username, enabled: true });
await this.client.users.addToGroup({ id: user.id!, groupId });
await this.#client.users.addToGroup({ id: user.id!, groupId });
}
async addRealmRoleToUser(userId: string, roleName: string) {
await this.login();
await this.#login();
const realmRole = await this.client.roles.findOneByName({ name: roleName });
const realmRole = await this.#client.roles.findOneByName({
name: roleName,
});
await this.client.users.addRealmRoleMappings({
await this.#client.users.addRealmRoleMappings({
id: userId,
roles: [realmRole as RoleMappingPayload],
});
}
async deleteUser(username: string) {
await this.login();
const user = await this.client.users.find({ username });
await this.client.users.del({ id: user[0].id! });
await this.#login();
const user = await this.#client.users.find({ username });
await this.#client.users.del({ id: user[0].id! });
}
async createClientScope(scope: ClientScopeRepresentation) {
await this.login();
return await this.client.clientScopes.create(scope);
await this.#login();
return await this.#client.clientScopes.create(scope);
}
async deleteClientScope(clientScopeName: string) {
await this.login();
const clientScope = await this.client.clientScopes.findOneByName({
await this.#login();
const clientScope = await this.#client.clientScopes.findOneByName({
name: clientScopeName,
});
return await this.client.clientScopes.del({ id: clientScope?.id! });
return await this.#client.clientScopes.del({ id: clientScope?.id! });
}
async existsClientScope(clientScopeName: string) {
await this.login();
return (await this.client.clientScopes.findOneByName({
await this.#login();
return (await this.#client.clientScopes.findOneByName({
name: clientScopeName,
})) == undefined
? false
@ -179,12 +181,12 @@ class AdminClient {
clientScopeName: string,
clientId: string,
) {
await this.login();
const scope = await this.client.clientScopes.findOneByName({
await this.#login();
const scope = await this.#client.clientScopes.findOneByName({
name: clientScopeName,
});
const client = await this.client.clients.find({ clientId: clientId });
return await this.client.clients.addDefaultClientScope({
const client = await this.#client.clients.find({ clientId: clientId });
return await this.#client.clients.addDefaultClientScope({
id: client[0]?.id!,
clientScopeId: scope?.id!,
});
@ -194,44 +196,44 @@ class AdminClient {
clientScopeName: string,
clientId: string,
) {
await this.login();
const scope = await this.client.clientScopes.findOneByName({
await this.#login();
const scope = await this.#client.clientScopes.findOneByName({
name: clientScopeName,
});
const client = await this.client.clients.find({ clientId: clientId });
return await this.client.clients.delDefaultClientScope({
const client = await this.#client.clients.find({ clientId: clientId });
return await this.#client.clients.delDefaultClientScope({
id: client[0]?.id!,
clientScopeId: scope?.id!,
});
}
async patchUserProfile(realm: string, payload: UserProfileConfig) {
await this.login();
await this.#login();
const currentProfile = await this.client.users.getProfile({ realm });
const currentProfile = await this.#client.users.getProfile({ realm });
await this.client.users.updateProfile(
await this.#client.users.updateProfile(
merge(currentProfile, payload, { realm }),
);
}
async createRealmRole(payload: RoleRepresentation) {
await this.login();
await this.#login();
return await this.client.roles.create(payload);
return await this.#client.roles.create(payload);
}
async deleteRealmRole(name: string) {
await this.login();
return await this.client.roles.delByName({ name });
await this.#login();
return await this.#client.roles.delByName({ name });
}
async createIdentityProvider(idpDisplayName: string, alias: string) {
await this.login();
await this.#login();
const identityProviders =
(await this.client.serverInfo.find()).identityProviders || [];
(await this.#client.serverInfo.find()).identityProviders || [];
const idp = identityProviders.find(({ name }) => name === idpDisplayName);
await this.client.identityProviders.create({
await this.#client.identityProviders.create({
providerId: idp?.id!,
displayName: idpDisplayName,
alias: alias,
@ -239,8 +241,8 @@ class AdminClient {
}
async deleteIdentityProvider(idpAlias: string) {
await this.login();
await this.client.identityProviders.del({
await this.#login();
await this.#client.identityProviders.del({
alias: idpAlias,
});
}
@ -249,29 +251,29 @@ class AdminClient {
username: string,
idpDisplayName: string,
) {
await this.login();
const user = await this.client.users.find({ username });
await this.#login();
const user = await this.#client.users.find({ username });
const identityProviders =
(await this.client.serverInfo.find()).identityProviders || [];
(await this.#client.serverInfo.find()).identityProviders || [];
const idp = identityProviders.find(({ name }) => name === idpDisplayName);
await this.client.users.delFromFederatedIdentity({
await this.#client.users.delFromFederatedIdentity({
id: user[0].id!,
federatedIdentityId: idp?.id!,
});
}
async linkAccountIdentityProvider(username: string, idpDisplayName: string) {
await this.login();
const user = await this.client.users.find({ username });
await this.#login();
const user = await this.#client.users.find({ username });
const identityProviders =
(await this.client.serverInfo.find()).identityProviders || [];
(await this.#client.serverInfo.find()).identityProviders || [];
const idp = identityProviders.find(({ name }) => name === idpDisplayName);
const fedIdentity = {
identityProvider: idp?.id,
userId: "testUserIdApi",
userName: "testUserNameApi",
};
await this.client.users.addToFederatedIdentity({
await this.#client.users.addToFederatedIdentity({
id: user[0].id!,
federatedIdentityId: idp?.id!,
federatedIdentity: fedIdentity,
@ -279,22 +281,22 @@ class AdminClient {
}
async addLocalizationText(locale: string, key: string, value: string) {
await this.login();
await this.client.realms.addLocalization(
{ realm: this.client.realmName, selectedLocale: locale, key: key },
await this.#login();
await this.#client.realms.addLocalization(
{ realm: this.#client.realmName, selectedLocale: locale, key: key },
value,
);
}
async removeAllLocalizationTexts() {
await this.login();
const localesWithTexts = await this.client.realms.getRealmSpecificLocales({
realm: this.client.realmName,
await this.#login();
const localesWithTexts = await this.#client.realms.getRealmSpecificLocales({
realm: this.#client.realmName,
});
await Promise.all(
localesWithTexts.map((locale) =>
this.client.realms.deleteRealmLocalizationTexts({
realm: this.client.realmName,
this.#client.realms.deleteRealmLocalizationTexts({
realm: this.#client.realmName,
selectedLocale: locale,
}),
),

View file

@ -2,67 +2,66 @@ import PageObject from "../pages/admin-ui/components/PageObject";
import TablePage from "../pages/admin-ui/components/TablePage";
export default class ModalUtils extends PageObject {
private modalDiv = ".pf-c-modal-box";
private modalTitle = ".pf-c-modal-box .pf-c-modal-box__title-text";
private modalMessage = ".pf-c-modal-box .pf-c-modal-box__body";
private confirmModalBtn = "confirm";
private cancelModalBtn = "cancel";
private closeModalBtn = ".pf-c-modal-box .pf-m-plain";
private copyToClipboardBtn = '[id*="copy-button"]';
private addModalDropdownBtn = "#add-dropdown > button";
private addModalDropdownItem = "#add-dropdown [role='menuitem']";
private primaryBtn = ".pf-c-button.pf-m-primary";
private addBtn = "add";
private tablePage = new TablePage(TablePage.tableSelector);
#modalDiv = ".pf-c-modal-box";
#modalTitle = ".pf-c-modal-box .pf-c-modal-box__title-text";
#modalMessage = ".pf-c-modal-box .pf-c-modal-box__body";
#confirmModalBtn = "confirm";
#cancelModalBtn = "cancel";
#closeModalBtn = ".pf-c-modal-box .pf-m-plain";
#copyToClipboardBtn = '[id*="copy-button"]';
#addModalDropdownBtn = "#add-dropdown > button";
#addModalDropdownItem = "#add-dropdown [role='menuitem']";
#addBtn = "add";
#tablePage = new TablePage(TablePage.tableSelector);
table() {
return this.tablePage;
return this.#tablePage;
}
add() {
cy.findByTestId(this.addBtn).click();
cy.findByTestId(this.#addBtn).click();
return this;
}
confirmModal() {
cy.findByTestId(this.confirmModalBtn).click({ force: true });
cy.findByTestId(this.#confirmModalBtn).click({ force: true });
return this;
}
checkConfirmButtonText(text: string) {
cy.findByTestId(this.confirmModalBtn).contains(text);
cy.findByTestId(this.#confirmModalBtn).contains(text);
return this;
}
confirmModalWithItem(itemName: string) {
cy.get(this.addModalDropdownBtn).click();
cy.get(this.addModalDropdownItem).contains(itemName).click();
cy.get(this.#addModalDropdownBtn).click();
cy.get(this.#addModalDropdownItem).contains(itemName).click();
return this;
}
cancelModal() {
cy.findByTestId(this.cancelModalBtn).click({ force: true });
cy.findByTestId(this.#cancelModalBtn).click({ force: true });
return this;
}
cancelButtonContains(text: string) {
cy.findByTestId(this.cancelModalBtn).contains(text);
cy.findByTestId(this.#cancelModalBtn).contains(text);
return this;
}
copyToClipboard() {
cy.get(this.copyToClipboardBtn).click();
cy.get(this.#copyToClipboardBtn).click();
return this;
}
closeModal() {
cy.get(this.closeModalBtn).click({ force: true });
cy.get(this.#closeModalBtn).click({ force: true });
return this;
}
@ -74,35 +73,35 @@ export default class ModalUtils extends PageObject {
}
checkModalMessage(message: string) {
cy.get(this.modalMessage).invoke("text").should("eq", message);
cy.get(this.#modalMessage).invoke("text").should("eq", message);
return this;
}
assertModalMessageContainText(text: string) {
cy.get(this.modalMessage).should("contain.text", text);
cy.get(this.#modalMessage).should("contain.text", text);
return this;
}
assertModalHasElement(elementSelector: string, exist: boolean) {
cy.get(this.modalDiv)
cy.get(this.#modalDiv)
.find(elementSelector)
.should((exist ? "" : ".not") + "exist");
return this;
}
assertModalVisible(isVisible: boolean) {
super.assertIsVisible(cy.get(this.modalDiv), isVisible);
super.assertIsVisible(cy.get(this.#modalDiv), isVisible);
return this;
}
assertModalExist(exist: boolean) {
super.assertExist(cy.get(this.modalDiv), exist);
super.assertExist(cy.get(this.#modalDiv), exist);
return this;
}
assertModalTitleEqual(text: string) {
cy.get(this.modalTitle).invoke("text").should("eq", text);
cy.get(this.#modalTitle).invoke("text").should("eq", text);
return this;
}
}

View file

@ -29,44 +29,44 @@ export class LevelChange extends IndexChange {
}
export class ExecutionList {
private list: ExpandableExecution[];
#list: ExpandableExecution[];
expandableList: ExpandableExecution[];
constructor(list: AuthenticationExecutionInfoRepresentation[]) {
this.list = list as ExpandableExecution[];
this.#list = list as ExpandableExecution[];
const exList = {
executionList: [],
isCollapsed: false,
};
this.transformToExpandableList(0, -1, exList);
this.#transformToExpandableList(0, -1, exList);
this.expandableList = exList.executionList;
}
private transformToExpandableList(
#transformToExpandableList(
currentIndex: number,
currentLevel: number,
execution: ExpandableExecution,
) {
for (let index = currentIndex; index < this.list.length; index++) {
const ex = this.list[index];
for (let index = currentIndex; index < this.#list.length; index++) {
const ex = this.#list[index];
const level = ex.level || 0;
if (level <= currentLevel) {
return index - 1;
}
const nextRowLevel = this.list[index + 1]?.level || 0;
const nextRowLevel = this.#list[index + 1]?.level || 0;
const hasChild = level < nextRowLevel;
if (hasChild) {
const subLevel = { ...ex, executionList: [], isCollapsed: false };
index = this.transformToExpandableList(index + 1, level, subLevel);
index = this.#transformToExpandableList(index + 1, level, subLevel);
execution.executionList?.push(subLevel);
} else {
execution.executionList?.push(ex);
}
}
return this.list.length;
return this.#list.length;
}
order(list?: ExpandableExecution[]) {
@ -98,12 +98,12 @@ export class ExecutionList {
return found;
}
private getParentNodes(level?: number) {
for (let index = 0; index < this.list.length; index++) {
const ex = this.list[index];
#getParentNodes(level?: number) {
for (let index = 0; index < this.#list.length; index++) {
const ex = this.#list[index];
if (
index + 1 < this.list.length &&
this.list[index + 1].level! > ex.level! &&
index + 1 < this.#list.length &&
this.#list[index + 1].level! > ex.level! &&
ex.level! + 1 === level
) {
return ex;
@ -123,7 +123,7 @@ export class ExecutionList {
if (newLocation.level !== oldLocation.level) {
if (newLocation.level! > 0) {
const parent = this.getParentNodes(newLocation.level);
const parent = this.#getParentNodes(newLocation.level);
return new LevelChange(
parent?.executionList?.length || 0,
newLocation.index!,
@ -138,7 +138,7 @@ export class ExecutionList {
clone() {
const newList = new ExecutionList([]);
newList.list = this.list;
newList.#list = this.#list;
newList.expandableList = this.expandableList;
return newList;
}

View file

@ -10,46 +10,49 @@ import { useFetch } from "../../utils/useFetch";
import { useRealm } from "../realm-context/RealmContext";
export class WhoAmI {
constructor(private me?: WhoAmIRepresentation) {
if (this.me?.locale) {
i18n.changeLanguage(this.me.locale, (error) => {
#me?: WhoAmIRepresentation;
constructor(me?: WhoAmIRepresentation) {
this.#me = me;
if (this.#me?.locale) {
i18n.changeLanguage(this.#me.locale, (error) => {
if (error) {
console.warn("Error(s) loading locale", this.me?.locale, error);
console.warn("Error(s) loading locale", this.#me?.locale, error);
}
});
}
}
public getDisplayName(): string {
if (this.me === undefined) return "";
if (this.#me === undefined) return "";
return this.me.displayName;
return this.#me.displayName;
}
public getLocale() {
return this.me?.locale ?? DEFAULT_LOCALE;
return this.#me?.locale ?? DEFAULT_LOCALE;
}
public getRealm() {
return this.me?.realm ?? "";
return this.#me?.realm ?? "";
}
public getUserId(): string {
if (this.me === undefined) return "";
if (this.#me === undefined) return "";
return this.me.userId;
return this.#me.userId;
}
public canCreateRealm(): boolean {
return !!this.me?.createRealm;
return !!this.#me?.createRealm;
}
public getRealmAccess(): Readonly<{
[key: string]: ReadonlyArray<AccessType>;
}> {
if (this.me === undefined) return {};
if (this.#me === undefined) return {};
return this.me.realm_access;
return this.#me.realm_access;
}
}

View file

@ -52,15 +52,15 @@ export class KeycloakAdminClient {
public accessToken?: string;
public refreshToken?: string;
private requestOptions?: RequestInit;
private globalRequestArgOptions?: Pick<RequestArgs, "catchNotFound">;
private tokenProvider?: TokenProvider;
#requestOptions?: RequestInit;
#globalRequestArgOptions?: Pick<RequestArgs, "catchNotFound">;
#tokenProvider?: TokenProvider;
constructor(connectionConfig?: ConnectionConfig) {
this.baseUrl = connectionConfig?.baseUrl || defaultBaseUrl;
this.realmName = connectionConfig?.realmName || defaultRealm;
this.requestOptions = connectionConfig?.requestOptions;
this.globalRequestArgOptions = connectionConfig?.requestArgOptions;
this.#requestOptions = connectionConfig?.requestOptions;
this.#globalRequestArgOptions = connectionConfig?.requestArgOptions;
// Initialize resources
this.users = new Users(this);
@ -85,18 +85,18 @@ export class KeycloakAdminClient {
baseUrl: this.baseUrl,
realmName: this.realmName,
credentials,
requestOptions: this.requestOptions,
requestOptions: this.#requestOptions,
});
this.accessToken = accessToken;
this.refreshToken = refreshToken;
}
public registerTokenProvider(provider: TokenProvider) {
if (this.tokenProvider) {
if (this.#tokenProvider) {
throw new Error("An existing token provider was already registered.");
}
this.tokenProvider = provider;
this.#tokenProvider = provider;
}
public setAccessToken(token: string) {
@ -104,21 +104,21 @@ export class KeycloakAdminClient {
}
public async getAccessToken() {
if (this.tokenProvider) {
return this.tokenProvider.getAccessToken();
if (this.#tokenProvider) {
return this.#tokenProvider.getAccessToken();
}
return this.accessToken;
}
public getRequestOptions() {
return this.requestOptions;
return this.#requestOptions;
}
public getGlobalRequestArgOptions():
| Pick<RequestArgs, "catchNotFound">
| undefined {
return this.globalRequestArgOptions;
return this.#globalRequestArgOptions;
}
public setConfig(connectionConfig: ConnectionConfig) {
@ -135,6 +135,6 @@ export class KeycloakAdminClient {
) {
this.realmName = connectionConfig.realmName;
}
this.requestOptions = connectionConfig.requestOptions;
this.#requestOptions = connectionConfig.requestOptions;
}
}

View file

@ -41,10 +41,10 @@ export interface RequestArgs {
}
export class Agent {
private client: KeycloakAdminClient;
private basePath: string;
private getBaseParams?: () => Record<string, any>;
private getBaseUrl?: () => string;
#client: KeycloakAdminClient;
#basePath: string;
#getBaseParams?: () => Record<string, any>;
#getBaseUrl?: () => string;
constructor({
client,
@ -57,10 +57,10 @@ export class Agent {
getUrlParams?: () => Record<string, any>;
getBaseUrl?: () => string;
}) {
this.client = client;
this.getBaseParams = getUrlParams;
this.getBaseUrl = getBaseUrl;
this.basePath = path;
this.#client = client;
this.#getBaseParams = getUrlParams;
this.#getBaseUrl = getBaseUrl;
this.#basePath = path;
}
public request({
@ -79,7 +79,7 @@ export class Agent {
payload: any = {},
options?: Pick<RequestArgs, "catchNotFound">,
) => {
const baseParams = this.getBaseParams?.() ?? {};
const baseParams = this.#getBaseParams?.() ?? {};
// Filter query parameters by queryParamKeys
const queryParams =
@ -102,11 +102,11 @@ export class Agent {
// Transform keys of both payload and queryParams
if (keyTransform) {
this.transformKey(payload, keyTransform);
this.transformKey(queryParams, keyTransform);
this.#transformKey(payload, keyTransform);
this.#transformKey(queryParams, keyTransform);
}
return this.requestWithParams({
return this.#requestWithParams({
method,
path,
payload,
@ -114,7 +114,7 @@ export class Agent {
queryParams,
// catchNotFound precedence: global > local > default
catchNotFound,
...(this.client.getGlobalRequestArgOptions() ?? options ?? {}),
...(this.#client.getGlobalRequestArgOptions() ?? options ?? {}),
payloadKey,
returnResourceIdInLocationHeader,
headers,
@ -134,7 +134,7 @@ export class Agent {
headers,
}: RequestArgs) {
return async (query: any = {}, payload: any = {}) => {
const baseParams = this.getBaseParams?.() ?? {};
const baseParams = this.#getBaseParams?.() ?? {};
// Filter query parameters by queryParamKeys
const queryParams = queryParamKeys
@ -150,10 +150,10 @@ export class Agent {
// Transform keys of queryParams
if (keyTransform) {
this.transformKey(queryParams, keyTransform);
this.#transformKey(queryParams, keyTransform);
}
return this.requestWithParams({
return this.#requestWithParams({
method,
path,
payload,
@ -167,7 +167,7 @@ export class Agent {
};
}
private async requestWithParams({
async #requestWithParams({
method,
path,
payload,
@ -188,16 +188,16 @@ export class Agent {
returnResourceIdInLocationHeader?: { field: string };
headers?: HeadersInit;
}) {
const newPath = urlJoin(this.basePath, path);
const newPath = urlJoin(this.#basePath, path);
// Parse template and replace with values from urlParams
const pathTemplate = parseTemplate(newPath);
const parsedPath = pathTemplate.expand(urlParams);
const url = new URL(`${this.getBaseUrl?.() ?? ""}${parsedPath}`);
const requestOptions = { ...this.client.getRequestOptions() };
const url = new URL(`${this.#getBaseUrl?.() ?? ""}${parsedPath}`);
const requestOptions = { ...this.#client.getRequestOptions() };
const requestHeaders = new Headers([
...new Headers(requestOptions.headers).entries(),
["authorization", `Bearer ${await this.client.getAccessToken()}`],
["authorization", `Bearer ${await this.#client.getAccessToken()}`],
["accept", "application/json, text/plain, */*"],
...new Headers(headers).entries(),
]);
@ -285,7 +285,7 @@ export class Agent {
}
}
private transformKey(payload: any, keyMapping: Record<string, string>) {
#transformKey(payload: any, keyMapping: Record<string, string>) {
if (!payload) {
return;
}

View file

@ -2,7 +2,7 @@ import type { KeycloakAdminClient } from "../client.js";
import { Agent, RequestArgs } from "./agent.js";
export default class Resource<ParamType = {}> {
private agent: Agent;
#agent: Agent;
constructor(
client: KeycloakAdminClient,
settings: {
@ -11,7 +11,7 @@ export default class Resource<ParamType = {}> {
getBaseUrl?: () => string;
} = {},
) {
this.agent = new Agent({
this.#agent = new Agent({
client,
...settings,
});
@ -23,7 +23,7 @@ export default class Resource<ParamType = {}> {
payload?: PayloadType & ParamType,
options?: Pick<RequestArgs, "catchNotFound">,
) => Promise<ResponseType>) => {
return this.agent.request(args);
return this.#agent.request(args);
};
// update request will take three types: query, payload and response
@ -37,6 +37,6 @@ export default class Resource<ParamType = {}> {
query: QueryType & ParamType,
payload: PayloadType,
) => Promise<ResponseType>) => {
return this.agent.updateRequest(args);
return this.#agent.updateRequest(args);
};
}