diff --git a/src/main/java/framework/ui/locators/simplOpen/Authority.java b/src/main/java/framework/ui/locators/simplOpen/Authority.java index 483343ed1be2979fb54039c8913bcb7cbdb7217b..cd40957483655e39ae71ef9edf708a9fa719c515 100644 --- a/src/main/java/framework/ui/locators/simplOpen/Authority.java +++ b/src/main/java/framework/ui/locators/simplOpen/Authority.java @@ -96,6 +96,14 @@ public class Authority { public static final String IDENTITY_ATTRIBUTE_CREATION_CANCEL_BUTTON_LOCATOR = "//span[text()=' Cancel']"; public static final String IDENTITY_ATTRIBUTE_LIST_ASSIGNABLE_TO_ROLE_COLUMN_LOCATOR = ".cdk-column-assignableToRoles [data-testid='text-element']"; public static final String IDENTITY_ATTRIBUTE_LIST_IN_USE_COLUMN_LOCATOR = ".cdk-column-used [data-testid='text-element']"; + public static final String IDENTITY_ATTRIBUTE_LIST_IDENTIFIER_HEADER_LOCATOR = "//div[contains(text(),'Identifier')]"; + public static final String IDENTITY_ATTRIBUTE_LIST_CODE_HEADER_LOCATOR = "//div[contains(text(),'Code')]"; + public static final String IDENTITY_ATTRIBUTE_LIST_ASSIGNABLE_TO_ROLE_HEADER_LOCATOR = "//div[contains(text(),'Assignable to Role')]"; + public static final String IDENTITY_ATTRIBUTE_LIST_ENABLED_HEADER_LOCATOR = "//div[contains(text(),'Enabled')]"; + public static final String IDENTITY_ATTRIBUTE_LIST_IN_USE_HEADER_LOCATOR = "//div[contains(text(),'In use')]"; + public static final String IDENTITY_ATTRIBUTE_LIST_CREATION_DATE_HEADER_LOCATOR = "//div[contains(text(),'Creation date')]"; + public static final String IDENTITY_ATTRIBUTE_LIST_LAST_CHANGE_DATE_HEADER_LOCATOR = "//div[contains(text(),'Last change date')]"; + public static final String IDENTITY_ATTRIBUTE_LIST_ACTIONS_HEADER_LOCATOR = "//div[contains(text(),'Actions')]"; public static final String EMPTY_LIST_MESSAGE_LOCATOR = "div.p-5.text-center"; public static final String LIST_IDENTITY_ATTRIBUTE_ID_LOCATOR = "//td[@class='mat-mdc-cell mdc-data-table__cell cdk-cell cdk-column-id mat-column-id ng-star-inserted']"; public static final String IDENTITY_ATTRIBUTE_EDIT_BUTTON_LOCATOR = "//span[normalize-space()='Edit Attribute']"; @@ -108,6 +116,7 @@ public class Authority { public static final String COLUMN_HEADING_LOCATOR = "thead th div.mat-sort-header-content"; public static final String PARTICIPANT_LIST_LOCATOR = "td.mat-mdc-cell.mdc-data-table__cell.cdk-cell.cdk-column-organization.mat-column-organization.ng-star-inserted"; public static final String REQUEST_STATUS_LOCATOR = "#statusFieldBadge"; + public static final String IDENTITY_ATTRIBUTES_LIST_LOCATOR = "//td[contains(@class, 'mat-mdc-cell mdc-data-table__cell cdk-cell cdk-column-id mat-column-id ng-star-inserted')]/span[@data-testid='text-element']"; public Authority() { diff --git a/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java b/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java index fa292e3e403fc12b5dd39c415955e35249ffd2d5..4e94294c046a6ccc359c5aa3ace3ade3c657a7ba 100644 --- a/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java +++ b/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java @@ -277,17 +277,12 @@ public class AuthorityPage { * @param numberValueByPage Number of items expected. */ public void verifyNumberOfResultsDisplayedInTheList(String listType, Integer numberValueByPage) { - Locator locatorValue; - switch (listType) { - case "Dashboard Requests List": - locatorValue = page.locator(REQUEST_STATUS_COLUMN_FROM_REQUEST_LIST_TABLE_LOCATOR); - break; - case "Participant List": - locatorValue = page.locator(PARTICIPANT_LIST_LOCATOR); - break; - default: - throw new IllegalArgumentException("Unknown list type: " + listType); - } + Locator locatorValue = switch (listType) { + case "Dashboard Requests List" -> page.locator(REQUEST_STATUS_COLUMN_FROM_REQUEST_LIST_TABLE_LOCATOR); + case "Participant List" -> page.locator(PARTICIPANT_LIST_LOCATOR); + case "Identity Attributes List" -> page.locator(IDENTITY_ATTRIBUTES_LIST_LOCATOR); + default -> throw new IllegalArgumentException("Unknown list type: " + listType); + }; Utils.verifyTableListDisplayTheResultsExpected(numberValueByPage, locatorValue); } @@ -361,8 +356,8 @@ public class AuthorityPage { * Clicks the next or previous page button and/or verifies that the table is updated correctly. * * @param buttonToPress The button to be pressed ("Next page" or "Previous page"). - * @param compareLists Whether to compare the lists before and after pagination. - * @param listToReview The list in which the review is performed. + * @param compareLists Whether to compare the lists before and after pagination. + * @param listToReview The list in which the review is performed. */ public void clickNextOrPreviousPageButton(String buttonToPress, String listToReview, boolean compareLists) { Locator buttonLocator = switch (buttonToPress) { @@ -376,6 +371,7 @@ public class AuthorityPage { String columnLocator = switch (listToReview) { case "request list" -> REQUEST_EMAIL_COLUMN_FORM_REQUEST_LIST_TABLE_LOCATOR; case "participant list" -> PARTICIPANT_LIST_PARTICIPANT_NAME_COLUMN_LOCATOR; + case "identity attributes list" -> IDENTITY_ATTRIBUTES_LIST_LOCATOR; default -> throw new IllegalArgumentException("Invalid list provided value: " + listToReview); }; page.waitForSelector(columnLocator); @@ -404,7 +400,7 @@ public class AuthorityPage { } /*** - * This method checks that the approve or reject button is visible and then proceeds with the action + * This method checks that the approval or reject button is visible and then proceeds with the action * of approving or rejecting the request. * If the request was successfully approved, it is checked that the "APPROVED" status is visible * If the request was successfully rejected, it is first necessary to fill out the text message, diff --git a/src/test/java/features/ui/simplOpen/Authority.feature b/src/test/java/features/ui/simplOpen/Authority.feature index 07af6ede94e861e7d5500572c8c16e9a1c51b6db..b95763b8bac141b7aa46509b157affea6a22c604 100644 --- a/src/test/java/features/ui/simplOpen/Authority.feature +++ b/src/test/java/features/ui/simplOpen/Authority.feature @@ -268,7 +268,7 @@ Feature: Authority | Assignable Identity Attribute | Assignable Test Identity Attribute | assignable_test_identity_attribute | true | | Non-Assignable Identity Attribute | Non-Assignable Test Identity Attribute | non_assignable_test_identity_attribute | false | - @TCA19 @SIMPL-3466 @SIMPL-3139 @SIMPL-3140 @SIMPL-4127 @SIMPL-3468 @SIMPL-3469 + @TCA19 @SIMPL-3466 @SIMPL-3139 @SIMPL-3140 @SIMPL-4127 @SIMPL-3468 @SIMPL-3469 @SIMPL-3464 @SIMPL-3470 @SIMPL-3495 Scenario: Successful Update of an Identity Attribute Given the user navigates to the "Identity Attributes" page And the user logs in with a user with "IATTR_M" role @@ -445,4 +445,30 @@ Feature: Authority | ascending | Participant Type | | descending | Participant Type | | ascending | Onboarding Date | - | descending | Onboarding Date | \ No newline at end of file + | descending | Onboarding Date | + + @TCA30 @SIMPL-4291 + Scenario Outline: Display Paginated List of Identity Attributes and with Correct Column Headings : <caseName> + Given the user navigates to the "Identity Attributes" page + When the user logs in with a user with "IATTR_M" role + Then the page displays a table with the following column headings: + | Identifier | + | Code | + | Assignable to Role | + | Enabled | + | In use | + | Creation date | + | Last change date | + | Actions | + And the list of Identity Attributes is displayed + When the user selects <numberValueByPage> items per page from the dropdown list + And the "Identity Attributes List" is updated with a maximum of <numberValueByPage> results + Then the user updates the identity attributes list by trying to click the "Next page" button + And the user updates the identity attributes list by trying to click the "Previous page" button + + Examples: + | caseName | numberValueByPage | + | The user selects 5 elements by page | 5 | + | The user selects 10 elements by page | 10 | + | The user selects 25 elements by page | 25 | + | The user selects 100 elements by page | 100 | \ No newline at end of file diff --git a/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java b/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java index 2d38bfbe04c60e2a2ec3cd2daeb227506eb98638..69ab5f01760db04259db2c9f5168ae4f1dde9d42 100644 --- a/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java +++ b/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java @@ -660,6 +660,7 @@ public class AuthoritySteps { public void the_successful_message_is_displayed() { assertElementIsVisibleByLocator(page.locator(SUCCESSFUL_MESSAGE_LOCATOR)); } + @Then("the error message is displayed") public void the_error_message_is_displayed() { assertElementIsVisibleByLocator(page.getByText(ALERT_ERROR_CREATING_CREDENTIAL_LOCATOR)); @@ -708,7 +709,7 @@ public class AuthoritySteps { assertThat(page.getByText(button)).isEnabled(); } - @Then("^the user updates the (request list|participant list) by trying to click the \"(Next page|Previous page)\" button$") + @Then("^the user updates the (request list|participant list|identity attributes list) by trying to click the \"(Next page|Previous page)\" button$") public void theUserUpdatesTheRequestListTryingToClickTheButton(String list, String button) { authorityPage.clickNextOrPreviousPageButton(button, list, true); } @@ -759,4 +760,16 @@ public class AuthoritySteps { assertTrue(String.format("Invalid boolean value found"), "true".equals(value) || "false".equals(value)); } } + + @Then("the list of Identity Attributes is displayed") + public void theListOfIdentityAttributesIsDisplayed() { + assertElementIsVisibleByLocator(page.locator(IDENTITY_ATTRIBUTE_LIST_IDENTIFIER_HEADER_LOCATOR)); + assertElementIsVisibleByLocator(page.locator(IDENTITY_ATTRIBUTE_LIST_CODE_HEADER_LOCATOR)); + assertElementIsVisibleByLocator(page.locator(IDENTITY_ATTRIBUTE_LIST_ASSIGNABLE_TO_ROLE_HEADER_LOCATOR)); + assertElementIsVisibleByLocator(page.locator(IDENTITY_ATTRIBUTE_LIST_ENABLED_HEADER_LOCATOR)); + assertElementIsVisibleByLocator(page.locator(IDENTITY_ATTRIBUTE_LIST_IN_USE_HEADER_LOCATOR)); + assertElementIsVisibleByLocator(page.locator(IDENTITY_ATTRIBUTE_LIST_CREATION_DATE_HEADER_LOCATOR)); + assertElementIsVisibleByLocator(page.locator(IDENTITY_ATTRIBUTE_LIST_LAST_CHANGE_DATE_HEADER_LOCATOR)); + assertElementIsVisibleByLocator(page.locator(IDENTITY_ATTRIBUTE_LIST_ACTIONS_HEADER_LOCATOR)); + } }