diff --git a/src/main/java/framework/ui/locators/simplOpen/Authority.java b/src/main/java/framework/ui/locators/simplOpen/Authority.java index c40177ccb0fdfe56e8d6d95231ddf9b6500a872d..5f7fe1f36b737c2458a2a2b483669a8df38c1470 100644 --- a/src/main/java/framework/ui/locators/simplOpen/Authority.java +++ b/src/main/java/framework/ui/locators/simplOpen/Authority.java @@ -52,7 +52,17 @@ public class Authority { public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_LAST_UPDATE_DATE_COLUMN_LOCATOR = "//td[contains" + "(@class, 'cdk-column-updateTimestamp')]"; public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_LOCATOR = "tbody[role='rowgroup']"; - + public static final String PARTICIPANT_DETAILS_VALUE_ROW_lOCATOR = " table > tbody >tr > td "; + public static final String PARTICIPANT_DETAILS_IDENTIFIER_LABEL_LOCATOR = "#label-id"; + public static final String PARTICIPANT_DETAILS_IDENTIFIER_VALUE_LOCATOR = "#value-id"; + public static final String PARTICIPANT_DETAILS_NAME_LABEL_LOCATOR = "#label-participantName"; + public static final String PARTICIPANT_DETAILS_NAME_VALUE_LOCATOR = "#value-participantName"; + public static final String PARTICIPANT_DETAILS_TYPE_LABEL_LOCATOR = "#label-participantType"; + public static final String PARTICIPANT_DETAILS_TYPE_VALUE_LOCATOR = "//div[contains(text(),'GOVERNANCE_AUTHORITY')]"; + public static final String PARTICIPANT_DETAILS_ONBOARDING_DATE_LABEL_LOCATOR = "#label-onboardingDate"; + public static final String PARTICIPANT_DETAILS_ONBOARDING_DATE_VALUE_LOCATOR = "#value-onboardingDate"; + public static final String PARTICIPANT_DETAILS_CREDENTIAL_EXPIRATION_DATE_LABEL_LOCATOR = "#label-expiryDate"; + public static final String PARTICIPANT_DETAILS_CREDENTIAL_EXPIRATION_DATE_VALUE_LOCATOR = "#value-expiryDate"; public static final String FILTER_FORM_BUTTON_LOCATOR = "span.mdc-button__label"; public static final String FIRST_FILTER_DROP_DOWN_ARROW_LOCATOR = "#filterColumn > div > " + "div.mat-mdc-select-arrow-wrapper"; @@ -128,6 +138,4 @@ public class Authority { 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 dafd8985efcfba28898ceaee87b39590f8ec4f18..e96be1cc7cfc88390c950459ac12e53031e94a0d 100644 --- a/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java +++ b/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java @@ -6,10 +6,10 @@ import com.microsoft.playwright.options.AriaRole; import framework.common.Assertions; import framework.ui.helpers.UiSetup; import framework.ui.helpers.Utils; +import io.cucumber.datatable.DataTable; - -import java.time.format.DateTimeFormatter; import java.util.*; +import java.text.SimpleDateFormat; import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; import static configuration.ui.data.simplOpen.Authority.ALERT_DISPLAYING_SUCCESSFUL_APPROVED; @@ -17,6 +17,7 @@ import static configuration.ui.data.simplOpen.Authority.ALERT_DISPLAYING_SUCCESS import static framework.common.Assertions.*; import static framework.ui.locators.simplOpen.Authority.*; import static framework.ui.locators.simplOpen.Authority.REQUEST_STATUS_LOCATOR; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; public class AuthorityPage { @@ -452,6 +453,7 @@ public class AuthorityPage { *Validates values in an Identity Attribute table column. * Basically, it validates that for the "Assignable to Role" and "In Use" columns boolean values are displayed * and for the "Action" column the button with an image is displayed to delete the row. + * * @param columnName */ public void validateColumnValueForEachIdentityAttribute(String columnName) { @@ -479,4 +481,82 @@ public class AuthorityPage { } } } + + /*** + * This method compares the Identifier ID from the URL with the ID that is displayed on the + * Participant Detail page + * @return + */ + public String verifyIdInUrl() { + assertElementIsVisibleByLocator(page.locator(PARTICIPANT_DETAILS_IDENTIFIER_LABEL_LOCATOR)); + String currentUrl = page.url(); + String urlIdentifier = currentUrl.substring(currentUrl.lastIndexOf("/") + 1); + String pageIdentifier = page.locator(PARTICIPANT_DETAILS_IDENTIFIER_VALUE_LOCATOR).textContent().trim(); + if (!pageIdentifier.equals(urlIdentifier)) { + throw new AssertionError(" The Identifiers do no match: " + urlIdentifier + " but found: " + pageIdentifier); + } + return urlIdentifier; + } + + /*** + *This method parses from date format "Feb 11, 2025" into "Tue Feb 11 2025" + * + * @param dateToBeParsed + * @return String + */ + public String parseDate(String dateToBeParsed) { + Date date = new Date(dateToBeParsed); + SimpleDateFormat df = new SimpleDateFormat("EEE MMM d yyyy", Locale.ENGLISH); + return df.format(date); + } + + + /*** + * This method compares the values obtained dynamically from the first row of the Participant List page + * and compares them with the values obtained dynamically from the Participant Detail page. + * + * @param dataTable The values of this table are obtained from the features + * @param participantDetailNameValue This is a String value obtained before to select the first row + * @param participantDetailTypeValue This is a String value obtained before to select the first row + * @param participantDetailOnboardingValue This is a String value obtained before to select the first row + */ + public void verifyTheValuesObtainedMatchWithValueDisplayed(DataTable dataTable, String participantDetailNameValue, String participantDetailTypeValue, String participantDetailOnboardingValue) { + + Map<String, String> map = dataTable.asMap(String.class, String.class); + HashMap<String, String> details = new HashMap<>(map); + + String identifier = details.get("Identifier"); + String participantName = details.get("Participant Name"); + String participantType = details.get("Participant type"); + String onboardingDate = details.get("Onboarding Date"); + String credentialExpirationDate = details.get("Participant Credentials Expiration Date"); + + if ("IDENTIFIER_OBTAINED_DYNAMICALLY_FROM_URL".equals(identifier)) { + details.put("Identifier", verifyIdInUrl()); + } + if ("PARTICIPANT_NAME_OBTAINED_DYNAMICALLY_FROM_PARTICIPANT_DETAIL_PAGE".equals(participantName)) { + assertElementIsVisibleByLocator(page.locator(PARTICIPANT_DETAILS_NAME_LABEL_LOCATOR)); + assertEquals(page.locator(PARTICIPANT_DETAILS_NAME_VALUE_LOCATOR).textContent(), participantDetailNameValue); + details.put("Participant Name", page.locator(PARTICIPANT_DETAILS_NAME_VALUE_LOCATOR).textContent()); + } + if ("PARTICIPANT_TYPE_OBTAINED_DYNAMICALLY_FROM_PARTICIPANT_DETAIL_PAGE".equals(participantType)) { + assertElementIsVisibleByLocator(page.locator(PARTICIPANT_DETAILS_TYPE_LABEL_LOCATOR)); + assertEquals(page.locator(PARTICIPANT_DETAILS_TYPE_VALUE_LOCATOR).textContent(), participantDetailTypeValue); + details.put("Participant type", page.locator(PARTICIPANT_DETAILS_TYPE_VALUE_LOCATOR).textContent()); + } + if ("ONBOARDING_DATE_OBTAINED_DYNAMICALLY_FROM_PARTICIPANT_DETAIL_PAGE".equals(onboardingDate)) { + assertElementIsVisibleByLocator(page.locator(PARTICIPANT_DETAILS_ONBOARDING_DATE_LABEL_LOCATOR)); + assertEquals(page.locator(PARTICIPANT_DETAILS_ONBOARDING_DATE_VALUE_LOCATOR).textContent(), participantDetailOnboardingValue); + details.put("Onboarding Date", page.locator(PARTICIPANT_DETAILS_ONBOARDING_DATE_VALUE_LOCATOR).textContent()); + } + if ("CREDENTIALS_EXPIRATION_DATE_OBTAINED_DYNAMICALLY_FROM_PARTICIPANT_DETAIL_PAGE".equals(credentialExpirationDate)) { + assertElementIsVisibleByLocator(page.locator(PARTICIPANT_DETAILS_CREDENTIAL_EXPIRATION_DATE_LABEL_LOCATOR)); + details.put("Participant Credentials Expiration Date", page.locator(PARTICIPANT_DETAILS_CREDENTIAL_EXPIRATION_DATE_VALUE_LOCATOR).textContent()); + } + + List<String> expectedValues = new ArrayList<>(details.values()); + List<String> realValues = page.locator(PARTICIPANT_DETAILS_COLUMNS_LOCATOR).allTextContents(); + realValues.replaceAll(String::strip); + assertEqualCollections(expectedValues, realValues); + } } diff --git a/src/test/java/features/ui/simplOpen/Authority.feature b/src/test/java/features/ui/simplOpen/Authority.feature index aa88f616f9f4368d0d0858bac74964c9d5deb59a..30796fefcabdaebb92762f82e3897104951761c1 100644 --- a/src/test/java/features/ui/simplOpen/Authority.feature +++ b/src/test/java/features/ui/simplOpen/Authority.feature @@ -108,7 +108,7 @@ Feature: Authority 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 + Then the user verifies the participants information on the Participant Details page And the following participant details are displayed: | Identifier | USER_IDENTIFIER | | Participant Name | PSO SIMPL-3049 | @@ -124,7 +124,7 @@ Feature: Authority And the user logs in with a user with "IATTR_M" role And the user filters by "Participant Name" with value "PSO SIMPL-3049" And the user clicks on the first result from "Participant List" - And the Participant Details page is displayed + And the user verifies the participants information on the Participant Details page And the list of Identity Attributes for the participant is displayed When the user filters by "<filter>" with value "<value>" Then the identity attributes shown have "<filter>" matching "<value>" @@ -500,3 +500,17 @@ Feature: Authority | the user is filtering by Participant Name | Participant Name | PSO | #| the user is filtering by Email | Email | complete | + @TCA34 @SIMPL-4917 + Scenario: Confirm Participant Detail Information Page displays correct details. + 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 + When the user reads the Participant List data from the first row + And the user clicks on the first result from "Participant List" + Then the user verifies the participants information on the Participant Details page + And the user verifies the following participant details match with the values obtained from the row + | Identifier | IDENTIFIER_OBTAINED_DYNAMICALLY_FROM_URL | + | Participant Name | PARTICIPANT_NAME_OBTAINED_DYNAMICALLY_FROM_PARTICIPANT_DETAIL_PAGE | + | Participant type | PARTICIPANT_TYPE_OBTAINED_DYNAMICALLY_FROM_PARTICIPANT_DETAIL_PAGE | + | Onboarding Date | ONBOARDING_DATE_OBTAINED_DYNAMICALLY_FROM_PARTICIPANT_DETAIL_PAGE | + | Participant Credentials Expiration Date | CREDENTIALS_EXPIRATION_DATE_OBTAINED_DYNAMICALLY_FROM_PARTICIPANT_DETAIL_PAGE | diff --git a/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java b/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java index 0694b59c1a306167a26d6ac2ee7efc3515fbdc2e..2e1e490eb54570b9d8596832c9da348b82dc2ef0 100644 --- a/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java +++ b/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java @@ -37,6 +37,9 @@ public class AuthoritySteps { private final IdentityAttribute identityAttribute = new IdentityAttribute(); private final AuthorityPage authorityPage = new AuthorityPage(); private final CommonSteps commonSteps = new CommonSteps(); + private static String participantDetailNameValue = "null"; + private static String participantDetailTypeValue = null; + private static String participantDetailOnboardingValue = null; @Given("the user clicks the register for this dataspace button") @@ -353,6 +356,14 @@ public class AuthoritySteps { page.locator(IDENTITY_ATTRIBUTE_LIST_DELETE_COLUMN_LOCATOR).first().click(); } + @When("the user reads the Participant List data from the first row") + public void TheUserReadsTheParticipantListDataFromTheFirstRow() { + participantDetailNameValue = page.locator(PARTICIPANT_DETAILS_VALUE_ROW_lOCATOR).first().textContent(); + participantDetailTypeValue = page.locator(PARTICIPANT_DETAILS_VALUE_ROW_lOCATOR).nth(1).textContent(); + participantDetailOnboardingValue = page.locator(PARTICIPANT_DETAILS_VALUE_ROW_lOCATOR).nth(2).textContent(); + participantDetailOnboardingValue = authorityPage.parseDate(participantDetailOnboardingValue); + } + @Then("the {string} is updated with a maximum of {int} results") public void theRequestListIsUpdatedShowingAMaximumNumberOfResultsPerPage(String listType, Integer numberValueByPage) { assertElementIsVisibleByLocator(page.locator(FILTER_TABLE)); @@ -454,7 +465,7 @@ public class AuthoritySteps { assert (page.locator(ERROR_MESSAGE_LOCATOR).textContent()).contains(ERROR_MESSAGE); } - @Then("the Participant Details page is displayed") + @Then("the user verifies the participants information on the Participant Details page") public void theParticipantDetailsPageIsDisplayed() { assertElementIsVisibleByLocator(page.locator(PARTICIPANT_DETAILS_HEADER_LOCATOR)); } @@ -742,7 +753,7 @@ public class AuthoritySteps { clickButtonByLocator(LOGOUT_BUTTON); } - @Then ("the list displays {string} for each Identity Attribute in the {string} column") + @Then("the list displays {string} for each Identity Attribute in the {string} column") public void validate_column_value_for_each_identity_attribute(String columnValue, String columnName) { authorityPage.validateColumnValueForEachIdentityAttribute(columnName); } @@ -781,4 +792,9 @@ public class AuthoritySteps { page.getByText(PARTICIPANT_PAGE_RESET_FILTER_BUTTON).click(); assertElementIsNotVisibleByLocator(page.locator(FILTER_APPLIED_VALUE_LOCATOR)); } + + @Then("the user verifies the following participant details match with the values obtained from the row") + public void theUserVerifiesTheElementsInParticipantDetailsPage(DataTable dataTable) { + authorityPage.verifyTheValuesObtainedMatchWithValueDisplayed(dataTable, participantDetailNameValue, participantDetailTypeValue, participantDetailOnboardingValue); + } }