diff --git a/src/main/java/configuration/ui/data/simplOpen/Authority.java b/src/main/java/configuration/ui/data/simplOpen/Authority.java index d14b1a1be803c90715d3ad3a7fb7121339e4e9a3..6d030b3ded9c399dc95d980e9532460ae25299f5 100644 --- a/src/main/java/configuration/ui/data/simplOpen/Authority.java +++ b/src/main/java/configuration/ui/data/simplOpen/Authority.java @@ -46,6 +46,7 @@ public class Authority { public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_LAST_CHANGE_DATE_COLUMN = "Last change date"; public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_TABLE_ACTIONS = "Actions"; public static final String IDENTITY_ATTRIBUTES_DETAILS_HEADER = "Identity attributes details"; + public static final String IDENTITY_ATTRIBUTES_LIST_HEADER = "Attributes list"; public static final String PARTICIPANT_PAGE_PARTICIPANT_LIST_HEADER = "Participant List"; public static final String PARTICIPANT_PAGE_FILTER_BUTTON = "Filter"; public static final String PARTICIPANT_PAGE_RESET_FILTER_BUTTON = "Reset"; @@ -60,6 +61,7 @@ public class Authority { public static final String NEW_ATTRIBUTE_HEADER = "New attribute"; public static final String SUCCESSFUL_IDENTITY_ATTRIBUTE_CREATION_ALERT_MESSAGE = "You successfully created an attribute"; public static final String SUCCESSFUL_IDENTITY_ATTRIBUTE_EDITION_ALERT_MESSAGE = "You successfully edited an attribute"; + public static final String SUCCESSFUL_IDENTITY_ATTRIBUTE_DELETION_ALERT_MESSAGE = "identityAttributesManagementPage.deleteIdentityAttribueSuccess"; public static final String SUCCESSFUL_REQUEST_SENT_ALERT_MESSAGE = "Request sent successfully."; public static final String ROLE_RESTRICTED = "Role Restricted Access"; public static final String ACCESS_DENIED = "Access denied. Your role does not grant permission to view this content."; diff --git a/src/main/java/framework/ui/helpers/CalendarWidget.java b/src/main/java/framework/ui/helpers/CalendarWidget.java index b96b3e553bfa2fc9b4776c11bc43065ec1bb2d9c..16c59dc933b60c8f69b92d3ce9d0090c0bf9d2d4 100644 --- a/src/main/java/framework/ui/helpers/CalendarWidget.java +++ b/src/main/java/framework/ui/helpers/CalendarWidget.java @@ -55,5 +55,4 @@ public class CalendarWidget { page.getByLabel(date.format(MONTH_FORMAT)).click(); page.getByLabel(date.format(DAY_FORMAT)).click(); } - } diff --git a/src/main/java/framework/ui/helpers/Utils.java b/src/main/java/framework/ui/helpers/Utils.java index 65e1e496582f1805484476526d948ed949f076cf..128eec0186f7c2cef84604da973eba2165ef8b30 100644 --- a/src/main/java/framework/ui/helpers/Utils.java +++ b/src/main/java/framework/ui/helpers/Utils.java @@ -242,5 +242,4 @@ public final class Utils { assertElementIsVisibleByLocator(rejectButton); rejectButton.click(); } - } diff --git a/src/main/java/framework/ui/locators/simplOpen/Authority.java b/src/main/java/framework/ui/locators/simplOpen/Authority.java index 68a9a2364725c2e873a5e820dec4f6386322fa79..119136522676a80c9e0b74dd6bc919d7fcf149fb 100644 --- a/src/main/java/framework/ui/locators/simplOpen/Authority.java +++ b/src/main/java/framework/ui/locators/simplOpen/Authority.java @@ -48,8 +48,7 @@ public class Authority { public static final String PARTICIPANT_DETAILS_ATTRIBUTES_TABLE_LOCATOR = "table[class='mat-mdc-table mdc-data-table__table cdk-table mat-sort ng-star-inserted']"; public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_NAME_COLUMN_LOCATOR = "//td[contains(@class, " + "'cdk-column-name')]"; - public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_CODE_COLUMN_LOCATOR = "//td[contains(@class, " + - "'cdk-column-code')]"; + public static final String PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_CODE_COLUMN_LOCATOR = "//td[contains(@class,'cdk-column-code')]"; 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']"; @@ -123,6 +122,9 @@ 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 IDENTITY_ATTRIBUTE_REMOVE_BUTTON_LOCATOR = "//mat-icon[normalize-space()='delete']"; + public static final String IDENTITY_ATTRIBUTE_DELETE_BUTTON_LOCATOR = "//span[normalize-space()='Delete']"; + public static final String IDENTITY_ATTRIBUTE_DELETE_CANCEL_BUTTON_LOCATOR = "//span[normalize-space()='Cancel']"; 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/test/java/features/ui/simplOpen/Authority.feature b/src/test/java/features/ui/simplOpen/Authority.feature index a9cf439d7f19d5714d80b9eb59238ff5aea510a4..eee745532eca88ce33ad7a65911ee4d3a888309f 100644 --- a/src/test/java/features/ui/simplOpen/Authority.feature +++ b/src/test/java/features/ui/simplOpen/Authority.feature @@ -500,6 +500,25 @@ Feature: Authority | the user is filtering by Onboarding date | Onboarding Date | | #| the user is filtering by Email | Email | complete | + @TCA33 @SIMPL-3453 + Scenario: Cancellation of the Identity Attribute Deletion Process + Given the user navigates to the "Identity Attributes" page + And the user logs in with a user with "IATTR_M" role + And the user filters by "Name" with value "PSO SIMPL-3453 IDENTITY ATTRIBUTE" + And the users clicks on the remove button under the Action column + And the system prompts the user to confirm the removal action + Then the user cancels the removal action + And the page displays a table with the following column headings: + | Identifier | + | Code | + | Assignable to Role | + | Enabled | + | In use | + | Creation date | + | Last change date | + | Actions | + And the list of Identity Attributes is displayed + @TCA34 @SIMPL-4917 Scenario: Confirm Participant Detail Information Page displays correct details. Given the user navigates to the "Participant Management" page @@ -528,4 +547,4 @@ Feature: Authority Examples: | caseName | filter1 | filterValue1 | filter2 | filterValue2 | - | the user filtering by status and by email, then reset the filter | status | Approved | email | dataparticipant_request_accepted@automation.com | + | the user filtering by status and by email, then reset the filter | status | Approved | email | dataparticipant_request_accepted@automation.com | \ No newline at end of file diff --git a/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java b/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java index 3b89e3eaae56b90c99081266bfc138f01bb12934..e2dc941f68d1147068eaea5b13cf388788fcd11a 100644 --- a/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java +++ b/src/test/java/stepDefinitions/ui/simplOpen/AuthoritySteps.java @@ -43,6 +43,7 @@ public class AuthoritySteps { private static String participantDetailTypeValue = null; private static String participantDetailOnboardingValue = null; private static String datePasedToString = null; + private static String getCodeValueToDelete = null; @Given("the user clicks the register for this dataspace button") @@ -368,6 +369,34 @@ public class AuthoritySteps { participantDetailOnboardingValue = authorityPage.parseDate(participantDetailOnboardingValue); } + @When("the users clicks on the remove button under the Action column") + public void theUsersClicksOnTheRemoveButtonUnderTheActionColumn() { + getCodeValueToDelete = "Confirm deletion of " + page.locator((PARTICIPANT_DETAILS_IDENTITY_ATTRIBUTES_CODE_COLUMN_LOCATOR)).innerText(); + page.locator(IDENTITY_ATTRIBUTE_REMOVE_BUTTON_LOCATOR).click(); + } + + @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); + } + + @When("^the user (confirms|cancels) the removal action$") + public void theUserConfirmsTheRemovalAction(String action) { + String locator = action.equals("confirms") + ? IDENTITY_ATTRIBUTE_DELETE_BUTTON_LOCATOR + : IDENTITY_ATTRIBUTE_DELETE_CANCEL_BUTTON_LOCATOR; + clickButtonByLocator(locator); + } + + @When("a success message is displayed") + public void aSuccessMessageIsDisplayed() { + Locator successMessage = page.getByRole(AriaRole.ALERT); + assertElementIsVisibleByLocator(successMessage); + assertThat(successMessage).hasText(SUCCESSFUL_IDENTITY_ATTRIBUTE_DELETION_ALERT_MESSAGE); + } + + @Then("the {string} is updated with a maximum of {int} results") public void theRequestListIsUpdatedShowingAMaximumNumberOfResultsPerPage(String listType, Integer numberValueByPage) { assertElementIsVisibleByLocator(page.locator(FILTER_TABLE)); @@ -636,11 +665,18 @@ public class AuthoritySteps { Locator identityAttributeDetailsColumns = page.locator(IDENTITY_ATTRIBUTE_DETAILS_COLUMNS_LOCATOR); assertElementIsVisibleByLocator(identityAttributeDetailsColumns.first()); - List<String> expectedValues = new ArrayList<>(details.values()); List<String> realValues = identityAttributeDetailsColumns.allTextContents(); realValues.replaceAll(String::strip); - for (String expectedValue : expectedValues) { - assertElementIsPresentInCollection(expectedValue, realValues); + + for (Map.Entry<String, String> entry : details.entrySet()) { + String key = entry.getKey(); + String expectedValue = entry.getValue(); + if (key.equals("Code")) { + assertTrue(String.format("Expected %s to contain %s, but was %s", key, expectedValue, realValues), + realValues.stream().anyMatch(value -> value.contains(expectedValue))); + } else { + assertElementIsPresentInCollection(expectedValue, realValues); + } } } @@ -811,4 +847,9 @@ public class AuthoritySteps { public void theUserVerifiesTheElementsInParticipantDetailsPage(DataTable dataTable) { authorityPage.verifyTheValuesObtainedMatchWithValueDisplayed(dataTable, participantDetailNameValue, participantDetailTypeValue, participantDetailOnboardingValue); } + + @Then("the system removes the Identity Attribute from the list") + public void theSystemRemovesTheIdentityAttributeFromTheList() { + assertElementIsVisibleByLocator(page.locator(EMPTY_LIST_MESSAGE_LOCATOR)); + } }