diff --git a/src/main/java/configuration/ui/data/simplOpen/Authority.java b/src/main/java/configuration/ui/data/simplOpen/Authority.java index 09ec06fb746f324a1e6a35a97cfe218b4ce5ad47..47d1a88169826ab10ab959edb425ba3b57d271b8 100644 --- a/src/main/java/configuration/ui/data/simplOpen/Authority.java +++ b/src/main/java/configuration/ui/data/simplOpen/Authority.java @@ -54,6 +54,7 @@ public class Authority { public static final String ERROR_MESSAGE = "Invalid username or password."; public static final String PARTICIPANT_PAGE_FILTER_SELECT_COLUMN = "Select column"; public static final String PARTICIPANT_PAGE_APPLY_FILTER_BUTTON = "Apply"; + public static final String PARTICIPANT_PAGE_RESET_FILTER_BUTTON = "Reset"; public static final String PARTICIPANT_LIST_PAGE_HEADER = "Participant List"; public static final String NEW_ATTRIBUTE_HEADER = "New attribute"; public static final String SUCCESSFUL_IDENTITY_ATTRIBUTE_CREATION_ALERT_MESSAGE = "You successfully created an attribute"; diff --git a/src/main/java/framework/ui/locators/simplOpen/Authority.java b/src/main/java/framework/ui/locators/simplOpen/Authority.java index 91efe1296e4ca764023bfd8d2d12c09382239263..c40177ccb0fdfe56e8d6d95231ddf9b6500a872d 100644 --- a/src/main/java/framework/ui/locators/simplOpen/Authority.java +++ b/src/main/java/framework/ui/locators/simplOpen/Authority.java @@ -38,6 +38,7 @@ public class Authority { public static final String SEE_REQUEST_DETAILS_BUTTON_LOCATOR = "//span[contains(text(), 'See request details' )]"; public static final String PARTICIPANT_LIST_FILTER_DROPDOWN_OPTIONS_LOCATOR = "mat-option[role='option']"; public static final String PARTICIPANT_LIST_FILTER_INPUT_LOCATOR = "input[matinput]"; + public static final String PARTICIPANT_LIST_APPLY_FILTER_BUTTON = "Apply"; public static final String PARTICIPANT_LIST_PARTICIPANT_NAME_COLUMN_LOCATOR = "//td[contains(@class, " + "'cdk-column-organization')]"; public static final String PARTICIPANT_DETAILS_HEADER_LOCATOR = "//h1[contains(text(), 'Participant Details' )]"; @@ -57,8 +58,7 @@ public class Authority { "div.mat-mdc-select-arrow-wrapper"; public static final String SECOND_FILTER_DROP_DOWN_ARROW_LOCATOR = "#filterStatusSelection > div > " + "div.mat-mdc-select-arrow-wrapper"; - public static final String PARTICIPANT_SECOND_FILTER_DROP_DOWN_ARROW_LOCATOR = "//div[@class=\"cdk-overlay-container\"]/div[2]/div/div/div/div[2]" + - "/mat-form-field/div[1]/div/div[2]/mat-select/div/div[2]/div"; + public static final String PARTICIPANT_SECOND_FILTER_DROP_DOWN_ARROW_LOCATOR = "#mat-select-value-5"; public static final String FILTER_TABLE = "tbody.mdc-data-table__content"; public static final String REQUEST_STATUS_COLUMN_FROM_REQUEST_LIST_TABLE_LOCATOR = "td.mat-mdc-cell.mdc-data-table__cell." + "cdk-cell.cdk-column-status.mat-column-status"; @@ -77,7 +77,9 @@ public class Authority { public static final String REQUEST_DATA_HEADER_FORM_REQUEST_LIST_ARROW_LOCATOR = "//th[contains(@class,'mat-sort-header')]"; public static final String REQUEST_DATA_HEADER_FORM_LAST_CHANGE_DATE_ARROW_LOCATOR = "//th[contains(@class,'mat-column-up')]"; public static final String PARTICIPANT_lIST_HEADER_PARTICIPANT_TYPE_LOCATOR = "//div[contains(text(), ' Participant type')]"; + public static final String PARTICIPANT_lIST_HEADER_PARTICIPANT_NAME_LOCATOR = "//div[contains(text(), ' Participant Name')]"; public static final String PARTICIPANT_lIST_HEADER_ONBOARDING_DATE_LOCATOR = "//div[contains(text(), ' Onboarding Date')]"; + public static final String PARTICIPANT_LIST_SECOND_FILTER_LOCATOR = "#mat-input-0"; public static final String PARTICIPANT_lIST_HEADER_PARTICIPANT_TYPE_ARROW_LOCATOR = "//th[contains(@class,' mat-column-participantType')]"; public static final String PARTICIPANT_lIST_HEADER_ONBOARDING_DATE_ARROW_LOCATOR = "//th[contains(@class,'mat-column-up')]"; public static final String APPROVE_REQUEST_BUTTON_LOCATOR = ".col-lg-2.mx-2.mb-1.btn.btn-primary"; @@ -108,6 +110,7 @@ public class Authority { public static final String IDENTITY_ATTRIBUTE_LIST_DELETE_DIALOG_LOCATOR = "[role=dialog]"; public static final String IDENTITY_ATTRIBUTE_LIST_DELETE_DIALOG_TITLE_LOCATOR = "h2[mat-dialog-title]"; public static final String IDENTITY_ATTRIBUTE_LIST_DELETE_DIALOG_MESSAGE_LOCATOR = "mat-dialog-content p"; + public static final String FILTER_APPLIED_VALUE_LOCATOR = "lib-filter > div > span"; 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']"; diff --git a/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java b/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java index 051e636192ac905b43574a186b6680b875152907..dafd8985efcfba28898ceaee87b39590f8ec4f18 100644 --- a/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java +++ b/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java @@ -7,9 +7,9 @@ import framework.common.Assertions; import framework.ui.helpers.UiSetup; import framework.ui.helpers.Utils; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; + +import java.time.format.DateTimeFormatter; +import java.util.*; import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; import static configuration.ui.data.simplOpen.Authority.ALERT_DISPLAYING_SUCCESSFUL_APPROVED; @@ -23,12 +23,13 @@ public class AuthorityPage { private final Page page = UiSetup.getPage(); /*** - * This method selects the status to press within the second filter found in "Dashboard Requests List" - * Search filter by Text + * This method selects a value from the second filter. + * For example in "Dashboard Requests List" : There are 4 options: In progress|Approved|Rejected|Inserted * The status to be selected is sending in the step - * @param statusReq There are 4 options: In progress|Approved|Rejected|Inserted + * + * @param filter */ - public void verifyUserSelectOptionFromSecondFilter(String statusReq, Locator locatorValue, String list) { + public void verifyUserSelectOptionFromSecondFilter(String filter, Locator locatorValue, String list) { Locator dropdownArrow = switch (list) { case "Request list" -> page.locator(SECOND_FILTER_DROP_DOWN_ARROW_LOCATOR); case "Participant list" -> page.locator(PARTICIPANT_SECOND_FILTER_DROP_DOWN_ARROW_LOCATOR); @@ -43,12 +44,12 @@ public class AuthorityPage { assertElementIsVisibleByLocator(locatorValue.nth(i)); String valueElement = locatorValue.nth(i).innerText(); if (valueElement != null && !valueElement.equals("")) { - if (valueElement.equals(statusReq)) { + if (valueElement.equals(filter)) { locatorValue.nth(i).click(); break; } } else { - throw new IllegalArgumentException("The ".concat(statusReq).concat(" element does not exist")); + throw new IllegalArgumentException("The ".concat(filter).concat(" element does not exist")); } } } @@ -57,6 +58,7 @@ public class AuthorityPage { * This method selects the status to press within the first filter found in "Dashboard Requests List" * Search filter by value * The status to be selected is sending in the step + * * @param statusReq There are two options: status|email */ public void verifyUserSelectOptionFromFirstFilter(String statusReq, Locator locatorValue) { @@ -188,7 +190,6 @@ public class AuthorityPage { public Boolean getAssignableToTier1() { return assignableToTier1; } - } /*** @@ -254,6 +255,7 @@ public class AuthorityPage { /*** * This method selects the number of values displayed per page + * * @param numberValueByPage */ public void itemsPerPageSelectionInTableDropdown(Integer numberValueByPage) { @@ -289,6 +291,7 @@ public class AuthorityPage { /*** * This method orders a certain column in ascending order + * * @param columnLocatorValue * @param arrowLocatorValue */ @@ -302,6 +305,7 @@ public class AuthorityPage { /*** * This method orders a certain column in descending order + * * @param columnLocatorValue * @param arrowLocatorValue */ @@ -317,6 +321,7 @@ public class AuthorityPage { /*** * This method checks if the displayed table list was sorted according to the column selected. * This method calls compareTwoListsAreEquals + * * @param columnToSort */ public void verifyTheDatesValuesOfTheColumnWereSorted(String columnToSort) { @@ -406,6 +411,7 @@ public class AuthorityPage { * 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, * accept it and then check that the "REJECTED" status is visible + * * @param action */ public void theUserProcessActionValue(String action) throws InterruptedException { diff --git a/src/test/java/features/ui/simplOpen/Authority.feature b/src/test/java/features/ui/simplOpen/Authority.feature index 96d275c4be019459cf0a0dd4f76ced2cf46749bb..aa88f616f9f4368d0d0858bac74964c9d5deb59a 100644 --- a/src/test/java/features/ui/simplOpen/Authority.feature +++ b/src/test/java/features/ui/simplOpen/Authority.feature @@ -105,7 +105,7 @@ Feature: Authority Given the user navigates to the "Participant Management" page And the user is redirected to the "Governance Authority" keycloak And the user logs in with a user with "IATTR_M" role - And the list of onboarded participants for the data space is displayed + And the "list of onboarded participants" for the data space is displayed When the user filters by "Participant Name" with value "PSO SIMPL-3049" And the user clicks on the first result from "Participant List" Then the Participant Details page is displayed @@ -231,7 +231,7 @@ Feature: Authority Scenario Outline: Verify Navigation to Participant Type Detail Page and Display of Correct Title and Identity Attributes Given the user navigates to the "Participant Management" page And the user logs in with a user with "IATTR_M" role - And the list of onboarded participants for the data space is displayed + And the "list of onboarded participants" for the data space is displayed When the user filters by "Participant Type" with value "<Participant Type>" Then the Participant List page is displayed And the user clicks on the first result from "Participant List" @@ -323,7 +323,7 @@ Feature: Authority Given the user navigates to the "Dashboard Requests List" page And the user logs in with a user with "NOTARY" role When the user sorts by "<sortDirection>" "<columnToSort>" - Then the list is sorted successfully by "<columnToSort>" + Then the "onboarding request list" is sorted successfully by "<columnToSort>" Examples: | sortDirection | columnToSort | | ascending | Last change date | @@ -356,7 +356,8 @@ Feature: Authority | The user selects 25 elements by page | 25 | | The user selects 100 elements by page | 100 | - @TCA24 @SIMPL-3057 @SIMPL-3058 @SIMPL-3059 + @TCA24 @SIMPL-3057 @SIMPL-3058 @SIMPL-3059 @bugSIMPL-951 + # @ToDo: Email user column does not appear at the moment bug reported Scenario Outline: Verify Table Headings, Onboarded Participants List, and Pagination Control : <caseName> Given the user navigates to the "Participant Management" page When the user logs in with a user with "IATTR_M" role @@ -364,8 +365,9 @@ Feature: Authority | Participant Name | | Participant type | | Onboarding Date | + #| Applicant user email | | Actions | - And the list of onboarded participants for the data space is displayed + And the "list of onboarded participants" for the data space is displayed When the user selects <numberValueByPage> items per page from the dropdown list And the "Participant List" is updated with a maximum of <numberValueByPage> results Then the user updates the participant list by trying to click the "Next page" button @@ -429,17 +431,17 @@ Feature: Authority Then the list displays "<valueDisplayed>" for each Identity Attribute in the "<columnName>" column Examples: - | columnName | valueDisplayed | - | Assignable to Role | a boolean value | - | In use | a boolean value | - | Action | icon delete | + | columnName | valueDisplayed | + | Assignable to Role | a boolean value | + | In use | a boolean value | + | Action | icon delete | @TCA29 @SIMPL-3106 @SIMPL-3107 @SIMPL-3108 @SIMPL-3109 Scenario Outline: User sorts Participant List requests by <columnToSort> in <sortDirection> order Given the user navigates to the "Participant Management" page And the user logs in with a user with "IATTR_M" role When the user sorts by "<sortDirection>" "<columnToSort>" - Then the list is sorted successfully by "<columnToSort>" + Then the "participant list requests" is sorted successfully by "<columnToSort>" Examples: | sortDirection | columnToSort | @@ -480,3 +482,21 @@ Feature: Authority And the user logs in with a user with "IATTR_M" role When the user presses on the delete button Then the dialog for the delete action is displayed successfully + + + @TCA32 @SIMPL-3309 @SIMPL-3310 @SIMPL-3311 @bugSIMPL-10276 @SIMPL-3313 @SIMPL-3314 + # Filter by email scenario has a bug associated. + Scenario Outline: Participants Management page filtering and reseting the filters: <caseName> + Given the user navigates to the "Participant Management" page + And the user logs in with a user with "IATTR_M" role + When the user filters by "<filter>" with value "<filterValue>" + Then the "Participants list" for the data space is displayed + And the user resets the "<filter>" with the value "<filterValue>" applied successfully + And the "Participants list" for the data space is displayed + + Examples: + | caseName | filter | filterValue | + | the user is filtering by Participant type | Participant Type | Consumer | + | the user is filtering by Participant Name | Participant Name | PSO | + #| the user is filtering by Email | Email | complete | + diff --git a/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java b/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java index ed7425e67a2f3aad382ef7d054fb484753a12571..0694b59c1a306167a26d6ac2ee7efc3515fbdc2e 100644 --- a/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java +++ b/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java @@ -27,7 +27,6 @@ import static framework.ui.helpers.Utils.clickButtonByLocator; import static framework.ui.locators.simplOpen.Authority.*; import static framework.ui.pages.simplOpen.AuthorityPage.*; import static org.junit.Assert.*; -import static org.junit.Assert.assertTrue; public class AuthoritySteps { public static final DateTimeFormatter DATE_CUCUMBER_INPUT = DateTimeFormatter.ofPattern("dd/MM/yyyy"); @@ -39,6 +38,7 @@ public class AuthoritySteps { private final AuthorityPage authorityPage = new AuthorityPage(); private final CommonSteps commonSteps = new CommonSteps(); + @Given("the user clicks the register for this dataspace button") public void the_user_clicks_the_register_for_this_dataspace_button() { page.locator(ONBOARDING_INFO_REGISTER_BUTTON_LOCATOR).click(); @@ -91,8 +91,7 @@ public class AuthoritySteps { public void the_user_verifies_the_create_credential_button_is(String state) { boolean shouldBeEnabled = state.equalsIgnoreCase("enabled"); boolean isEnabled = page.locator(CREATE_CREDENTIALS_BUTTON_LOCATOR).isEnabled(); - assertEquals(String.format("Expected 'Create Credentials' button to be %s, but it was %s.", state, isEnabled ? "enabled" : "disabled"), - shouldBeEnabled, isEnabled); + assertEquals(String.format("Expected 'Create Credentials' button to be %s, but it was %s.", state, isEnabled ? "enabled" : "disabled"), shouldBeEnabled, isEnabled); } @Given("^the applicant with (pdf submitted|pdf not submitted) is in the onboarding status page$") @@ -242,6 +241,14 @@ public class AuthoritySteps { authorityPage.verifyUserSelectOptionFromFirstFilter(filter, page.locator(PARTICIPANT_TYPE_OPTIONS_LOCATOR)); page.locator(PARTICIPANT_LIST_FILTER_INPUT_LOCATOR).fill(value); } + case "Onboarding Date" -> { + page.getByText(PARTICIPANT_PAGE_FILTER_SELECT_COLUMN).click(); + dropdownOptions = page.locator(PARTICIPANT_LIST_FILTER_DROPDOWN_OPTIONS_LOCATOR).all(); + dropdownOptions.get(2).click(); + LocalDate today = LocalDate.now(); + DateTimeFormatter formatter = CalendarWidget.getDateFormat(); + page.locator(PARTICIPANT_LIST_SECOND_FILTER_LOCATOR).fill(today.format(formatter)); + } default -> throw new IllegalArgumentException("Unknown filter: " + filter); } page.getByText(PARTICIPANT_PAGE_APPLY_FILTER_BUTTON).click(); @@ -278,9 +285,7 @@ public class AuthoritySteps { @When("^the user (submits|cancels) the form$") public void theUserHandlesTheForm(String action) { - String locator = action.equals("submits") - ? IDENTITY_ATTRIBUTE_CREATION_SAVE_BUTTON_LOCATOR - : IDENTITY_ATTRIBUTE_CREATION_CANCEL_BUTTON_LOCATOR; + String locator = action.equals("submits") ? IDENTITY_ATTRIBUTE_CREATION_SAVE_BUTTON_LOCATOR : IDENTITY_ATTRIBUTE_CREATION_CANCEL_BUTTON_LOCATOR; clickButtonByLocator(locator); } @@ -313,15 +318,13 @@ public class AuthoritySteps { @When("the user updates the Identity Attribute with the following data:") public void theUserUpdatesTheIdentityAttributeWithTheFollowingData(DataTable dataTable) { Map<String, String> data = dataTable.asMap(String.class, String.class); - authorityPage.fillIdentityAttributeForm(data.get("Name"), data.get("Code"), - Boolean.parseBoolean((data.get("Assignable to Tier 1")))); + authorityPage.fillIdentityAttributeForm(data.get("Name"), data.get("Code"), Boolean.parseBoolean((data.get("Assignable to Tier 1")))); } @When("the user reverts the changes done to the Identity Attribute") public void theUserRevertsTheChangesDoneToTheIdentityAttribute() { clickButtonByLocator(IDENTITY_ATTRIBUTE_EDIT_BUTTON_LOCATOR); - authorityPage.fillIdentityAttributeForm(identityAttribute.getName(), identityAttribute.getCode(), - identityAttribute.getAssignableToTier1()); + authorityPage.fillIdentityAttributeForm(identityAttribute.getName(), identityAttribute.getCode(), identityAttribute.getAssignableToTier1()); clickButtonByLocator(IDENTITY_ATTRIBUTE_CREATION_SAVE_BUTTON_LOCATOR); Locator updateAlert = page.getByRole(AriaRole.ALERT); assertElementIsVisibleByLocator(updateAlert); @@ -356,14 +359,14 @@ public class AuthoritySteps { authorityPage.verifyNumberOfResultsDisplayedInTheList(listType, numberValueByPage); } - @Then("the list of onboarded participants for the data space is displayed") - public void the_list_of_onboarded_participants_for_the_data_space_is_displayed() { + @Then("the {string} for the data space is displayed") + public void the_list_of_onboarded_participants_for_the_data_space_is_displayed(String name) { assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_PARTICIPANT_LIST_HEADER)); assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_FILTER_BUTTON)); assertElementIsVisibleByLocator(page.locator(PARTICIPANT_LIST_TABLE_LOCATOR)); - assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_PARTICIPANT_NAME_COLUMN)); - assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_PARTICIPANT_TYPE_COLUMN)); - assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_ONBOARDING_DATE_COLUMN)); + assertElementIsVisibleByLocator(page.locator(PARTICIPANT_lIST_HEADER_PARTICIPANT_NAME_LOCATOR)); + assertElementIsVisibleByLocator(page.locator(PARTICIPANT_lIST_HEADER_PARTICIPANT_TYPE_LOCATOR)); + assertElementIsVisibleByLocator(page.locator(PARTICIPANT_lIST_HEADER_ONBOARDING_DATE_LOCATOR)); assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_ACTIONS_COLUMN)); } @@ -488,15 +491,8 @@ public class AuthoritySteps { @Then("the list of Identity Attributes for the participant is displayed") public void theListOfIdentityAttributesForTheParticipantIsDisplayed() { assertElementIsVisibleByLocator(page.locator(PARTICIPANT_DETAILS_HEADER_LOCATOR)); - List<String> tableHeaders = - page.locator(PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_HEADER_COLUMNS_LOCATOR).allTextContents(); - List<String> expectedHeaders = List.of(PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_NAME_COLUMN, - PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_CODE_COLUMN, - PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_ASSIGNABLE_COLUMN, - PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_ENABLED_COLUMN, - PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_CREATION_DATE_COLUMN, - PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_ACTIONS, - PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_LAST_CHANGE_DATE_COLUMN); + List<String> tableHeaders = page.locator(PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_HEADER_COLUMNS_LOCATOR).allTextContents(); + List<String> expectedHeaders = List.of(PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_NAME_COLUMN, PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_CODE_COLUMN, PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_ASSIGNABLE_COLUMN, PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_ENABLED_COLUMN, PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_CREATION_DATE_COLUMN, PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_ACTIONS, PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_LAST_CHANGE_DATE_COLUMN); tableHeaders.replaceAll(String::strip); assertEqualCollections(expectedHeaders, tableHeaders); } @@ -522,15 +518,13 @@ public class AuthoritySteps { } break; case "Last Update Date": - Locator lastUpdateDateResults = - page.locator(PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_LAST_UPDATE_DATE_COLUMN_LOCATOR); + Locator lastUpdateDateResults = page.locator(PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_LAST_UPDATE_DATE_COLUMN_LOCATOR); if (lastUpdateDateResults.first().isVisible()) { List<String> actualDates = lastUpdateDateResults.allTextContents(); String[] range = value.split("-"); LocalDate startDate = LocalDate.parse(range[0].strip(), DATE_CUCUMBER_INPUT); LocalDate endDate = LocalDate.parse(range[1].strip(), DATE_CUCUMBER_INPUT); - actualDates.forEach(row -> assertDateIsInRange(startDate, endDate, LocalDate.parse(row.strip(), - DateTimeFormatter.ofPattern("LLL d, yyyy", Locale.ENGLISH)))); + actualDates.forEach(row -> assertDateIsInRange(startDate, endDate, LocalDate.parse(row.strip(), DateTimeFormatter.ofPattern("LLL d, yyyy", Locale.ENGLISH)))); } else { throw new AssertionError("The chosen participant does not have identity attributes assigned."); } @@ -609,13 +603,11 @@ public class AuthoritySteps { details.put("Last change date", today.format(formatter)); } - if ("Assignable Test Identity Attribute".equals(details.get("Name")) || - "Non-Assignable Test Identity Attribute".equals(details.get("Name"))) { + if ("Assignable Test Identity Attribute".equals(details.get("Name")) || "Non-Assignable Test Identity Attribute".equals(details.get("Name"))) { details.put("Name", identityAttribute.getName()); } - if ("assignable_test_identity_attribute".equals(details.get("Code")) || - "non_assignable_test_identity_attribute".equals(details.get("Code"))) { + if ("assignable_test_identity_attribute".equals(details.get("Code")) || "non_assignable_test_identity_attribute".equals(details.get("Code"))) { details.put("Code", identityAttribute.getCode()); } @@ -711,8 +703,8 @@ public class AuthoritySteps { Utils.checkInputFieldHasText(page, ORGANISATION_INPUT_LOCATOR, participantType); } - @Then("the list is sorted successfully by {string}") - public void verify_the_dates_values_of_the_column_were_sorted(String columnToSort) { + @Then("the {string} is sorted successfully by {string}") + public void verify_the_dates_values_of_the_column_were_sorted(String nameSpace, String columnToSort) { authorityPage.verifyTheDatesValuesOfTheColumnWereSorted(columnToSort); } @@ -734,9 +726,7 @@ public class AuthoritySteps { for (String expectedHeading : expectedHeadings) { if (!actualHeadings.contains(expectedHeading)) { - throw new RuntimeException( - String.format("Expected heading '%s' not found in the table. Actual headings: %s", expectedHeading, actualHeadings) - ); + throw new RuntimeException(String.format("Expected heading '%s' not found in the table. Actual headings: %s", expectedHeading, actualHeadings)); } } } @@ -777,4 +767,18 @@ public class AuthoritySteps { assertElementIsVisibleByLocator(page.locator(IDENTITY_ATTRIBUTE_LIST_LAST_CHANGE_DATE_HEADER_LOCATOR)); assertElementIsVisibleByLocator(page.locator(IDENTITY_ATTRIBUTE_LIST_ACTIONS_HEADER_LOCATOR)); } + + @Then("the user resets the {string} with the value {string} applied successfully") + public void the_user_resets_the_filters_applied_successfully(String filter, String valueFilter) { + String filterValueApplied = "null"; + filterValueApplied = filter.concat(":").concat(" ").concat(valueFilter.toUpperCase()).concat(";"); + String filterAppliedLocatorValue = page.locator(FILTER_APPLIED_VALUE_LOCATOR).innerText().trim(); + if (!filterValueApplied.equals(filterAppliedLocatorValue)) { + throw new AssertionError("The filter: " + filter + " with the value " + valueFilter + " is not displayed."); + } + page.getByText(PARTICIPANT_PAGE_FILTER_BUTTON).click(); + assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_RESET_FILTER_BUTTON)); + page.getByText(PARTICIPANT_PAGE_RESET_FILTER_BUTTON).click(); + assertElementIsNotVisibleByLocator(page.locator(FILTER_APPLIED_VALUE_LOCATOR)); + } }