Skip to content

Commit

Permalink
new steps
Browse files Browse the repository at this point in the history
  • Loading branch information
hms-sgent committed Oct 17, 2022
1 parent 01d4763 commit f80f304
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ public class UserRolesPage {
public static By USER_ROLE_TEMPLATE_COMBOBOX =
By.cssSelector(".popupContent #templateUserRole div");
public static By CAPTION_INPUT = By.cssSelector(".popupContent #caption");
public static By JURISDICTION_LEVEL_COMBOBOX = By.cssSelector(".popupContent #jurisdictionLevel");
public static By POPUP_SAVE_BUTTON = By.cssSelector(".popupContent #commit");
public static By POPUP_DISCARD_BUTTON = By.cssSelector(".popupContent #discard");
public static By ARCHIVE_CASES_CHECKBOX = By.xpath("//label[text()='Archive cases']");
public static By ARCHIVE_CONTACTS_CHECKBOX = By.xpath("//label[text()='Archive contacts']");
public static By SAVE_BUTTON = By.cssSelector("#commit");
public static By USER_ROLE_LIST = By.cssSelector("#tab-user-userroles");
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@

package org.sormas.e2etests.steps.web.application.users;

import static org.sormas.e2etests.pages.application.users.UserRolesPage.ARCHIVE_CASES_CHECKBOX;
import static org.sormas.e2etests.pages.application.users.UserRolesPage.ARCHIVE_CONTACTS_CHECKBOX;
import static org.sormas.e2etests.pages.application.users.UserRolesPage.CAPTION_INPUT;
import static org.sormas.e2etests.pages.application.users.UserRolesPage.NEW_USER_ROLE_BUTTON;
import static org.sormas.e2etests.pages.application.users.UserRolesPage.POPUP_SAVE_BUTTON;
import static org.sormas.e2etests.pages.application.users.UserRolesPage.SAVE_BUTTON;
import static org.sormas.e2etests.pages.application.users.UserRolesPage.USER_ROLE_LIST;
import static org.sormas.e2etests.pages.application.users.UserRolesPage.USER_ROLE_TEMPLATE_COMBOBOX;

import cucumber.api.java8.En;
Expand Down Expand Up @@ -46,5 +52,45 @@ public UserRolesSteps(final WebDriverHelpers webDriverHelpers) {
(String userTemplate) -> {
webDriverHelpers.selectFromCombobox(USER_ROLE_TEMPLATE_COMBOBOX, userTemplate);
});

And(
"^I click SAVE button on Create New User Role form$",
() -> {
webDriverHelpers.clickOnWebElementBySelector(POPUP_SAVE_BUTTON);
});

And(
"^I fill caption input as \"([^\"]*)\" on Create New User Role form$",
(String caption) -> {
webDriverHelpers.waitUntilIdentifiedElementIsPresent(CAPTION_INPUT);
webDriverHelpers.fillInWebElement(CAPTION_INPUT, caption);
});

And(
"^I click checkbox to choose \"([^\"]*)\"$",
(String checkboxLabel) -> {
switch (checkboxLabel) {
case "Archive cases":
webDriverHelpers.waitUntilIdentifiedElementIsPresent(ARCHIVE_CASES_CHECKBOX);
webDriverHelpers.clickOnWebElementBySelector(ARCHIVE_CASES_CHECKBOX);
case "Archive contacts":
webDriverHelpers.waitUntilIdentifiedElementIsPresent(ARCHIVE_CONTACTS_CHECKBOX);
webDriverHelpers.clickOnWebElementBySelector(ARCHIVE_CONTACTS_CHECKBOX);
}
});

And(
"^I click SAVE button on User Role Page$",
() -> {
webDriverHelpers.waitUntilIdentifiedElementIsPresent(SAVE_BUTTON);
webDriverHelpers.clickOnWebElementBySelector(SAVE_BUTTON);
});

And(
"^I back to the User role list$",
() -> {
webDriverHelpers.waitUntilIdentifiedElementIsPresent(USER_ROLE_LIST);
webDriverHelpers.clickOnWebElementBySelector(USER_ROLE_LIST);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,12 @@ Feature: Create user
And I click on the Users from navbar
And I click on User roles tab from User Management Page
And I click on New user role button on User Roles Page
And I choose "National User" as the user role template
And I choose "National User" as the user role template
And I click SAVE button on Create New User Role form
And I close input data error popup
And I fill caption input as "TestNatUser" on Create New User Role form
And I click SAVE button on Create New User Role form
And I click checkbox to choose "Archive cases"
And I click checkbox to choose "Archive contacts"
And I click SAVE button on User Role Page
And I back to the User role list

0 comments on commit f80f304

Please sign in to comment.