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

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

Merge branch 'SOUI-SmallChangesFramework' into 'develop'

SOUI - Small Changes in Framework

See merge request simpl/pso/pso-test/pso-test-automation!78
parents b69edbdf e3dffc7e
No related branches found
No related tags found
No related merge requests found
......@@ -12,17 +12,15 @@ public class Authority {
public static final String NAME_INPUT_VALUE = "automation";
public static final String USERNAME_INPUT_VALUE = "testAutomation";
public static final String PASSWORD_INPUT_VALUE = "Test20!4";
public static String NEW_USER = "";
public static final String HOST_MANAGEMENT_PARTICIPANT = "management/participant";
public static final String AUTHORITY_NOTARY_USER = "pso.notary";
public static final String AUTHORITY_IATTR_M_USER = "authority1_role_iattr_m.user001";
public static final String AUTHORITY_T1UAR_M_USER = "authority1_role_t1uar_m.user001";
public static final String AUTHORITY_T2IAA_M_USER = "authority1_role_t2iaa_m.user001";
public static final String GENERAL_PASSWORD = "password";
public static final String ONBOARDING_DATAPARTICIPANT_SUBMITTED_USER = "dataparticipant_req_submitted@automation.com";
public static final String ONBOARDING_DATAPARTICIPANT_SUBMITTED_PASSWORD = "Test20!4";
public static final String ONBOARDING_DATAPARTICIPANT_INPROGRESS_USER = "dataparticipant_req_inprogress@automation.com";
public static final String ONBOARDING_DATAPARTICIPANT_INPROGRESS_PASSWORD = "Test20!4";
public static final String ONBOARDING_DATAPARTICIPANT_REQUEST_SUBMITTED_USER = "dataparticipant_req_submitted@automation.com";
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[] PARTICIPANT_TYPES = {
"Consumer",
......
......@@ -107,6 +107,32 @@ public final class Utils {
return logInDetails;
}
/**
* Method to get credentials for the different keycloak users needed for tests.
*
* @param user The role of the user in keycloak.
*/
public static LogInDetails getUserNameAndPassword(String user) {
String username = "";
String password = "";
switch (user.toUpperCase()) {
case "ONBOARDING_DATAPARTICIPANT_REQUEST_INPROGRESS":
username = ONBOARDING_DATAPARTICIPANT_REQUEST_INPROGRESS_USER;
password = ONBOARDING_DATAPARTICIPANT_PASSWORD;
break;
case "ONBOARDING_DATAPARTICIPANT_REQUEST_SUBMITTED":
username = ONBOARDING_DATAPARTICIPANT_REQUEST_SUBMITTED_USER;
password = ONBOARDING_DATAPARTICIPANT_PASSWORD;
break;
default:
throw new IllegalArgumentException("Unknown user: " + user);
}
LogInDetails logInDetails = new LogInDetails();
logInDetails.setUsername(username);
logInDetails.setPassword(password);
return logInDetails;
}
/**
* This method verifies that an element is visible.
*
......
......@@ -23,11 +23,9 @@ public class Authority {
public static final String KEYCLOAK_SIGN_IN_BUTTON = "input[id='kc-login']";
public static final String PARTICIPANT_LIST_TABLE = "table[role='table']";
public static final String HOST_APPLICATION_ONBOARDING_STATUS = "application/onboarding-status";
public static final String KEYCLOAK_USERNAME_INPUT_LOCATOR = "input[id='username']";
public static final String KEYCLOAK_PASSWORD_INPUT_LOCATOR = "input[id='password']";
public static final String KEYCLOAK_SIGN_IN_LOCATOR = "input[id='kc-login']";
public static final String REQUEST_STATUS_DETAILS_DIALOG = "//mat-dialog-content[contains(@class, 'mat-mdc-dialog-content')]";
public static final String WELCOME_PAGE = "h1";
public static final String ONBOARDING_STATUS_PANEL = "//div/lib-onboarding-status/div/div";
public static final String ONBOARDING_REQUESTS_PANEL = "//div[contains(text(), 'Request submitted' )]";
public static final String GREEN_ICON_LOCATOR = ".mat-icon:nth-child(1)";
public static final String GREY_ICON_LOCATOR_2 = "//div[contains(text(), '2' )]";
public static final String GREY_ICON_LOCATOR_3 = "//div[contains(text(), '3' )]";
......
......@@ -3,7 +3,7 @@ Feature: Authority
@TCA01 @SIMPL-4015 @SIMPL-4534
Scenario Outline: Create credentials for <Organization Name> with type <Participant type>
Given the dataspace governance authority user is on the welcome to dataspace info page
Given the dataspace governance authority user navigates to the "Welcome to Dataspace Info" page
And the user clicks the register for this dataspace button
And the user verifies the create credentials button is disabled
And the user enters the email address
......@@ -38,16 +38,16 @@ Feature: Authority
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
Then the application status summary page shows the status request is 'Request submitted' with a 'green' icon
And the application status summary page shows the status request is 'In Progress' with a 'green' icon
And the application status summary page shows the status request is 'Request accepted' with a 'grey' icon
Then the application status summary page shows the status request is "Request submitted" with a "green" icon
And the application status summary page shows the status request is "In Progress" with a "green" icon
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
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
Then the application status summary page shows the status request is 'Request submitted' with a 'green' icon
And the application status summary page does not show the status request is 'In Progress' with a 'green' icon
And the application status summary page does not show the status request is 'Request accepted' with a 'grey' icon
Then the application status summary page shows the status request is "Request submitted" with a "green" icon
And the application status summary page does not show the status request is "In Progress" with a "green" icon
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
......@@ -47,7 +47,7 @@ Feature: Wizard
When the user clicks the upload button from the Upload Shape
Then the Complete Person Form is displayed
@TCW06 @SIMPL-1050
@TCW06 @SIMPL-1050 @bug:SIMPL-6438
Scenario: Check if the JSON file is downloaded
Given the user logs in to the SD Wizard
And the user clicks on get started button
......
......@@ -27,14 +27,7 @@ public class AuthoritySteps {
private final String PARTICIPANT_PAGE_REQUESTER_EMAIL_COLUMN = "Requester email";
private final String PARTICIPANT_PAGE_ONBOARDING_DATE_COLUMN = "Onboarding Date";
public static String NEW_USER = "";
public static String PDF_FILE_UPLOADED = "pdf submitted";
public static Boolean IS_PDF_SUBMITTED = false;
public static String ONBOARDING_DATAPARTICIPANT_USER = "";
@Given("the dataspace governance authority user is on the welcome to dataspace info page")
public void the_dataspace_governance_authority_user_is_on_the_welcome_to_dataspace_info_page() throws InterruptedException {
page.navigate(URL_AUTHORITY + HOST_APPLICATION);
}
@Given("the user clicks the register for this dataspace button")
public void the_user_clicks_the_register_for_this_dataspace_button() {
......@@ -52,16 +45,14 @@ public class AuthoritySteps {
public void the_user_verifies_the_create_credential_button_is(String state) {
boolean shouldBeEnabled = state.equalsIgnoreCase("enabled");
boolean isEnabled = page.locator(CREATE_CREDENTIALS_BUTTON).isEnabled();
assertTrue(String.format("Expected 'Create Credentials' button to be %s, but it was %s.", state, isEnabled ? "enabled" : "disabled"),
shouldBeEnabled == isEnabled);
assertEquals(String.format("Expected 'Create Credentials' button to be %s, but it was %s.", state, isEnabled ? "enabled" : "disabled"),
shouldBeEnabled, isEnabled);
}
@Given("^the applicant with (pdf submitted|pdf not submitted) is in the onboarding status page$")
public void the_user_is_in_the_Keycloak_status_page(String pdfIsSubmitted) {
page.navigate(URL_AUTHORITY + HOST_APPLICATION_ONBOARDING_STATUS);
if (pdfIsSubmitted.equals(PDF_FILE_UPLOADED)) {
IS_PDF_SUBMITTED = true;
}
public void the_applicant_is_in_the_onboarding_status_page(String pdfIsSubmitted) {
theUserNavigatesToThePage("Onboarding Status");
IS_PDF_SUBMITTED = pdfIsSubmitted.equals("pdf submitted");
}
@When("the user selects a {string} participant type")
......@@ -112,12 +103,12 @@ public class AuthoritySteps {
@Then("the successful message is displayed")
public void the_successful_message_is_displayed() {
page.locator(SUCCESSFUL_MESSAGE).isVisible();
verifyElementIsVisibleByLocator(page.locator(SUCCESSFUL_MESSAGE));
}
@Then("the user can see the submission form button")
public void the_user_can_see_submission_form_button() {
page.locator(SUBMISSION_FORM_BUTTON).isVisible();
verifyElementIsVisibleByLocator(page.locator(SUBMISSION_FORM_BUTTON));
}
@Then("the user can see the access credentials")
......@@ -132,36 +123,42 @@ public class AuthoritySteps {
}
}
@When("the user navigates to the {string} page")
@When("the (dataspace governance authority )user navigates to the {string} page")
public void theUserNavigatesToThePage(String pageName) {
if ("Participant Management".equals(pageName)) {
page.navigate(URL_AUTHORITY + HOST_ADMINISTRATION + "/" + HOST_MANAGEMENT_PARTICIPANT);
switch (pageName) {
case "Welcome to Dataspace Info":
page.navigate(URL_AUTHORITY.concat(HOST_APPLICATION));
break;
case "Participant Management":
page.navigate(URL_AUTHORITY.concat(HOST_ADMINISTRATION).concat("/").concat(HOST_MANAGEMENT_PARTICIPANT));
break;
case "Onboarding Status":
page.navigate(URL_AUTHORITY.concat(HOST_APPLICATION_ONBOARDING_STATUS));
break;
default :
throw new IllegalArgumentException("Unknown page: " + pageName);
}
}
@When("the applicant logs in with valid credentials")
public void the_applicant_logs_in_with_valid_credentials() {
Utils.LogInDetails userAndPassword;
if (IS_PDF_SUBMITTED) {
page.locator(KEYCLOAK_USERNAME_INPUT_LOCATOR).fill(ONBOARDING_DATAPARTICIPANT_INPROGRESS_USER);
page.locator(KEYCLOAK_PASSWORD_INPUT_LOCATOR).fill(ONBOARDING_DATAPARTICIPANT_INPROGRESS_PASSWORD);
userAndPassword = Utils.getUserNameAndPassword("ONBOARDING_DATAPARTICIPANT_REQUEST_INPROGRESS");
} else {
page.locator(KEYCLOAK_USERNAME_INPUT_LOCATOR).fill(ONBOARDING_DATAPARTICIPANT_SUBMITTED_USER);
page.locator(KEYCLOAK_PASSWORD_INPUT_LOCATOR).fill(ONBOARDING_DATAPARTICIPANT_SUBMITTED_PASSWORD);
}
page.locator(KEYCLOAK_SIGN_IN_LOCATOR).click();
assertThat(page.locator(WELCOME_PAGE)).isVisible();
}
@Then("the user is redirected to the {string} keycloak")
public void theUserIsRedirectedToTheKeycloak(String keycloak) {
if ("Governance Authority".equals(keycloak)) {
page.waitForURL(URL_KEYCLOAK_AUTHORITY + "/**");
userAndPassword = Utils.getUserNameAndPassword("ONBOARDING_DATAPARTICIPANT_REQUEST_SUBMITTED");
}
keycloakLogin(userAndPassword);
verifyElementIsVisibleByLocator(page.locator(ONBOARDING_STATUS_PANEL));
}
@When("the user logs in with a user with {string} role")
public void theUserLogsInWithAUserWithRole(String role) {
Utils.LogInDetails userAndPassword = Utils.getUserAndPasswordByRole(role);
keycloakLogin(userAndPassword);
}
public void keycloakLogin(Utils.LogInDetails userAndPassword) {
page.locator(KEYCLOAK_USERNAME_INPUT).fill(userAndPassword.getUsername());
page.locator(KEYCLOAK_PASSWORD_INPUT).fill(userAndPassword.getPassword());
Locator signInButton = page.locator(KEYCLOAK_SIGN_IN_BUTTON);
......@@ -172,11 +169,16 @@ public class AuthoritySteps {
}
}
@Then("the user is redirected to the {string} keycloak")
public void theUserIsRedirectedToTheKeycloak(String keycloak) {
if ("Governance Authority".equals(keycloak)) {
page.waitForURL(URL_KEYCLOAK_AUTHORITY + "/**");
}
}
@Then("the list of onboarded participants for the data space is displayed")
public void theListOfOnboardedParticipantsForTheDataSpaceIsDisplayed() {
page.waitForCondition(() -> page.getByText(PARTICIPANT_PAGE_PARTICIPANT_LIST_HEADER).isVisible(),
new Page.WaitForConditionOptions().setTimeout(3000));
verifyElementIsVisibleByLocator(page.getByText(PARTICIPANT_PAGE_FILTER_BUTTON));
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));
......@@ -186,8 +188,9 @@ public class AuthoritySteps {
}
@Then("^the application status summary page (shows|does not show) the status request is '(.*)' with a '(.*)' icon$")
@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));
switch (status) {
case "Request submitted":
if (!page.locator(GREEN_ICON_LOCATOR).first().isVisible() ) {
......@@ -196,7 +199,7 @@ public class AuthoritySteps {
break;
case "In Progress":
if (isDiplayed.equals("does not show") && icon.equals("green")) {
assertThat(page.locator(GREY_ICON_LOCATOR_2)).isVisible();
verifyElementIsVisibleByLocator(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");
......@@ -205,9 +208,9 @@ public class AuthoritySteps {
break;
case "Request accepted":
if (isDiplayed.equals("does not show") && icon.equals("grey") && (!IS_PDF_SUBMITTED)) {
assertThat(page.locator(GREY_ICON_LOCATOR_2)).isVisible();
verifyElementIsVisibleByLocator(page.locator(GREY_ICON_LOCATOR_2));
} else if (isDiplayed.equals("show") && icon.equals("grey") && (IS_PDF_SUBMITTED)) {
assertThat(page.locator(GREY_ICON_LOCATOR_3)).isVisible();
verifyElementIsVisibleByLocator(page.locator(GREY_ICON_LOCATOR_3));
}
}
}
......@@ -217,7 +220,7 @@ public class AuthoritySteps {
{
assertThat(page.locator(SEE_REQUEST_DETAILS_BUTTON_LOCATOR)).isEnabled();
page.locator(SEE_REQUEST_DETAILS_BUTTON_LOCATOR).click();
assertThat(page.locator(REQUEST_STATUS_DETAILS_DIALOG)).isVisible();
verifyElementIsVisibleByLocator(page.locator(REQUEST_STATUS_DETAILS_DIALOG));
page.locator(REQUEST_STATUS_DETAILS_DIALOG).click();
}
......
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