Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 8278ed96 authored by Jaime Pérez-Lozana's avatar Jaime Pérez-Lozana
Browse files

Merge branch 'feature/SOUI-SIMPL-4129' into 'develop'

SIMPL-7386: automate TCs 3049, 4128, 4134 and 4135

See merge request simpl/pso/pso-test/pso-test-automation!81
parents 23109512 70806628
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,14 @@ public class Authority {
public static final String ONBOARDING_DATAPARTICIPANT_REQUEST_INPROGRESS_USER = "dataparticipant_req_inprogress@automation.com";
public static final String ONBOARDING_DATAPARTICIPANT_PASSWORD = "Test20!4";
public static final String INVALID_DATA = "InvalidUserPassword";
public static final String USER_PSO_SIMPL_4129_IDENTIFIER = "01934974-587b-764d-8f59-1112f53c5fdd";
public static final String USER_PSO_SIMPL_4129_ONBOARDING_DATE = "Wed Nov 20 2024";
public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_NAME_COLUMN = "Name";
public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_CODE_COLUMN = "Code";
public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_ASSIGNABLE_COLUMN = "Assignable";
public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_ENABLED_COLUMN = "Enabled";
public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_CREATION_DATE_COLUMN = "Creation date";
public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_LAST_CHANGE_DATE_COLUMN = "Last change date";
public static final String[] PARTICIPANT_TYPES = {
"Consumer",
......
package framework.common;
import com.microsoft.playwright.Locator;
import com.microsoft.playwright.assertions.PlaywrightAssertions;
import java.time.LocalDate;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class Assertions {
/**
* This method asserts that two collections are equal.
*
* @param expected expected collection.
* @param actual actual collection.
* @param <T> collection type.
*/
public static <T> void assertEqualCollections(Collection<T> expected, Collection<T> actual) {
assertEquals("The collections are different in size: ", expected.size(), actual.size());
expected.forEach(element -> assertTrue("Expected element " + element + " not found in actual collection",
actual.contains(element)));
}
/**
* This method verifies that a given date is in a wished range.
*
* @param startDate start date of the range.
* @param endDate end date of the range.
* @param date date that is wanted for verification.
*/
public static void assertDateIsInRange(LocalDate startDate, LocalDate endDate, LocalDate date) {
assertTrue("The chosen date is before the start of the range", date.isAfter(startDate) || date.equals(startDate));
assertTrue("The chosen date is after the end of the range", date.isBefore(endDate) || date.equals(endDate));
}
/**
* This method verifies that an element is visible.
*
* @param locator Locator object wanted for visibility verification.
*/
public static void assertElementIsVisibleByLocator(Locator locator) {
PlaywrightAssertions.assertThat(locator).isVisible();
}
}
package framework.ui.helpers;
import com.microsoft.playwright.Page;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
public class CalendarWidget {
public static final String OPEN_CALENDAR_LABEL = "Open calendar";
public static final String CHOOSE_MONTH_AND_YEAR_LABEL = "Choose month and year";
public static final DateTimeFormatter YEAR_FORMAT = DateTimeFormatter.ofPattern("yyyy", Locale.ENGLISH);
public static final DateTimeFormatter MONTH_FORMAT = DateTimeFormatter.ofPattern("LLLL yyyy", Locale.ENGLISH);
public static final DateTimeFormatter DAY_FORMAT = DateTimeFormatter.ofPattern("LLLL d, yyyy", Locale.ENGLISH);
/**
* This method selects a date from a calendar widget.
*
* @param page Playwright page.
* @param date wished date.
*/
public static void selectDate(Page page, LocalDate date) {
page.getByLabel(OPEN_CALENDAR_LABEL).click();
selectFromYear(page, date);
}
/**
* This method selects a date range from a calendar widget.
*
* @param page Playwright page.
* @param startDate wished start date.
* @param endDate wished end date.
*/
public static void selectDateRange(Page page, LocalDate startDate, LocalDate endDate) {
selectDate(page, startDate);
selectFromYear(page, endDate);
}
private static void selectFromYear(Page page, LocalDate date) {
page.getByLabel(CHOOSE_MONTH_AND_YEAR_LABEL).click();
page.getByLabel(date.format(YEAR_FORMAT)).click();
page.getByLabel(date.format(MONTH_FORMAT)).click();
page.getByLabel(date.format(DAY_FORMAT)).click();
}
}
......@@ -77,6 +77,7 @@ public final class Utils {
* Method to get credentials for the different keycloak users needed for tests.
*
* @param role The role of the user in keycloak.
* @return LogInDetails
*/
public static LogInDetails getUserAndPasswordByRole(String role) {
String user = "";
......@@ -137,15 +138,6 @@ public final class Utils {
return logInDetails;
}
/**
* This method verifies that an element is visible.
*
* @param locator Locator object wanted for visibility verification.
*/
public static void verifyElementIsVisibleByLocator(Locator locator) {
PlaywrightAssertions.assertThat(locator).isVisible();
}
/**
* POJO class to store users and passwords.
*/
......
package framework.ui.locators.simplOpen;
import framework.common.Config;
public class Authority {
public static final String ONBOARDING_INFO_REGISTER_BUTTON = ".mdc-button--unelevated.mat-primary";
public static final String EMAIL_ADDRESS = "input[id='email']";
......@@ -31,6 +29,19 @@ public class Authority {
public static final String GREY_ICON_LOCATOR_2 = "//div[contains(text(), '2' )]";
public static final String GREY_ICON_LOCATOR_3 = "//div[contains(text(), '3' )]";
public static final String SEE_REQUEST_DETAILS_BUTTON_LOCATOR = "//span[contains(text(), 'See request details' )]";
public static final String PARTICIPANT_LIST_FILTER_DROPDOWN_OPTIONS = "mat-option[role='option']";
public static final String PARTICIPANT_LIST_FILTER_INPUT = "input[matinput]";
public static final String PARTICIPANT_LIST_TABLE_ROWS = "//tr[contains(@class, 'cliccable')]";
public static final String PARTICIPANT_DETAILS_COLUMNS = "div[class='col']";
public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_HEADER_COLUMNS = "th[role='columnheader']";
public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_NAME_COLUMN = "//td[contains(@class, " +
"'cdk-column-name')]";
public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_CODE_COLUMN = "//td[contains(@class, " +
"'cdk-column-code')]";
public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_LAST_UPDATE_DATE_COLUMN = "//td[contains" +
"(@class, 'cdk-column-updateTimestamp')]";
public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE = "tbody[role='rowgroup']";
public Authority() {
}
}
......@@ -27,14 +27,7 @@ Feature: Authority
| Data Provider |
| Infrastructure Provider |
@TCA02 @SIMPL-4125
Scenario: Display of Onboarded Participants List in Governance Authority's Data Space
When 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 "NOTARY" role
Then the list of onboarded participants for the data space is displayed
@TCA03 @SIMPL-751
@TCA02 @SIMPL-751
Scenario: Verify applicant dataspace participant user view in progress onboarding status
Given the applicant with pdf submitted is in the onboarding status page
When the applicant logs in with valid credentials
......@@ -43,7 +36,7 @@ Feature: Authority
And the application status summary page shows the status request is "Request accepted" with a "grey" icon
And the applicant dataspace participant user can open the request status details dialog pressing See request details button
@TCA04 @SIMPL-752
@TCA03 @SIMPL-752
Scenario: Verify applicant dataspace participant user does not view in progress onboarding status
Given the applicant with pdf not submitted is in the onboarding status page
When the applicant logs in with valid credentials
......@@ -52,8 +45,44 @@ Feature: Authority
And the application status summary page does not show the status request is "Request accepted" with a "grey" icon
And the applicant dataspace participant user can open the request status details dialog pressing See request details button
@TCA05 @SIMPL-746
Scenario: Access Denied With Invalid Authentication
@TCA04 @SIMPL-746
Scenario: Access Denied With Invalid Authentication
Given the user navigates to the "Participant Management" page
And the user tries to logs in with invalid login credentials
Then the user sees an error message should be displayed
@TCA05 @SIMPL-3049 @SIMPL-4125
Scenario: Display of Participant Details in the Governance Authority's Data Space
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 "NOTARY" role
And the list of onboarded participants for the data space is displayed
When the user filters by "Participant Name" with value "PSO SIMPL 4129"
And the user clicks on the first result
Then the Participant Details page is displayed
And the following details are displayed
| Identifier | USER_IDENTIFIER |
| Participant Name | PSO SIMPL 4129 |
| Participant type | DATA_PROVIDER |
| Requester email | pso_simpl-4129@test.com |
| Onboarding Date | USER_ONBOARDING_DATE |
| Participant Credentials Expiration Date | Fri Nov 20 2026 |
@TCA06 @SIMPL-4128 @SIMPL-4129 @SIMPL-4134 @SIMPL-4135
Scenario Outline: Filtering of a Participant's Identity Attributes in the Governance Authority's Data Space: <caseName>
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 "NOTARY" role
And the user filters by "Participant Name" with value "PSO SIMPL 4129"
And the user clicks on the first result
And the Participant Details page is displayed
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>"
Examples:
| caseName | filter | value |
| Filtering by Name | Name | DATA_PROVIDER |
| Filtering by Code | Code | DATA_PROVIDER |
| Filtering by Date Range for the Last Update Date | Last Update Date | 01/01/2024 - 31/12/2025 |
| Filtering by Fixed Date for the Last Update Date | Last Update Date | 22/11/2024 - 22/11/2024 |
\ No newline at end of file
......@@ -2,24 +2,38 @@ package stepDefinitions.ui.simplOpen;
import com.microsoft.playwright.Locator;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.assertions.PlaywrightAssertions;
import com.microsoft.playwright.options.AriaRole;
import framework.ui.helpers.CalendarWidget;
import framework.ui.helpers.UiSetup;
import framework.ui.helpers.Utils;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
import static configuration.ui.data.simplOpen.Authority.*;
import static framework.common.Assertions.assertDateIsInRange;
import static framework.common.Assertions.assertEqualCollections;
import static framework.ui.locators.simplOpen.Authority.*;
import static framework.ui.locators.simplOpen.Authority.SEE_REQUEST_DETAILS_BUTTON_LOCATOR;
import static org.junit.Assert.*;
import static framework.ui.helpers.Utils.verifyElementIsVisibleByLocator;
import static framework.common.Assertions.assertElementIsVisibleByLocator;
public class AuthoritySteps {
public static final DateTimeFormatter DATE_CUCUMBER_INPUT = DateTimeFormatter.ofPattern("dd/MM/yyyy");
private final Page page = UiSetup.getPage();
private final String PARTICIPANT_PAGE_PARTICIPANT_LIST_HEADER = "Participant List";
private final String PARTICIPANT_PAGE_FILTER_BUTTON = "Filter";
......@@ -28,8 +42,11 @@ public class AuthoritySteps {
private final String PARTICIPANT_PAGE_REQUESTER_EMAIL_COLUMN = "Requester email";
private final String PARTICIPANT_PAGE_ONBOARDING_DATE_COLUMN = "Onboarding Date";
private final String ERROR_MESSAGE = "Invalid username or password.";
public static String NEW_USER = "";
public static String NEW_USER = "";
public static Boolean IS_PDF_SUBMITTED = false;
private final String PARTICIPANT_PAGE_FILTER_SELECT_COLUMN = "Select column";
private final String PARTICIPANT_PAGE_APPLY_FILTER_BUTTON = "Apply";
private final String PARTICIPANT_DETAILS_PAGE_HEADER = "Participant Details";
@Given("the user clicks the register for this dataspace button")
public void the_user_clicks_the_register_for_this_dataspace_button() {
......@@ -105,12 +122,12 @@ public class AuthoritySteps {
@Then("the successful message is displayed")
public void the_successful_message_is_displayed() {
verifyElementIsVisibleByLocator(page.locator(SUCCESSFUL_MESSAGE));
assertElementIsVisibleByLocator(page.locator(SUCCESSFUL_MESSAGE));
}
@Then("the user can see the submission form button")
public void the_user_can_see_submission_form_button() {
verifyElementIsVisibleByLocator(page.locator(SUBMISSION_FORM_BUTTON));
assertElementIsVisibleByLocator(page.locator(SUBMISSION_FORM_BUTTON));
}
@Then("the user can see the access credentials")
......@@ -137,7 +154,7 @@ public class AuthoritySteps {
case "Onboarding Status":
page.navigate(URL_AUTHORITY.concat(HOST_APPLICATION_ONBOARDING_STATUS));
break;
default :
default:
throw new IllegalArgumentException("Unknown page: " + pageName);
}
}
......@@ -151,7 +168,7 @@ public class AuthoritySteps {
userAndPassword = Utils.getUserNameAndPassword("ONBOARDING_DATAPARTICIPANT_REQUEST_SUBMITTED");
}
keycloakLogin(userAndPassword);
verifyElementIsVisibleByLocator(page.locator(ONBOARDING_STATUS_PANEL));
assertElementIsVisibleByLocator(page.locator(ONBOARDING_STATUS_PANEL));
}
@When("the user logs in with a user with {string} role")
......@@ -180,28 +197,28 @@ public class AuthoritySteps {
@Then("the list of onboarded participants for the data space is displayed")
public void theListOfOnboardedParticipantsForTheDataSpaceIsDisplayed() {
verifyElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_PARTICIPANT_LIST_HEADER));
verifyElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_FILTER_BUTTON));
verifyElementIsVisibleByLocator(page.locator(PARTICIPANT_LIST_TABLE));
verifyElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_PARTICIPANT_NAME_COLUMN));
verifyElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_PARTICIPANT_TYPE_COLUMN));
verifyElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_REQUESTER_EMAIL_COLUMN));
verifyElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_ONBOARDING_DATE_COLUMN));
assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_PARTICIPANT_LIST_HEADER));
assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_FILTER_BUTTON));
assertElementIsVisibleByLocator(page.locator(PARTICIPANT_LIST_TABLE));
assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_PARTICIPANT_NAME_COLUMN));
assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_PARTICIPANT_TYPE_COLUMN));
assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_REQUESTER_EMAIL_COLUMN));
assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_ONBOARDING_DATE_COLUMN));
}
@Then("^the application status summary page (shows|does not show) the status request is \"(.*)\" with a \"(.*)\" icon$")
public void status_summary_page_shows_the_status(String isDiplayed, String status, String icon) {
verifyElementIsVisibleByLocator(page.locator(ONBOARDING_REQUESTS_PANEL));
assertElementIsVisibleByLocator(page.locator(ONBOARDING_REQUESTS_PANEL));
switch (status) {
case "Request submitted":
if (!page.locator(GREEN_ICON_LOCATOR).first().isVisible() ) {
if (!page.locator(GREEN_ICON_LOCATOR).first().isVisible()) {
throw new RuntimeException("the status did not match");
}
break;
case "In Progress":
if (isDiplayed.equals("does not show") && icon.equals("green")) {
verifyElementIsVisibleByLocator(page.locator(GREY_ICON_LOCATOR_2));
assertElementIsVisibleByLocator(page.locator(GREY_ICON_LOCATOR_2));
} else if (isDiplayed.equals("show") && icon.equals("green") && (IS_PDF_SUBMITTED)) {
if (!page.locator(GREEN_ICON_LOCATOR).nth(2).isVisible()) {
throw new RuntimeException("the status did not match");
......@@ -210,19 +227,18 @@ public class AuthoritySteps {
break;
case "Request accepted":
if (isDiplayed.equals("does not show") && icon.equals("grey") && (!IS_PDF_SUBMITTED)) {
verifyElementIsVisibleByLocator(page.locator(GREY_ICON_LOCATOR_2));
assertElementIsVisibleByLocator(page.locator(GREY_ICON_LOCATOR_2));
} else if (isDiplayed.equals("show") && icon.equals("grey") && (IS_PDF_SUBMITTED)) {
verifyElementIsVisibleByLocator(page.locator(GREY_ICON_LOCATOR_3));
assertElementIsVisibleByLocator(page.locator(GREY_ICON_LOCATOR_3));
}
}
}
@Then("the applicant dataspace participant user can open the request status details dialog pressing See request details button")
public void the_user_can_see_the_request_status_details_dialog()
{
public void the_user_can_see_the_request_status_details_dialog() {
assertThat(page.locator(SEE_REQUEST_DETAILS_BUTTON_LOCATOR)).isEnabled();
page.locator(SEE_REQUEST_DETAILS_BUTTON_LOCATOR).click();
verifyElementIsVisibleByLocator(page.locator(REQUEST_STATUS_DETAILS_DIALOG));
assertElementIsVisibleByLocator(page.locator(REQUEST_STATUS_DETAILS_DIALOG));
page.locator(REQUEST_STATUS_DETAILS_DIALOG).click();
}
......@@ -237,4 +253,129 @@ public class AuthoritySteps {
assert (page.locator(ERROR_MESSAGE_LOCATOR).textContent()).contains(ERROR_MESSAGE);
}
@When("the user filters by {string} with value {string}")
public void theUserFiltersByWithValue(String filter, String value) {
assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_FILTER_BUTTON));
page.getByText(PARTICIPANT_PAGE_FILTER_BUTTON).click();
page.getByText(PARTICIPANT_PAGE_FILTER_SELECT_COLUMN).click();
List<Locator> dropdownOptions = page.locator(PARTICIPANT_LIST_FILTER_DROPDOWN_OPTIONS).all();
switch (filter) {
case "Participant Name":
case "Name":
dropdownOptions.get(0).click();
page.locator(PARTICIPANT_LIST_FILTER_INPUT).fill(value);
break;
case "Participant Type":
case "Code":
dropdownOptions.get(1).click();
page.locator(PARTICIPANT_LIST_FILTER_INPUT).fill(value);
break;
case "Email":
dropdownOptions.get(2).click();
page.locator(PARTICIPANT_LIST_FILTER_INPUT).fill(value);
break;
case "Last Update Date":
dropdownOptions.get(2).click();
String[] range = value.split("-");
LocalDate startDate = LocalDate.parse(range[0].strip(), DATE_CUCUMBER_INPUT);
LocalDate endDate = LocalDate.parse(range[1].strip(), DATE_CUCUMBER_INPUT);
CalendarWidget.selectDateRange(page, startDate, endDate);
break;
case "Onboarding Date":
dropdownOptions.get(3).click();
LocalDate onboardingDate = LocalDate.parse(value, DATE_CUCUMBER_INPUT);
CalendarWidget.selectDate(page, onboardingDate);
break;
default:
throw new IllegalArgumentException("Unknown filter: " + filter);
}
page.getByText(PARTICIPANT_PAGE_APPLY_FILTER_BUTTON).click();
}
@When("the user clicks on the first result")
public void theUserClicksOnTheFirstResult() {
Locator participantRows = page.locator(PARTICIPANT_LIST_TABLE_ROWS);
assertElementIsVisibleByLocator(participantRows);
participantRows.all().get(0).click();
}
@Then("the Participant Details page is displayed")
public void theParticipantDetailsPageIsDisplayed() {
assertThat(page.getByRole(AriaRole.HEADING)).hasText(PARTICIPANT_DETAILS_PAGE_HEADER);
}
@Then("the following details are displayed")
public void theFollowingDetailsAreDisplayed(DataTable dataTable) {
Map<String, String> map = dataTable.asMap(String.class, String.class);
HashMap<String, String> details = new HashMap<>(map);
String identifier = details.get("Identifier");
String onboardingDate = details.get("Onboarding Date");
if ("USER_IDENTIFIER".equals(identifier)) {
details.put("Identifier", USER_PSO_SIMPL_4129_IDENTIFIER);
}
if ("USER_ONBOARDING_DATE".equals(onboardingDate)) {
details.put("Onboarding Date", USER_PSO_SIMPL_4129_ONBOARDING_DATE);
}
List<String> expectedValues = new ArrayList<>(details.values());
List<String> realValues = page.locator(PARTICIPANT_DETAILS_COLUMNS).allTextContents();
realValues.replaceAll(String::strip);
assertEqualCollections(expectedValues, realValues);
}
@Then("the list of Identity Attributes for the participant is displayed")
public void theListOfIdentityAttributesForTheParticipantIsDisplayed() {
assertElementIsVisibleByLocator(page.getByRole(AriaRole.TABLE));
List<String> tableHeaders =
page.locator(PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_HEADER_COLUMNS).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_LAST_CHANGE_DATE_COLUMN);
tableHeaders.replaceAll(String::strip);
assertEqualCollections(expectedHeaders, tableHeaders);
}
@Then("the identity attributes shown have {string} matching {string}")
public void theIdentityAttributesShownHaveFilterMatchingValue(String filter, String value) {
assertElementIsVisibleByLocator(page.locator(PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE));
switch (filter) {
case "Name":
Locator nameResults = page.locator(PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_NAME_COLUMN);
if (nameResults.first().isVisible()) {
nameResults.all().forEach(row -> assertThat(row).containsText(value));
} else {
throw new AssertionError("The chosen participant does not have identity attributes assigned.");
}
break;
case "Code":
Locator codeResults = page.locator(PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_CODE_COLUMN);
if (codeResults.first().isVisible()) {
codeResults.all().forEach(row -> assertThat(row).containsText(value));
} else {
throw new AssertionError("The chosen participant does not have identity attributes assigned.");
}
break;
case "Last Update Date":
Locator lastUpdateDateResults =
page.locator(PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_LAST_UPDATE_DATE_COLUMN);
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))));
} else {
throw new AssertionError("The chosen participant does not have identity attributes assigned.");
}
break;
default:
throw new IllegalArgumentException("Unknown filter: " + filter);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment