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: [ overrides: [
{ {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,14 +1,14 @@
export default class AttributesTab { export default class AttributesTab {
private saveAttributeBtn = "save-attributes"; #saveAttributeBtn = "save-attributes";
private addAttributeBtn = "attributes-add-row"; #addAttributeBtn = "attributes-add-row";
private attributesTab = "attributes"; #attributesTab = "attributes";
private keyInput = "attributes-key"; #keyInput = "attributes-key";
private valueInput = "attributes-value"; #valueInput = "attributes-value";
private removeBtn = "attributes-remove"; #removeBtn = "attributes-remove";
private emptyState = "attributes-empty-state"; #emptyState = "attributes-empty-state";
public goToAttributesTab() { public goToAttributesTab() {
cy.findByTestId(this.attributesTab).click(); cy.findByTestId(this.#attributesTab).click();
return this; return this;
} }
@ -16,18 +16,18 @@ export default class AttributesTab {
public addAttribute(key: string, value: string) { public addAttribute(key: string, value: string) {
this.addAnAttributeButton(); this.addAnAttributeButton();
cy.findAllByTestId(this.keyInput) cy.findAllByTestId(this.#keyInput)
.its("length") .its("length")
.then((length) => { .then((length) => {
this.keyInputAt(length - 1).type(key, { force: true }); this.#keyInputAt(length - 1).type(key, { force: true });
this.valueInputAt(length - 1).type(value, { force: true }); this.#valueInputAt(length - 1).type(value, { force: true });
}); });
return this; return this;
} }
public save() { public save() {
cy.findByTestId(this.saveAttributeBtn).click(); cy.findByTestId(this.#saveAttributeBtn).click();
return this; return this;
} }
@ -37,13 +37,13 @@ export default class AttributesTab {
} }
public deleteAttributeButton(row: number) { public deleteAttributeButton(row: number) {
this.removeButtonAt(row).click({ force: true }); this.#removeButtonAt(row).click({ force: true });
return this; return this;
} }
public addAnAttributeButton() { public addAnAttributeButton() {
cy.wait(1000); cy.wait(1000);
cy.findByTestId(this.addAttributeBtn).click(); cy.findByTestId(this.#addAttributeBtn).click();
return this; return this;
} }
@ -55,23 +55,23 @@ export default class AttributesTab {
} }
public assertEmpty() { public assertEmpty() {
cy.findByTestId(this.emptyState).should("exist"); cy.findByTestId(this.#emptyState).should("exist");
} }
public assertRowItemsEqualTo(amount: number) { 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; return this;
} }
private keyInputAt(index: number) { #keyInputAt(index: number) {
return cy.findAllByTestId(this.keyInput).eq(index); return cy.findAllByTestId(this.#keyInput).eq(index);
} }
private valueInputAt(index: number) { #valueInputAt(index: number) {
return cy.findAllByTestId(this.valueInput).eq(index); return cy.findAllByTestId(this.#valueInput).eq(index);
} }
private removeButtonAt(index: number) { #removeButtonAt(index: number) {
return cy.findAllByTestId(this.removeBtn).eq(index); 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"; import type { KeyValueType } from "../../../../../src/components/key-value-form/key-value-convert";
export default class KeyValueInput { export default class KeyValueInput {
private name: string; #name: string;
constructor(name: string) { constructor(name: string) {
this.name = name; this.#name = name;
} }
fillKeyValue({ key, value }: KeyValueType) { 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") .its("length")
.then((length) => { .then((length) => {
this.keyInputAt(length - 1).type(key); this.keyInputAt(length - 1).type(key);
@ -21,12 +21,12 @@ export default class KeyValueInput {
} }
deleteRow(index: number) { deleteRow(index: number) {
cy.findAllByTestId(`${this.name}-remove`).eq(index).click(); cy.findAllByTestId(`${this.#name}-remove`).eq(index).click();
return this; return this;
} }
validateRows(numberOfRows: number) { validateRows(numberOfRows: number) {
cy.findAllByTestId(`${this.name}-key`).should("have.length", numberOfRows); cy.findAllByTestId(`${this.#name}-key`).should("have.length", numberOfRows);
return this; return this;
} }
@ -36,10 +36,10 @@ export default class KeyValueInput {
} }
keyInputAt(index: number) { keyInputAt(index: number) {
return cy.findAllByTestId(`${this.name}-key`).eq(index); return cy.findAllByTestId(`${this.#name}-key`).eq(index);
} }
valueInputAt(index: number) { 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"; import type { KeyValueType } from "../../../../../src/components/key-value-form/key-value-convert";
export default class LegacyKeyValueInput { export default class LegacyKeyValueInput {
private name: string; #name: string;
constructor(name: string) { constructor(name: string) {
this.name = name; this.#name = name;
} }
fillKeyValue({ key, value }: KeyValueType, index = 0) { fillKeyValue({ key, value }: KeyValueType, index = 0) {
cy.findByTestId(`${this.name}.${index}.key`).clear(); cy.findByTestId(`${this.#name}.${index}.key`).clear();
cy.findByTestId(`${this.name}.${index}.key`).type(key); cy.findByTestId(`${this.#name}.${index}.key`).type(key);
cy.findByTestId(`${this.name}.${index}.value`).clear(); cy.findByTestId(`${this.#name}.${index}.value`).clear();
cy.findByTestId(`${this.name}.${index}.value`).type(value); cy.findByTestId(`${this.#name}.${index}.value`).type(value);
cy.findByTestId(`${this.name}-add-row`).click(); cy.findByTestId(`${this.#name}-add-row`).click();
return this; return this;
} }
deleteRow(index: number) { deleteRow(index: number) {
cy.findByTestId(`${this.name}.${index}.remove`).click(); cy.findByTestId(`${this.#name}.${index}.remove`).click();
return this; return this;
} }

View file

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

View file

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

View file

@ -1,21 +1,22 @@
export default class DuplicateFlowModal { export default class DuplicateFlowModal {
private nameInput = "name"; #nameInput = "name";
private descriptionInput = "description"; #descriptionInput = "description";
private confirmButton = "confirm"; #confirmButton = "confirm";
private errorText = ".pf-m-error"; #errorText = ".pf-m-error";
fill(name?: string, description?: string) { fill(name?: string, description?: string) {
cy.findByTestId(this.nameInput).clear(); cy.findByTestId(this.#nameInput).clear();
if (name) { if (name) {
cy.findByTestId(this.nameInput).type(name); cy.findByTestId(this.#nameInput).type(name);
if (description) cy.findByTestId(this.descriptionInput).type(description); if (description)
cy.findByTestId(this.#descriptionInput).type(description);
} }
cy.findByTestId(this.confirmButton).click(); cy.findByTestId(this.#confirmButton).click();
return this; return this;
} }
shouldShowError(message: string) { 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 { export default class FlowDetails {
executionExists(name: string, exist = true) { executionExists(name: string, exist = true) {
this.getExecution(name).should((!exist ? "not." : "") + "exist"); this.#getExecution(name).should((!exist ? "not." : "") + "exist");
return this; return this;
} }
@ -11,7 +11,7 @@ export default class FlowDetails {
return this; return this;
} }
private getExecution(name: string) { #getExecution(name: string) {
return cy.findByTestId(name); return cy.findByTestId(name);
} }
@ -34,7 +34,7 @@ export default class FlowDetails {
} }
changeRequirement(execution: string, requirement: RequirementType) { changeRequirement(execution: string, requirement: RequirementType) {
this.getExecution(execution) this.#getExecution(execution)
.parentsUntil(".keycloak__authentication__flow-row") .parentsUntil(".keycloak__authentication__flow-row")
.find(".keycloak__authentication__requirement-dropdown") .find(".keycloak__authentication__requirement-dropdown")
.click() .click()
@ -48,7 +48,7 @@ export default class FlowDetails {
return this; return this;
} }
private clickEditDropdownForFlow(subFlowName: string, option: string) { #clickEditDropdownForFlow(subFlowName: string, option: string) {
cy.findByTestId(`${subFlowName}-edit-dropdown`) cy.findByTestId(`${subFlowName}-edit-dropdown`)
.click() .click()
.contains(option) .contains(option)
@ -56,7 +56,7 @@ export default class FlowDetails {
} }
addExecution(subFlowName: string, executionTestId: string) { addExecution(subFlowName: string, executionTestId: string) {
this.clickEditDropdownForFlow(subFlowName, "Add step"); this.#clickEditDropdownForFlow(subFlowName, "Add step");
cy.get(".pf-c-pagination").should("exist"); cy.get(".pf-c-pagination").should("exist");
cy.findByTestId(executionTestId).click(); cy.findByTestId(executionTestId).click();
@ -66,7 +66,7 @@ export default class FlowDetails {
} }
addCondition(subFlowName: string, executionTestId: string) { addCondition(subFlowName: string, executionTestId: string) {
this.clickEditDropdownForFlow(subFlowName, "Add condition"); this.#clickEditDropdownForFlow(subFlowName, "Add condition");
cy.findByTestId(executionTestId).click(); cy.findByTestId(executionTestId).click();
cy.findByTestId("modal-add").click(); cy.findByTestId("modal-add").click();
@ -75,8 +75,8 @@ export default class FlowDetails {
} }
addSubFlow(subFlowName: string, name: string) { addSubFlow(subFlowName: string, name: string) {
this.clickEditDropdownForFlow(subFlowName, "Add sub-flow"); this.#clickEditDropdownForFlow(subFlowName, "Add sub-flow");
this.fillSubFlowModal(subFlowName, name); this.#fillSubFlowModal(subFlowName, name);
return this; return this;
} }
@ -87,7 +87,7 @@ export default class FlowDetails {
return this; return this;
} }
private fillSubFlowModal(subFlowName: string, name: string) { #fillSubFlowModal(subFlowName: string, name: string) {
cy.get(".pf-c-modal-box__title-text").contains( cy.get(".pf-c-modal-box__title-text").contains(
"Add step to " + subFlowName, "Add step to " + subFlowName,
); );
@ -109,7 +109,7 @@ export default class FlowDetails {
addSubFlowToEmpty(subFlowName: string, name: string) { addSubFlowToEmpty(subFlowName: string, name: string) {
cy.findByTestId("addSubFlow").click(); cy.findByTestId("addSubFlow").click();
this.fillSubFlowModal(subFlowName, name); this.#fillSubFlowModal(subFlowName, name);
return this; return this;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -22,46 +22,46 @@ export enum ClientsDetailsTab {
} }
export default class ClientDetailsPage extends CommonPage { export default class ClientDetailsPage extends CommonPage {
private settingsTab = new SettingsTab(); #settingsTab = new SettingsTab();
private keysTab = new KeysTab(); #keysTab = new KeysTab();
private credentialsTab = new CredentialsTab(); #credentialsTab = new CredentialsTab();
private rolesTab = new RolesTab(); #rolesTab = new RolesTab();
private clientScopesTab = new ClientScopesTab(); #clientScopesTab = new ClientScopesTab();
private authorizationTab = new AuthorizationTab(); #authorizationTab = new AuthorizationTab();
private advancedTab = new AdvancedTab(); #advancedTab = new AdvancedTab();
goToSettingsTab() { goToSettingsTab() {
this.tabUtils().clickTab(ClientsDetailsTab.Settings); this.tabUtils().clickTab(ClientsDetailsTab.Settings);
return this.settingsTab; return this.#settingsTab;
} }
goToKeysTab() { goToKeysTab() {
this.tabUtils().clickTab(ClientsDetailsTab.Keys); this.tabUtils().clickTab(ClientsDetailsTab.Keys);
return this.keysTab; return this.#keysTab;
} }
goToCredentials() { goToCredentials() {
this.tabUtils().clickTab(ClientsDetailsTab.Credentials); this.tabUtils().clickTab(ClientsDetailsTab.Credentials);
return this.credentialsTab; return this.#credentialsTab;
} }
goToRolesTab() { goToRolesTab() {
this.tabUtils().clickTab(ClientsDetailsTab.Roles); this.tabUtils().clickTab(ClientsDetailsTab.Roles);
return this.rolesTab; return this.#rolesTab;
} }
goToClientScopesTab() { goToClientScopesTab() {
this.tabUtils().clickTab(ClientsDetailsTab.ClientScopes); this.tabUtils().clickTab(ClientsDetailsTab.ClientScopes);
return this.clientScopesTab; return this.#clientScopesTab;
} }
goToAuthorizationTab() { goToAuthorizationTab() {
this.tabUtils().clickTab(ClientsDetailsTab.Authorization); this.tabUtils().clickTab(ClientsDetailsTab.Authorization);
return this.authorizationTab; return this.#authorizationTab;
} }
goToAdvancedTab() { goToAdvancedTab() {
this.tabUtils().clickTab(ClientsDetailsTab.Advanced); 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 { export default class DedicatedScopesMappersTab extends CommonPage {
private addPredefinedMapperEmptyStateBtn = #addPredefinedMapperEmptyStateBtn = "add-predefined-mapper-empty-action";
"add-predefined-mapper-empty-action"; #configureNewMapperEmptyStateBtn = "configure-a-new-mapper-empty-action";
private configureNewMapperEmptyStateBtn =
"configure-a-new-mapper-empty-action";
addMapperFromPredefinedMappers() { addMapperFromPredefinedMappers() {
this.emptyState().checkIfExists(false); this.emptyState().checkIfExists(false);
@ -29,13 +27,13 @@ export default class DedicatedScopesMappersTab extends CommonPage {
addPredefinedMapper() { addPredefinedMapper() {
this.emptyState().checkIfExists(true); this.emptyState().checkIfExists(true);
cy.findByTestId(this.addPredefinedMapperEmptyStateBtn).click(); cy.findByTestId(this.#addPredefinedMapperEmptyStateBtn).click();
return this; return this;
} }
configureNewMapper() { configureNewMapper() {
this.emptyState().checkIfExists(true); this.emptyState().checkIfExists(true);
cy.findByTestId(this.configureNewMapperEmptyStateBtn).click({ cy.findByTestId(this.#configureNewMapperEmptyStateBtn).click({
force: true, force: true,
}); });
return this; return this;

View file

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

View file

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

View file

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

View file

@ -18,46 +18,46 @@ enum AuthorizationSubTab {
} }
export default class AuthorizationTab extends CommonPage { export default class AuthorizationTab extends CommonPage {
private settingsSubTab = new SettingsTab(); #settingsSubTab = new SettingsTab();
private resourcesSubTab = new ResourcesTab(); #resourcesSubTab = new ResourcesTab();
private scopesSubTab = new ScopesTab(); #scopesSubTab = new ScopesTab();
private policiesSubTab = new PoliciesTab(); #policiesSubTab = new PoliciesTab();
private permissionsSubTab = new PermissionsTab(); #permissionsSubTab = new PermissionsTab();
private evaluateSubTab = new EvaluateTab(); #evaluateSubTab = new EvaluateTab();
private exportSubTab = new ExportTab(); #exportSubTab = new ExportTab();
goToSettingsSubTab() { goToSettingsSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Settings, 1); this.tabUtils().clickTab(AuthorizationSubTab.Settings, 1);
return this.settingsSubTab; return this.#settingsSubTab;
} }
goToResourcesSubTab() { goToResourcesSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Resources, 1); this.tabUtils().clickTab(AuthorizationSubTab.Resources, 1);
return this.resourcesSubTab; return this.#resourcesSubTab;
} }
goToScopesSubTab() { goToScopesSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Scopes, 1); this.tabUtils().clickTab(AuthorizationSubTab.Scopes, 1);
return this.scopesSubTab; return this.#scopesSubTab;
} }
goToPoliciesSubTab() { goToPoliciesSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Policies, 1); this.tabUtils().clickTab(AuthorizationSubTab.Policies, 1);
return this.policiesSubTab; return this.#policiesSubTab;
} }
goToPermissionsSubTab() { goToPermissionsSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Permissions, 1); this.tabUtils().clickTab(AuthorizationSubTab.Permissions, 1);
return this.permissionsSubTab; return this.#permissionsSubTab;
} }
goToEvaluateSubTab() { goToEvaluateSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Evaluate, 1); this.tabUtils().clickTab(AuthorizationSubTab.Evaluate, 1);
return this.evaluateSubTab; return this.#evaluateSubTab;
} }
goToExportSubTab() { goToExportSubTab() {
this.tabUtils().clickTab(AuthorizationSubTab.Export, 1); 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 { export default class ClientScopesTab extends CommonPage {
private setupSubTab = new SetupTab(); #setupSubTab = new SetupTab();
private evaluateSubTab = new EvaluateTab(); #evaluateSubTab = new EvaluateTab();
private dedicatedScopesPage = new DedicatedScopesPage(); #dedicatedScopesPage = new DedicatedScopesPage();
goToSetupSubTab() { goToSetupSubTab() {
this.tabUtils().clickTab(ClientScopesSubTab.Setup); this.tabUtils().clickTab(ClientScopesSubTab.Setup);
return this.setupSubTab; return this.#setupSubTab;
} }
goToEvaluateSubTab() { goToEvaluateSubTab() {
this.tabUtils().clickTab(ClientScopesSubTab.Evaluate); this.tabUtils().clickTab(ClientScopesSubTab.Evaluate);
return this.evaluateSubTab; return this.#evaluateSubTab;
} }
clickDedicatedScope(clientId: string) { clickDedicatedScope(clientId: string) {
cy.intercept("/admin/realms/master/clients/*").as("get"); cy.intercept("/admin/realms/master/clients/*").as("get");
cy.findByText(`${clientId}-dedicated`).click(); cy.findByText(`${clientId}-dedicated`).click();
cy.wait("@get"); cy.wait("@get");
return this.dedicatedScopesPage; return this.#dedicatedScopesPage;
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,12 +2,12 @@ import CommonPage from "../../../../../../CommonPage";
import CreateResourcePage from "../../CreateResourcePage"; import CreateResourcePage from "../../CreateResourcePage";
export default class ResourcesTab extends CommonPage { export default class ResourcesTab extends CommonPage {
private createResourcePage = new CreateResourcePage(); #createResourcePage = new CreateResourcePage();
private createResourceBtn = "createResource"; #createResourceBtn = "createResource";
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"; import CreateAuthorizationScopePage from "../../CreateAuthorizationScopePage";
export default class ScopesTab extends CommonPage { export default class ScopesTab extends CommonPage {
private createAuthorizationScopePage = new CreateAuthorizationScopePage(); #createAuthorizationScopePage = new CreateAuthorizationScopePage();
private createScopeBtn = "no-authorization-scopes-empty-action"; #createScopeBtn = "no-authorization-scopes-empty-action";
createAuthorizationScope() { createAuthorizationScope() {
cy.findByTestId(this.createScopeBtn).click(); cy.findByTestId(this.#createScopeBtn).click();
return this.createAuthorizationScopePage; return this.#createAuthorizationScopePage;
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,16 +4,16 @@ const additionalUsersProfile_input_test_value =
"additionalUsersProfile_input_test_value"; "additionalUsersProfile_input_test_value";
export default class ProviderFacebookGeneralSettings extends ProviderBaseGeneralSettingsPage { export default class ProviderFacebookGeneralSettings extends ProviderBaseGeneralSettingsPage {
private additionalUsersProfileFieldsInput = "fetchedFields"; #additionalUsersProfileFieldsInput = "fetchedFields";
public typeAdditionalUsersProfileFieldsInput(value: string) { public typeAdditionalUsersProfileFieldsInput(value: string) {
cy.findByTestId(this.additionalUsersProfileFieldsInput).type(value); cy.findByTestId(this.#additionalUsersProfileFieldsInput).type(value);
cy.findByTestId(this.additionalUsersProfileFieldsInput).blur(); cy.findByTestId(this.#additionalUsersProfileFieldsInput).blur();
return this; return this;
} }
public assertAdditionalUsersProfileFieldsInputEqual(value: string) { public assertAdditionalUsersProfileFieldsInputEqual(value: string) {
cy.findByTestId(this.additionalUsersProfileFieldsInput).should( cy.findByTestId(this.#additionalUsersProfileFieldsInput).should(
"have.value", "have.value",
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"; const api_url_input_test_value = "api_url_input_test_value";
export default class ProviderGithubGeneralSettings extends ProviderBaseGeneralSettingsPage { export default class ProviderGithubGeneralSettings extends ProviderBaseGeneralSettingsPage {
private baseUrlInput = "baseUrl"; #baseUrlInput = "baseUrl";
private apiUrlInput = "apiUrl"; #apiUrlInput = "apiUrl";
public typeBaseUrlInput(value: string) { public typeBaseUrlInput(value: string) {
cy.findByTestId(this.baseUrlInput).type(value); cy.findByTestId(this.#baseUrlInput).type(value);
cy.findByTestId(this.baseUrlInput).blur(); cy.findByTestId(this.#baseUrlInput).blur();
return this; return this;
} }
public typeApiUrlInput(value: string) { public typeApiUrlInput(value: string) {
cy.findByTestId(this.apiUrlInput).type(value); cy.findByTestId(this.#apiUrlInput).type(value);
cy.findByTestId(this.apiUrlInput).blur(); cy.findByTestId(this.#apiUrlInput).blur();
return this; return this;
} }
public assertBaseUrlInputInputEqual(value: string) { public assertBaseUrlInputInputEqual(value: string) {
cy.findByTestId(this.baseUrlInput).should("have.value", value); cy.findByTestId(this.#baseUrlInput).should("have.value", value);
return this; return this;
} }
public assertApiUrlInputEqual(value: string) { public assertApiUrlInputEqual(value: string) {
cy.findByTestId(this.apiUrlInput).should("have.value", value); cy.findByTestId(this.#apiUrlInput).should("have.value", value);
return this; return this;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,22 +10,22 @@ enum RealmSettingsEventsSubTab {
} }
export default class RealmSettingsEventsTab extends CommonPage { export default class RealmSettingsEventsTab extends CommonPage {
private eventListenersTab = new EventListenersTab(); #eventListenersTab = new EventListenersTab();
private userEventsSettingsTab = new UserEventsSettingsTab(); #userEventsSettingsTab = new UserEventsSettingsTab();
private adminEventsSettingsTab = new AdminEventsSettingsTab(); #adminEventsSettingsTab = new AdminEventsSettingsTab();
goToEventListenersSubTab() { goToEventListenersSubTab() {
this.tabUtils().clickTab(RealmSettingsEventsSubTab.EventListeners, 1); this.tabUtils().clickTab(RealmSettingsEventsSubTab.EventListeners, 1);
return this.eventListenersTab; return this.#eventListenersTab;
} }
goToUserEventsSettingsSubTab() { goToUserEventsSettingsSubTab() {
this.tabUtils().clickTab(RealmSettingsEventsSubTab.UserEventsSettings, 1); this.tabUtils().clickTab(RealmSettingsEventsSubTab.UserEventsSettings, 1);
return this.userEventsSettingsTab; return this.#userEventsSettingsTab;
} }
goToAdminEventsSettingsSubTab() { goToAdminEventsSettingsSubTab() {
this.tabUtils().clickTab(RealmSettingsEventsSubTab.AdminEventsSettings, 1); 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(); const modal = new ModalUtils();
export default class AdminEventsSettingsTab extends PageObject { export default class AdminEventsSettingsTab extends PageObject {
private saveEventsSwitch = "#adminEventsEnabled-switch"; #saveEventsSwitch = "#adminEventsEnabled-switch";
private clearAdminEventsBtn = "#clear-admin-events"; #clearAdminEventsBtn = "#clear-admin-events";
private saveBtn = "#save-admin"; #saveBtn = "#save-admin";
clearAdminEvents() { clearAdminEvents() {
cy.get(this.clearAdminEventsBtn).click(); cy.get(this.#clearAdminEventsBtn).click();
modal.checkModalTitle("Clear events"); modal.checkModalTitle("Clear events");
cy.intercept("/admin/realms/*/admin-events").as("clearEvents"); cy.intercept("/admin/realms/*/admin-events").as("clearEvents");
modal.confirmModal(); modal.confirmModal();
@ -21,18 +21,18 @@ export default class AdminEventsSettingsTab extends PageObject {
} }
disableSaveEvents() { disableSaveEvents() {
super.assertSwitchStateOn(cy.get(this.saveEventsSwitch)); super.assertSwitchStateOn(cy.get(this.#saveEventsSwitch));
cy.get(this.saveEventsSwitch).parent().click(); cy.get(this.#saveEventsSwitch).parent().click();
modal.checkModalTitle("Unsave events?"); modal.checkModalTitle("Unsave events?");
modal.confirmModal(); modal.confirmModal();
super.assertSwitchStateOff(cy.get(this.saveEventsSwitch)); super.assertSwitchStateOff(cy.get(this.#saveEventsSwitch));
return this; return this;
} }
enableSaveEvents() { enableSaveEvents() {
super.assertSwitchStateOff(cy.get(this.saveEventsSwitch)); super.assertSwitchStateOff(cy.get(this.#saveEventsSwitch));
cy.get(this.saveEventsSwitch).parent().click(); cy.get(this.#saveEventsSwitch).parent().click();
super.assertSwitchStateOn(cy.get(this.saveEventsSwitch)); super.assertSwitchStateOn(cy.get(this.#saveEventsSwitch));
return this; return this;
} }
@ -46,7 +46,7 @@ export default class AdminEventsSettingsTab extends PageObject {
waitForConfig && waitForConfig &&
cy.intercept("/admin/realms/*/events/config").as("saveConfig"); cy.intercept("/admin/realms/*/events/config").as("saveConfig");
cy.get(this.saveBtn).click(); cy.get(this.#saveBtn).click();
waitForRealm && cy.wait("@saveRealm"); waitForRealm && cy.wait("@saveRealm");
waitForConfig && cy.wait("@saveConfig"); waitForConfig && cy.wait("@saveConfig");

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,46 +10,49 @@ import { useFetch } from "../../utils/useFetch";
import { useRealm } from "../realm-context/RealmContext"; import { useRealm } from "../realm-context/RealmContext";
export class WhoAmI { export class WhoAmI {
constructor(private me?: WhoAmIRepresentation) { #me?: WhoAmIRepresentation;
if (this.me?.locale) {
i18n.changeLanguage(this.me.locale, (error) => { constructor(me?: WhoAmIRepresentation) {
this.#me = me;
if (this.#me?.locale) {
i18n.changeLanguage(this.#me.locale, (error) => {
if (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 { public getDisplayName(): string {
if (this.me === undefined) return ""; if (this.#me === undefined) return "";
return this.me.displayName; return this.#me.displayName;
} }
public getLocale() { public getLocale() {
return this.me?.locale ?? DEFAULT_LOCALE; return this.#me?.locale ?? DEFAULT_LOCALE;
} }
public getRealm() { public getRealm() {
return this.me?.realm ?? ""; return this.#me?.realm ?? "";
} }
public getUserId(): string { public getUserId(): string {
if (this.me === undefined) return ""; if (this.#me === undefined) return "";
return this.me.userId; return this.#me.userId;
} }
public canCreateRealm(): boolean { public canCreateRealm(): boolean {
return !!this.me?.createRealm; return !!this.#me?.createRealm;
} }
public getRealmAccess(): Readonly<{ public getRealmAccess(): Readonly<{
[key: string]: ReadonlyArray<AccessType>; [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 accessToken?: string;
public refreshToken?: string; public refreshToken?: string;
private requestOptions?: RequestInit; #requestOptions?: RequestInit;
private globalRequestArgOptions?: Pick<RequestArgs, "catchNotFound">; #globalRequestArgOptions?: Pick<RequestArgs, "catchNotFound">;
private tokenProvider?: TokenProvider; #tokenProvider?: TokenProvider;
constructor(connectionConfig?: ConnectionConfig) { constructor(connectionConfig?: ConnectionConfig) {
this.baseUrl = connectionConfig?.baseUrl || defaultBaseUrl; this.baseUrl = connectionConfig?.baseUrl || defaultBaseUrl;
this.realmName = connectionConfig?.realmName || defaultRealm; this.realmName = connectionConfig?.realmName || defaultRealm;
this.requestOptions = connectionConfig?.requestOptions; this.#requestOptions = connectionConfig?.requestOptions;
this.globalRequestArgOptions = connectionConfig?.requestArgOptions; this.#globalRequestArgOptions = connectionConfig?.requestArgOptions;
// Initialize resources // Initialize resources
this.users = new Users(this); this.users = new Users(this);
@ -85,18 +85,18 @@ export class KeycloakAdminClient {
baseUrl: this.baseUrl, baseUrl: this.baseUrl,
realmName: this.realmName, realmName: this.realmName,
credentials, credentials,
requestOptions: this.requestOptions, requestOptions: this.#requestOptions,
}); });
this.accessToken = accessToken; this.accessToken = accessToken;
this.refreshToken = refreshToken; this.refreshToken = refreshToken;
} }
public registerTokenProvider(provider: TokenProvider) { public registerTokenProvider(provider: TokenProvider) {
if (this.tokenProvider) { if (this.#tokenProvider) {
throw new Error("An existing token provider was already registered."); throw new Error("An existing token provider was already registered.");
} }
this.tokenProvider = provider; this.#tokenProvider = provider;
} }
public setAccessToken(token: string) { public setAccessToken(token: string) {
@ -104,21 +104,21 @@ export class KeycloakAdminClient {
} }
public async getAccessToken() { public async getAccessToken() {
if (this.tokenProvider) { if (this.#tokenProvider) {
return this.tokenProvider.getAccessToken(); return this.#tokenProvider.getAccessToken();
} }
return this.accessToken; return this.accessToken;
} }
public getRequestOptions() { public getRequestOptions() {
return this.requestOptions; return this.#requestOptions;
} }
public getGlobalRequestArgOptions(): public getGlobalRequestArgOptions():
| Pick<RequestArgs, "catchNotFound"> | Pick<RequestArgs, "catchNotFound">
| undefined { | undefined {
return this.globalRequestArgOptions; return this.#globalRequestArgOptions;
} }
public setConfig(connectionConfig: ConnectionConfig) { public setConfig(connectionConfig: ConnectionConfig) {
@ -135,6 +135,6 @@ export class KeycloakAdminClient {
) { ) {
this.realmName = connectionConfig.realmName; this.realmName = connectionConfig.realmName;
} }
this.requestOptions = connectionConfig.requestOptions; this.#requestOptions = connectionConfig.requestOptions;
} }
} }

View file

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

View file

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