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

Skip to content
Snippets Groups Projects
Commit 12098734 authored by Adolfo Han's avatar Adolfo Han Committed by Jaime Pérez-Lozana
Browse files

Soui simpl 3057

parent 1b965534
No related branches found
No related tags found
No related merge requests found
......@@ -90,4 +90,13 @@ public class Assertions {
assertTrue("Value expected (" + valueExpected + ") is greater than " + value, valueExpected <= value);
}
/**
* This method verifies value expected is equals or less than the real value.
*
* @param valueExpected Value expected
* @param value Value retrieved from locator/element
*/
public static void assertElementEqualsOrGreater(Integer value, Integer valueExpected) {
assertTrue("Value expected (" + valueExpected + ") is lesser than " + value, valueExpected >= value);
}
}
......@@ -84,8 +84,8 @@ public final class Utils {
/**
* Utility method to check if an input field contains the specified text.
*
* @param page The Playwright {@link Page} object representing the browser page.
* @param selector The CSS selector used to locate the input field.
* @param page The Playwright {@link Page} object representing the browser page.
* @param selector The CSS selector used to locate the input field.
* @param expectedText The text that should be present in the input field.
*/
public static void checkInputFieldHasText(Page page, String selector, String expectedText) {
......@@ -103,7 +103,7 @@ public final class Utils {
*/
public static void verifyTableListDisplayTheResultsExpected(Integer numberValue, Locator locatorValue) {
List<String> stringsInColumns = locatorValue.allTextContents();
Assertions.assertElementEqualsOrLess(stringsInColumns.size(), numberValue);
Assertions.assertElementEqualsOrGreater(stringsInColumns.size(), numberValue);
}
/**
......
......@@ -52,8 +52,8 @@ public class Authority {
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";
public static final String REQUEST_EMAIL_COLUMN__FORM_REQUEST_LIST_TABLE_LOCATOR = "td.mat-mdc-cell.mdc-data-table__cell." +
"cdk-cell.cdk-column-email.mat-column-email";
public static final String REQUEST_EMAIL_COLUMN__FORM_REQUEST_LIST_TABLE_LOCATOR = "//td[contains(translate(@class, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', " +
"'abcdefghijklmnopqrstuvwxyz'), 'email')]";
public static final String REQUEST_LAST_CHANGE_DATE_COLUMN__FORM_REQUEST_LIST_TABLE_LOCATOR = "td.mat-mdc-cell.mdc-data-table__cell.cdk-cell" +
".cdk-column-updateTimestamp.mat-column-updateTimestamp";
public static final String REQUEST_DATE_COLUMN__FORM_REQUEST_LIST_TABLE_LOCATOR = "td.mat-mdc-cell.mdc-data-table__cell.cdk-cell" +
......@@ -89,6 +89,8 @@ public class Authority {
public static final String ITEMS_PER_PAGE_TEXT_FIELD = ".mat-mdc-paginator-range-label";
public static final String NEXT_PAGE_BUTTON_LOCATOR = "button[aria-label='Next page'] span[class='mat-mdc-button-touch-target']";
public static final String PREVIOUS_PAGE_BUTTON_LOCATOR = "button[aria-label='Previous page'] span[class='mat-mdc-button-touch-target']";
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 Authority() {
......
......@@ -12,8 +12,7 @@ import java.util.Collections;
import java.util.List;
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
import static framework.common.Assertions.assertElementIsNotVisibleByLocator;
import static framework.common.Assertions.assertElementIsVisibleByLocator;
import static framework.common.Assertions.*;
import static framework.ui.locators.simplOpen.Authority.*;
public class AuthorityPage {
......@@ -249,13 +248,25 @@ public class AuthorityPage {
}
/**
* This method verifies the number of results shown in page are displayed in the "Dashboard Requests List" table
* It should be equal or less than the number selected in "Items per page"
* This method verifies the number of results shown in the specified table.
* It should be equal to or less than the number selected in "Items per page".
*
* @param numberValueByPage: Number of items expected
* @param listType The type of list to verify (e.g., "Dashboard Requests List", "Participant List").
* @param numberValueByPage Number of items expected.
*/
public void verifyNumberOfResultsDisplayedInTheRequestsList(Integer numberValueByPage) {
Utils.verifyTableListDisplayTheResultsExpected(numberValueByPage, page.locator(REQUEST_STATUS_COLUMN_FROM_REQUEST_LIST_TABLE_LOCATOR));
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);
}
Utils.verifyTableListDisplayTheResultsExpected(numberValueByPage, locatorValue);
}
private void sortAscending(Locator columnLocatorValue, Locator arrowLocatorValue) {
......@@ -319,7 +330,8 @@ public class AuthorityPage {
break;
default:
throw new IllegalArgumentException("Invalid buttonToPress value: " + buttonToPress);
};
}
assertElementIsVisibleByLocator(buttonLocator);
page.waitForSelector(REQUEST_EMAIL_COLUMN__FORM_REQUEST_LIST_TABLE_LOCATOR);
......@@ -332,12 +344,18 @@ public class AuthorityPage {
if (compareLists) {
page.waitForSelector(REQUEST_EMAIL_COLUMN__FORM_REQUEST_LIST_TABLE_LOCATOR);
List<String> newStringsInColumns = page.locator(REQUEST_EMAIL_COLUMN__FORM_REQUEST_LIST_TABLE_LOCATOR).allTextContents();
Assertions.assertElementEqualsOrLess(previousStringsInColumns.size(), newStringsInColumns.size());
if (buttonToPress.equals("Next page")) {
Assertions.assertElementEqualsOrLess(previousStringsInColumns.size(), newStringsInColumns.size());
} else {
Assertions.assertElementEqualsOrGreater(previousStringsInColumns.size(), newStringsInColumns.size());
}
if (previousStringsInColumns.equals(newStringsInColumns)) {
throw new AssertionError("After pagination, the items in the lists are the same; it has not been updated correctly.");
}
}
}
}
}
}
......@@ -141,9 +141,9 @@ Feature: Authority
Then the onboarding requests list shows "<filter>" matching "<value>"
Examples:
| caseName | filter | value |
| Filtering by Status Approved | status | Approved |
| Filtering by Email | email | dataparticipant_req_inprogress@automation.com |
| caseName | filter | value |
| Filtering by Status Approved | status | Approved |
| Filtering by Email | email | dataparticipant_req_inprogress@automation.com |
@TCA11 @SIMPL-767
Scenario Outline: Verify Request Status of Onboarding Requesters: <caseName>
......@@ -327,9 +327,9 @@ Feature: Authority
And the user logs in with a user with "NOTARY" role
And the onboarding requests list is displayed
When the user selects <numberValueByPage> items per page from the dropdown list
And the request list is updated with a maximum of <numberValueByPage> results
Then the user updates the request list by trying to click the "Next page" button
And the user updates the request list by trying to click the "Previous page" button
And the "Dashboard Requests List" is updated with a maximum of <numberValueByPage> results
Then the user updates the list by trying to click the "Next page" button
And the user updates the list by trying to click the "Previous page" button
Examples:
| caseName | numberValueByPage |
......@@ -337,3 +337,25 @@ Feature: Authority
| The user selects 10 elements by page | 10 |
| The user selects 25 elements by page | 25 |
| The user selects 100 elements by page | 100 |
@TCA24 @SIMPL-3057 @SIMPL-3058 @SIMPL-3059
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 "NOTARY" role
Then the page displays a table with the following column headings:
| Participant Name |
| Participant type |
| Requester email |
| Onboarding Date |
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 list by trying to click the "Next page" button
And the user updates the 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
......@@ -45,7 +45,7 @@ public class AuthoritySteps {
@Given("the applicant request user already created the request as {string}")
public void the_user_fills_the_request_form(String participantType) {
// NOTE: Once API is done, this should be changed to that instead of working with the UI
commonSteps.theUserNavigatesToThePage("Welcome to Dataspace Info");
commonSteps.the_user_navigates_to_the_page("Welcome to Dataspace Info");
the_user_clicks_the_register_for_this_dataspace_button();
the_user_enters_the_email_address();
theUserInsertsTheOrganization();
......@@ -76,7 +76,7 @@ public class AuthoritySteps {
@Given("^the applicant with (pdf submitted|pdf not submitted) is in the onboarding status page$")
public void the_applicant_is_in_the_onboarding_status_page(String pdfIsSubmitted) {
commonSteps.theUserNavigatesToThePage("Onboarding Status");
commonSteps.the_user_navigates_to_the_page("Onboarding Status");
IS_PDF_SUBMITTED = pdfIsSubmitted.equals("pdf submitted");
}
......@@ -296,20 +296,20 @@ public class AuthoritySteps {
assertThat(updateAlert).hasText(SUCCESSFUL_IDENTITY_ATTRIBUTE_EDITION_ALERT_MESSAGE);
}
@When("^the user selects (\\d+) items per page from the dropdown list$")
public void the_user_selects_the_number_of_values_to_display_per_page(Integer numberValueByPage) {
@When("the user selects {int} items per page from the dropdown list")
public void the_user_selects_number_value_by_page_items_per_page_from_the_dropdown_list(Integer numberValueByPage) {
authorityPage.verifyThePaginationElementsAreVisible();
authorityPage.itemsPerPageSelectionInTableDropdown(numberValueByPage);
}
@Then("^the request list is updated with a maximum of (\\d+) results$")
public void theRequestListIsUpdatedShowingAMaximumNumberOfResultsPerPage(Integer numberValueByPage) {
@Then("the {string} is updated with a maximum of {int} results")
public void theRequestListIsUpdatedShowingAMaximumNumberOfResultsPerPage(String listType, Integer numberValueByPage) {
assertElementIsVisibleByLocator(page.locator(FILTER_TABLE));
authorityPage.verifyNumberOfResultsDisplayedInTheRequestsList(numberValueByPage);
authorityPage.verifyNumberOfResultsDisplayedInTheList(listType, numberValueByPage);
}
@Then("the list of onboarded participants for the data space is displayed")
public void theListOfOnboardedParticipantsForTheDataSpaceIsDisplayed() {
public void the_list_of_onboarded_participants_for_the_data_space_is_displayed() {
assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_PARTICIPANT_LIST_HEADER));
assertElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_FILTER_BUTTON));
assertElementIsVisibleByLocator(page.locator(PARTICIPANT_LIST_TABLE));
......@@ -640,7 +640,7 @@ public class AuthoritySteps {
}
@Then("the onboarding request list is sorted successfully by {string}")
public void verify_the_dates_values_of_the_column_were_sorted(String columnToSort ) {
public void verify_the_dates_values_of_the_column_were_sorted(String columnToSort) {
authorityPage.verifyTheDatesValuesOfTheColumnWereSorted(columnToSort);
}
......@@ -655,12 +655,27 @@ public class AuthoritySteps {
}
@Then("^the user tries to click the \"(Next page|Previous page)\" button$")
public void theUserTriesToClickTheButton(String button) throws InterruptedException {
public void theUserTriesToClickTheButton(String button) {
authorityPage.clickNextOrPreviousPageButton(button, false);
}
@Then("^the user updates the request list by trying to click the \"(Next page|Previous page)\" button$")
public void theUserUpdatesTheListTryingToClickTheButton(String button) throws InterruptedException {
@Then("^the user updates the list by trying to click the \"(Next page|Previous page)\" button$")
public void theUserUpdatesTheListTryingToClickTheButton(String button) {
authorityPage.clickNextOrPreviousPageButton(button, true);
}
@Then("the page displays a table with the following column headings:")
public void the_page_displays_a_table_with_the_following_column_headings(List<String> expectedHeadings) {
page.waitForSelector(COLUMN_HEADING_LOCATOR);
List<String> actualHeadings = page.locator(COLUMN_HEADING_LOCATOR).allTextContents();
actualHeadings.replaceAll(String::trim);
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)
);
}
}
}
}
......@@ -17,7 +17,7 @@ public class CommonSteps {
private final String ERROR_MESSAGE = "Invalid username or password.";
@When("the (dataspace governance authority )user navigates to the {string} page")
public void theUserNavigatesToThePage(String pageName) {
public void the_user_navigates_to_the_page(String pageName) {
getURLByPageName(pageName);
}
......@@ -39,7 +39,7 @@ public class CommonSteps {
}
@When("the user logs in with a user with {string} role")
public void theUserLogsInWithAUserWithRole(String role) {
public void the_user_logs_in_with_a_user_with_role(String role) {
Utils.LogInDetails userAndPassword = Utils.getUserAndPasswordByRole(role);
keycloakLogin(userAndPassword);
}
......
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