From eddc431578afbc73c3b3abecc4269368e0c5d353 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaime=20P=C3=A9rez-Lozana?= <jperezlozana@minsait.com>
Date: Fri, 28 Feb 2025 18:42:29 +0100
Subject: [PATCH] Maintainance ui tests

---
 .../ui/data/simplOpen/Authority.java          | 12 ++--
 .../ui/data/simplOpen/Participant.java        |  8 +--
 src/main/java/framework/ui/helpers/Utils.java |  8 +--
 .../ui/pages/simplOpen/AuthorityPage.java     | 57 +++++++++++--------
 .../features/ui/simplOpen/Authority.feature   | 35 ++++++------
 .../features/ui/simplOpen/Participant.feature | 19 +++----
 .../ui/simplOpen/AuthoritySteps.java          | 17 +++---
 .../ui/simplOpen/CommonSteps.java             |  2 +
 .../ui/simplOpen/ParticipantSteps.java        |  2 +
 9 files changed, 86 insertions(+), 74 deletions(-)

diff --git a/src/main/java/configuration/ui/data/simplOpen/Authority.java b/src/main/java/configuration/ui/data/simplOpen/Authority.java
index 6d030b3d..d0c1ca68 100644
--- a/src/main/java/configuration/ui/data/simplOpen/Authority.java
+++ b/src/main/java/configuration/ui/data/simplOpen/Authority.java
@@ -25,12 +25,12 @@ public class Authority {
     public static final String AUTHORITY_T2IAA_M_USER = "authority_role_t2iaa_m_auto";
     public static final String GENERAL_PASSWORD = "password";
     public static final String ONBOARDING_DATAPARTICIPANT_REQUEST_SUBMITTED_USER = "dataparticipant_request_submitted@automation.com";
-    public static final String ONBOARDING_DATAPARTICIPANT_REQUEST_INPROGRESS_USER = "dataparticipant_request_inprogress@automation.com";
+    public static final String ONBOARDING_DATAPARTICIPANT_REQUEST_INPROGRESS_USER = "dataparticipant_request_inprogress@psoautomation.com";
     public static final String ONBOARDING_DATAPARTICIPANT_REQUEST_ACCEPTED_USER = "dataparticipant_request_accepted@automation.com";
     public static final String ONBOARDING_DATAPARTICIPANT_REQUEST_REJECTED_USER = "dataparticipant_request_rejected@automation.com";
     public static final String ONBOARDING_DATAPARTICIPANT_PASSWORD = "Testing2@14";
-    public static final String USER_PSO_SIMPL_3049_IDENTIFIER = "019503b3-5354-7c15-acdb-72cdee021db0";
-    public static final String USER_PSO_SIMPL_3049_ONBOARDING_DATE = "Fri Feb 14 2025";
+    public static final String USER_PSO_SIMPL_3049_IDENTIFIER = "019546d1-b5d4-7932-a094-b9f81eb555c5";
+    public static final String USER_PSO_SIMPL_3049_ONBOARDING_DATE = "Thu Feb 27 2025";
     public static final String USER_PSO_SIMPL_3049_CREDENTIALS_EXPIRATION_DATE = "-";
     public static final String REQUESTS_LIST_TITLE = "Request list";
     public static final String REQUESTS_LIST_TABLE_REQUEST_STATUS_COLUMN = "Request status";
@@ -70,10 +70,10 @@ public class Authority {
     public static final String ALERT_DISPLAYING_SUCCESSFUL_REJECTED = "You successfully reject this request.";
 
     public static final String[] PARTICIPANT_TYPES = {
-        "Consumer",
+        "Application Provider",
         "Data Provider",
-        "Infrastructure Provider",
-        "Application Provider"
+        "Consumer",
+        "Infrastructure Provider"
     };
 
     public Authority() {
diff --git a/src/main/java/configuration/ui/data/simplOpen/Participant.java b/src/main/java/configuration/ui/data/simplOpen/Participant.java
index fe1ee77d..079464f4 100644
--- a/src/main/java/configuration/ui/data/simplOpen/Participant.java
+++ b/src/main/java/configuration/ui/data/simplOpen/Participant.java
@@ -12,15 +12,15 @@ public class Participant {
     public static final String HOST_ECHO = "echo";
     public static final String CONSUMER_T1UAR_M_USER = "consumer_role_t1uar_m_auto";
     public static final String CONSUMER_ONBOARDER_M_USER = "consumer_role_onboarder_m_auto";
-    public static final String CONSUMER_CATALOG_R_USER = "consumer_role_catalog_r_auto";
+    public static final String CONSUMER_SD_CONSUMER_USER = "consumer_role_sd_consumer_auto";
     public static final String NO_ROLES_USER = "no_roles_user_auto";
     public static final String ECHO_BUTTON_TEXT = "Echo";
     public static final String UPLOAD_CREDENTIAL_BUTTON_TEXT = "Upload credential";
     public static final String ECHO_PAGE_HEADER = "/echo";
-    public static final String ONBOARDED_CONSUMER_ID = "01944b4a-d3a2-783e-b1e6-f6c186129203";
-    public static final String ONBOARDED_DATA_PROVIDER_ID = "01946fc7-aae2-76cd-8294-02bb2ecaeacd";
+    public static final String ONBOARDED_CONSUMER_ID = "01953d82-5efb-7fd9-97bd-074ced88b7b8";
+    public static final String ONBOARDED_DATA_PROVIDER_ID = "01953d7a-a1cd-7781-81a0-463d2f009f91";
     public static final String DATA_PROVIDER_T1UAR_M_USER = "dataprovider_role_t1uar_m_auto";
     public static final String DATA_PROVIDER_ONBOARDER_M_USER = "dataprovider_role_onboarder_m_auto";
-    public static final String DATA_PROVIDER_CATALOG_R_USER = "dataprovider_role_catalog_r_auto";
+    public static final String DATA_PROVIDER_SD_PUBLISHER_USER = "dataprovider_role_sd_publisher_auto";
 
 }
diff --git a/src/main/java/framework/ui/helpers/Utils.java b/src/main/java/framework/ui/helpers/Utils.java
index 128eec01..6424d415 100644
--- a/src/main/java/framework/ui/helpers/Utils.java
+++ b/src/main/java/framework/ui/helpers/Utils.java
@@ -141,8 +141,8 @@ public final class Utils {
                 user = CONSUMER_ONBOARDER_M_USER;
                 password = GENERAL_PASSWORD;
                 break;
-            case "CONSUMER_CATALOG_R":
-                user = CONSUMER_CATALOG_R_USER;
+            case "CONSUMER_SD_CONSUMER":
+                user = CONSUMER_SD_CONSUMER_USER;
                 password = GENERAL_PASSWORD;
                 break;
             case "NO ROLE":
@@ -157,8 +157,8 @@ public final class Utils {
                 user = DATA_PROVIDER_ONBOARDER_M_USER;
                 password = GENERAL_PASSWORD;
                 break;
-            case "DATA_PROVIDER_CATALOG_R":
-                user = DATA_PROVIDER_CATALOG_R_USER;
+            case "DATA_PROVIDER_SD_PUBLISHER":
+                user = DATA_PROVIDER_SD_PUBLISHER_USER;
                 password = GENERAL_PASSWORD;
                 break;
             default:
diff --git a/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java b/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java
index 47d024bf..b74090fc 100644
--- a/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java
+++ b/src/main/java/framework/ui/pages/simplOpen/AuthorityPage.java
@@ -15,7 +15,6 @@ import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertTha
 import static configuration.ui.data.simplOpen.Authority.*;
 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;
 
@@ -324,23 +323,21 @@ public class AuthorityPage {
      *
      * @param columnToSort
      */
-    public void verifyTheDatesValuesOfTheColumnWereSorted(String columnToSort) {
-        switch (columnToSort) {
-            case "Last change date":
-                compareTwoListsAreEquals(page.locator(REQUEST_LAST_CHANGE_DATE_COLUMN_FORM_REQUEST_LIST_TABLE_LOCATOR));
-                break;
-            case "Request Date":
-                compareTwoListsAreEquals(page.locator(REQUEST_DATE_COLUMN_FORM_REQUEST_LIST_TABLE_LOCATOR));
-                break;
-            case "Participant Type":
-                compareTwoListsAreEquals(page.locator(PARTICIPANT_TYPE_COLUMN_FROM_PARTICIPANT_LIST_TABLE_LOCATOR));
-                break;
-            case "Onboarding Date":
-                compareTwoListsAreEquals(page.locator(ONBOARDING_DATE_COLUMN_FROM_PARTICIPANT_LIST_TABLE_LOCATOR));
-                break;
-            default:
-                throw new IllegalArgumentException("Unknown column to verify: ".concat(columnToSort));
+    public void verifyColumnSorting(String sortDirection, String columnToSort) {
+        Map<String, Locator> columnLocators = Map.of(
+                "Last change date", page.locator(REQUEST_LAST_CHANGE_DATE_COLUMN_FORM_REQUEST_LIST_TABLE_LOCATOR),
+                "Request Date", page.locator(REQUEST_DATE_COLUMN_FORM_REQUEST_LIST_TABLE_LOCATOR),
+                "Participant Type", page.locator(PARTICIPANT_TYPE_COLUMN_FROM_PARTICIPANT_LIST_TABLE_LOCATOR),
+                "Onboarding Date", page.locator(ONBOARDING_DATE_COLUMN_FROM_PARTICIPANT_LIST_TABLE_LOCATOR)
+        );
+
+        Locator columnLocator = columnLocators.get(columnToSort);
+
+        if (columnLocator == null) {
+            throw new IllegalArgumentException("Unknown column to verify: " + columnToSort);
         }
+
+        verifyColumnSortingByLocator(sortDirection, columnLocator);
     }
 
     /***
@@ -348,13 +345,25 @@ public class AuthorityPage {
      * The method use the Collections Api library
      * In this case the locator is passed to obtain the values of the first list
      */
-    public void compareTwoListsAreEquals(Locator locatorValue) {
-        List<String> dates = locatorValue.allTextContents();
-        List<String> listOfValueToSort = new ArrayList<>(dates);
-        Collections.sort(listOfValueToSort);
+    public void verifyColumnSortingByLocator(String sortDirection, Locator locatorValue) {
+        List<String> listFromLocator = locatorValue.allTextContents();
+
+        if (listFromLocator.isEmpty()) {
+            throw new IllegalArgumentException("The column list is empty. Cannot verify sorting.");
+        }
+
+        List<String> sortedList = new ArrayList<>(listFromLocator);
+
+        if ("ascending".equalsIgnoreCase(sortDirection)) {
+            sortedList.sort(String::compareTo);
+        } else if ("descending".equalsIgnoreCase(sortDirection)) {
+            sortedList.sort(Collections.reverseOrder(String::compareTo));
+        } else {
+            throw new IllegalArgumentException("Invalid sort direction: " + sortDirection + ". Use 'ascending' or 'descending'.");
+        }
 
-        if (!listOfValueToSort.equals(dates)) {
-            throw new IllegalArgumentException("The lists are not equal.");
+        if (!listFromLocator.equals(sortedList)) {
+            throw new AssertionError("The column is not sorted in " + sortDirection + " order.");
         }
     }
 
@@ -485,7 +494,7 @@ public class AuthorityPage {
         List<String> columnValues = columnLocator.allTextContents();
         int rowSize = columnLocator.count();
         if (columnName.equals("Action")) {
-            for (int i = 1; i <= rowSize; i++) {
+            for (int i = 0; i < rowSize; i++) {
                 String spanValue = columnValues.get(i).trim();
                 String roleValue = columnLocator.nth(i).getAttribute("role");
                 assertTrue(String.format("No 'Delete' buttons found in column '%s'", columnName), "delete".equals(spanValue));
diff --git a/src/test/java/features/ui/simplOpen/Authority.feature b/src/test/java/features/ui/simplOpen/Authority.feature
index 30290925..3ced80e0 100644
--- a/src/test/java/features/ui/simplOpen/Authority.feature
+++ b/src/test/java/features/ui/simplOpen/Authority.feature
@@ -130,11 +130,11 @@ Feature: Authority
     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 | 14/02/2025 - 14/02/2025 |
+      | caseName                                         | filter           | value                              |
+      | Filtering by Name                                | Name             | Assignable Test Identity Attribute |
+      | Filtering by Code                                | Code             | assignable_test_identity_attribute |
+      | 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 | 27/02/2025 - 27/02/2025            |
 
   @TCA10 @SIMPL-652 @SIMPL-651 @SIMPL-653 @SIMPL-601 @SIMPL-602 @SIMPL-604
   Scenario Outline: Filter onboarding requests: <caseName>
@@ -145,9 +145,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_request_inprogress@automation.com |
+      | caseName                     | filter | value                                           |
+      | Filtering by Status Approved | status | Approved                                        |
+      | Filtering by Email           | email  | dataparticipant_request_rejected@automation.com |
 
   @TCA11 @SIMPL-767
   Scenario Outline: Verify Request Status of Onboarding Requesters: <caseName>
@@ -158,10 +158,10 @@ Feature: Authority
     Then the onboarding requests list shows "status" matching "<status>"
 
     Examples:
-      | caseName                      | email                                             | status      |
-      | Email with In Progress Status | dataparticipant_request_inprogress@automation.com | In Progress |
-      | Email with Approved Status    | dataparticipant_request_accepted@automation.com   | Approved    |
-      | Email with Rejected Status    | dataparticipant_request_rejected@automation.com   | Rejected    |
+      | caseName                      | email                                                | status      |
+      | Email with In Progress Status | dataparticipant_request_inprogress@psoautomation.com | In Progress |
+      | Email with Approved Status    | dataparticipant_request_accepted@automation.com      | Approved    |
+      | Email with Rejected Status    | dataparticipant_request_rejected@automation.com      | Rejected    |
 
 #  @TCA12 @SIMPL-1128 @SIMPL-1080
 #  # TODO: Check download credentials.
@@ -183,10 +183,7 @@ Feature: Authority
 #      |                 |
 #      | rejected        |
 
-  @TCA14 @SIMPL-617 @SIMPL-612 @SIMPL-608 @SIMPL-609 @SIMPL-614 @SIMPL-618 @SIMPL-1081  @bug:SIMPL-9566 @SIMPL-619
-  # Now "In Progress status" does no longer show participants with a PDF file submitted.Scenario.Scenario
-  # Filtering by Status in Progress and Approve/Reject the request is now no longer valid (SIMPL-617)
-  # Now the new status seems to be "In_Review" BUT is not appearing in the filters.
+  @TCA14 @SIMPL-617 @SIMPL-612 @SIMPL-608 @SIMPL-609 @SIMPL-614 @SIMPL-618 @SIMPL-1081 @SIMPL-619 @bug:SIMPL-9566
   Scenario Outline: Confirm filtering by Status in Progress and <button> the request
     #  NOTE: Once API is done, the following two steps should be changed/deleted, at least while bugs are still affecting the flow.
     Given the applicant request user already created the request as "<Participant type>"
@@ -323,8 +320,9 @@ Feature: Authority
   Scenario Outline: User sorts onboarding requests by <columnToSort> in <sortDirection> order
     Given the user navigates to the "Dashboard Requests List" page
     And the user logs in with a user with "NOTARY" role
+    And the onboarding requests list is displayed
     When the user sorts by "<sortDirection>" "<columnToSort>"
-    Then the "onboarding request list" is sorted successfully by "<columnToSort>"
+    Then the "onboarding request list" is sorted successfully by "<sortDirection>" "<columnToSort>"
     Examples:
       | sortDirection | columnToSort     |
       | ascending     | Last change date |
@@ -441,8 +439,9 @@ Feature: Authority
   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
+    And the "list of onboarded participants" for the data space is displayed
     When the user sorts by "<sortDirection>" "<columnToSort>"
-    Then the "participant list requests" is sorted successfully by "<columnToSort>"
+    Then the "participant list requests" is sorted successfully by "<sortDirection>" "<columnToSort>"
 
     Examples:
       | sortDirection | columnToSort     |
diff --git a/src/test/java/features/ui/simplOpen/Participant.feature b/src/test/java/features/ui/simplOpen/Participant.feature
index 64e3684d..ac0f16ae 100644
--- a/src/test/java/features/ui/simplOpen/Participant.feature
+++ b/src/test/java/features/ui/simplOpen/Participant.feature
@@ -7,7 +7,6 @@ Feature: Participant
     And the user is redirected to the "<keycloak>" keycloak
     And the user logs in with a user with "<role>" role
     And the user sees the "Echo" button
-    And the user <buttonVisibility> the "Upload credential" button
     When the user clicks on the "Echo" button
     Then the Echo page is displayed
     And the following information about the user's identity token is displayed:
@@ -21,15 +20,15 @@ Feature: Participant
     And the mTLS status is "SECURED"
 
     Examples:
-      | caseName                                    | participantUtility                | keycloak      | role                      | buttonVisibility | username                           | emailAddress                               | commonName                 | organisation | participantType | assignedIdentityAttributes |
-      | Consumer - User with role: ONBOARDER_M      | Consumer Participant Utility      | Consumer      | CONSUMER_ONBOARDER_M      | sees             | consumer_role_onboarder_m_auto     | consumer_role_onboarder_m_auto@pso.com     | ONBOARDED_CONSUMER_ID      | PSO          | CONSUMER        | CONSUMER                   |
-      | Consumer - User with role: CATALOG_R        | Consumer Participant Utility      | Consumer      | CONSUMER_CATALOG_R        | does not see     | consumer_role_catalog_r_auto       | consumer_role_catalog_r_auto@pso.com       |                            |              |                 |                            |
-      | Consumer - User with role: T1UAR_M          | Consumer Participant Utility      | Consumer      | CONSUMER_T1UAR_M          | does not see     | consumer_role_t1uar_m_auto         | consumer_role_t1uar_m_auto@pso.com         |                            |              |                 |                            |
-      | Consumer - User with no roles assigned      | Consumer Participant Utility      | Consumer      | NO ROLE                   | does not see     | no_roles_user_auto                 | no_roles_user_auto@pso.com                 |                            |              |                 |                            |
-      | Data Provider - User with role: ONBOARDER_M | Data Provider Participant Utility | Data Provider | DATA_PROVIDER_ONBOARDER_M | sees             | dataprovider_role_onboarder_m_auto | dataprovider_role_onboarder_m_auto@pso.com | ONBOARDED_DATA_PROVIDER_ID | PSO          | DATA PROVIDER   | DATA_PROVIDER              |
-      | Data Provider - User with role: CATALOG_R   | Data Provider Participant Utility | Data Provider | DATA_PROVIDER_CATALOG_R   | does not see     | dataprovider_role_catalog_r_auto   | dataprovider_role_catalog_r_auto@pso.com   |                            |              |                 |                            |
-      | Data Provider - User with role: T1UAR_M     | Data Provider Participant Utility | Data Provider | DATA_PROVIDER_T1UAR_M     | does not see     | dataprovider_role_t1uar_m_auto     | dataprovider_role_t1uar_m_auto@pso.com     |                            |              |                 |                            |
-      | Data Provider - User with no roles assigned | Data Provider Participant Utility | Data Provider | NO ROLE                   | does not see     | no_roles_user_auto                 | no_roles_user_auto@pso.com                 |                            |              |                 |                            |
+      | caseName                                    | participantUtility                | keycloak      | role                       | username                            | emailAddress                                 | commonName                 | organisation | participantType | assignedIdentityAttributes |
+      | Consumer - User with role: ONBOARDER_M      | Consumer Participant Utility      | Consumer      | CONSUMER_ONBOARDER_M       | consumer_role_onboarder_m_auto      | consumer_role_onboarder_m_auto@test.com      | ONBOARDED_CONSUMER_ID      | PSO          | CONSUMER        |                            |
+      | Consumer - User with role: CATALOG_R        | Consumer Participant Utility      | Consumer      | CONSUMER_SD_CONSUMER       | consumer_role_sd_consumer_auto      | consumer_role_sd_consumer_auto@test.com      |                            |              |                 |                            |
+      | Consumer - User with role: T1UAR_M          | Consumer Participant Utility      | Consumer      | CONSUMER_T1UAR_M           | consumer_role_t1uar_m_auto          | consumer_role_t1uar_m_auto@test.com          |                            |              |                 |                            |
+      | Consumer - User with no roles assigned      | Consumer Participant Utility      | Consumer      | NO ROLE                    | no_roles_user_auto                  | no_roles_user_auto@test.com                  |                            |              |                 |                            |
+      | Data Provider - User with role: ONBOARDER_M | Data Provider Participant Utility | Data Provider | DATA_PROVIDER_ONBOARDER_M  | dataprovider_role_onboarder_m_auto  | dataprovider_role_onboarder_m_auto@test.com  | ONBOARDED_DATA_PROVIDER_ID | PSO          | DATA PROVIDER   |                            |
+      | Data Provider - User with role: CATALOG_R   | Data Provider Participant Utility | Data Provider | DATA_PROVIDER_SD_PUBLISHER | dataprovider_role_sd_publisher_auto | dataprovider_role_sd_publisher_auto@test.com |                            |              |                 |                            |
+      | Data Provider - User with role: T1UAR_M     | Data Provider Participant Utility | Data Provider | DATA_PROVIDER_T1UAR_M      | dataprovider_role_t1uar_m_auto      | dataprovider_role_t1uar_m_auto@test.com      |                            |              |                 |                            |
+      | Data Provider - User with no roles assigned | Data Provider Participant Utility | Data Provider | NO ROLE                    | no_roles_user_auto                  | no_roles_user_auto@test.com                  |                            |              |                 |                            |
 
   @TCP02 @SIMPL-1100
   Scenario Outline: Unauthorized user navigates to the Participant Utility Page: <caseName>
diff --git a/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java b/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java
index e2dc941f..3ab8afef 100644
--- a/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java
+++ b/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java
@@ -3,6 +3,7 @@ package stepDefinitions.ui.simplOpen;
 import com.microsoft.playwright.Locator;
 import com.microsoft.playwright.Page;
 import com.microsoft.playwright.options.AriaRole;
+import com.microsoft.playwright.options.LoadState;
 import framework.ui.helpers.CalendarWidget;
 import framework.ui.helpers.UiSetup;
 import framework.ui.helpers.Utils;
@@ -22,11 +23,9 @@ import java.util.*;
 
 import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
 import static configuration.ui.data.simplOpen.Authority.*;
-import static configuration.ui.data.simplOpen.Authority.PARTICIPANT_PAGE_RESET_FILTER_BUTTON;
 import static framework.common.Assertions.*;
 import static framework.ui.helpers.Utils.clickButtonByLocator;
 import static framework.ui.locators.simplOpen.Authority.*;
-import static framework.ui.locators.simplOpen.Authority.FILTER_APPLIED_VALUE_LOCATOR;
 import static framework.ui.pages.simplOpen.AuthorityPage.*;
 import static org.junit.Assert.*;
 
@@ -272,8 +271,9 @@ public class AuthoritySteps {
     }
 
     @When("the user sorts by {string} {string}")
-    public void the_user_sorts_the_values_of_a_column_table_ascending_or_descending(String sortDirection, String columnToSort) {
+    public void the_user_sorts_the_values_of_a_column_table_ascending_or_descending(String sortDirection, String columnToSort) throws InterruptedException {
         authorityPage.sortsTheValuesOfAColumnTable(sortDirection, columnToSort);
+        Thread.sleep(500);
     }
 
     @When("the dataspace governance user clicks on the {string} button")
@@ -289,6 +289,7 @@ public class AuthoritySteps {
         }
         assertElementIsVisibleByLocator(button);
         button.click();
+        page.waitForLoadState(LoadState.NETWORKIDLE);
     }
 
     @When("^the user (submits|cancels) the form$")
@@ -377,8 +378,8 @@ public class AuthoritySteps {
 
     @When("the system prompts the user to confirm the removal action")
     public void theSystemPromptsTheUserToConfirmTheRemovalAction() {
-        String getCodeValueToDelete = "Confirm deletion of " + page.locator(IDENTITY_ATTRIBUTE_LIST_DELETE_DIALOG_MESSAGE_LOCATOR).innerText();
-        assertEquals(getCodeValueToDelete, getCodeValueToDelete);
+        String getCodeValueToDeleteFromDialog = page.locator(IDENTITY_ATTRIBUTE_LIST_DELETE_DIALOG_MESSAGE_LOCATOR).innerText();
+        assertEquals(getCodeValueToDelete, getCodeValueToDeleteFromDialog);
     }
 
     @When("^the user (confirms|cancels) the removal action$")
@@ -756,9 +757,9 @@ public class AuthoritySteps {
         Utils.checkInputFieldHasText(page, ORGANISATION_INPUT_LOCATOR, participantType);
     }
 
-    @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);
+    @Then("the {string} is sorted successfully by {string} {string}")
+    public void verify_the_dates_values_of_the_column_were_sorted(String nameSpace, String sortDirection, String columnToSort) {
+        authorityPage.verifyColumnSorting(sortDirection, columnToSort);
     }
 
     @Then("the sorting button {string} is enabled")
diff --git a/src/test/java/stepDefinitions/ui/simplOpen/CommonSteps.java b/src/test/java/stepDefinitions/ui/simplOpen/CommonSteps.java
index f9beddd3..6cbeeab9 100644
--- a/src/test/java/stepDefinitions/ui/simplOpen/CommonSteps.java
+++ b/src/test/java/stepDefinitions/ui/simplOpen/CommonSteps.java
@@ -2,6 +2,7 @@ package stepDefinitions.ui.simplOpen;
 
 import com.microsoft.playwright.Locator;
 import com.microsoft.playwright.Page;
+import com.microsoft.playwright.options.LoadState;
 import framework.ui.helpers.UiSetup;
 import framework.ui.helpers.Utils;
 import io.cucumber.java.en.Then;
@@ -42,6 +43,7 @@ public class CommonSteps {
     public void the_user_logs_in_with_a_user_with_role(String role) {
         Utils.LogInDetails userAndPassword = Utils.getUserAndPasswordByRole(role);
         keycloakLogin(userAndPassword);
+        page.waitForLoadState(LoadState.NETWORKIDLE);
     }
 
     @When("the user tries to log in with invalid login credentials")
diff --git a/src/test/java/stepDefinitions/ui/simplOpen/ParticipantSteps.java b/src/test/java/stepDefinitions/ui/simplOpen/ParticipantSteps.java
index 2c179a5f..88ae29b0 100644
--- a/src/test/java/stepDefinitions/ui/simplOpen/ParticipantSteps.java
+++ b/src/test/java/stepDefinitions/ui/simplOpen/ParticipantSteps.java
@@ -1,6 +1,7 @@
 package stepDefinitions.ui.simplOpen;
 
 import com.microsoft.playwright.Page;
+import com.microsoft.playwright.options.LoadState;
 import framework.ui.helpers.UiSetup;
 import framework.ui.pages.simplOpen.ParticipantPage;
 import io.cucumber.datatable.DataTable;
@@ -36,6 +37,7 @@ public class ParticipantSteps {
         } else {
             throw new IllegalArgumentException("Unknown button: " + button);
         }
+        page.waitForLoadState(LoadState.NETWORKIDLE);
     }
 
     @Then("the Echo page is displayed")
-- 
GitLab