Skip to content

Commit

Permalink
steps to new test scenario @TMslinK=SORDEV-12303
Browse files Browse the repository at this point in the history
  • Loading branch information
hms-sgent committed Oct 13, 2022
1 parent ca4b9c5 commit 61058d9
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ public class UserManagementPage {
public static final By USERS_COUNTER_USER_MANAGEMENT =
By.cssSelector("[class*='v-label-align-right v-label-undef-w']");
public static final By LOADING_INDICATOR = By.cssSelector("[class='v-loading-indicator first']");
public static final By USER_ROLES_TAB = By.cssSelector("div#tab-user-userroles");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2022 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.sormas.e2etests.pages.application.users;

import org.openqa.selenium.By;

public class UserRolesPage {
public static By USER_RIGHTS_INPUT = By.cssSelector("#userRights input");
public static By NEW_USER_ROLE_BUTTON = By.cssSelector("div #userRoleNewUserRole");
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");
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public class RemoteDriverFactory implements DriverFactory {
private final DesiredCapabilities desiredCapabilities;
private final DriverMetaData driverMetaData;
private final String userDirectory = System.getProperty("user.dir");
private final String remoteDriverPath = "/usr/lib64/chromium-browser/chromedriver";
private final String remoteDriverPath =
"C:\\Users\\HalimaMohamed-Seghir\\Desktop\\projects\\Sormas\\chromedriver.exe";

@Inject
public RemoteDriverFactory(
Expand All @@ -62,7 +63,7 @@ public ChromeDriver getRemoteWebDriver() {
options.merge(desiredCapabilities);
options.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.IGNORE);
options.addArguments("disable-infobars");
options.addArguments("--headless");
// options.addArguments("--headless");
options.addArguments("--no-sandbox");
options.addArguments("--disable-browser-side-navigation");
options.addArguments("--disable-gpu-sandbox");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.sormas.e2etests.pages.application.cases.EditCasePage.ACTION_CANCEL;
import static org.sormas.e2etests.pages.application.users.CreateNewUserPage.*;
import static org.sormas.e2etests.pages.application.users.UserManagementPage.*;
import static org.sormas.e2etests.pages.application.users.UserRolesPage.USER_RIGHTS_INPUT;

import cucumber.api.java8.En;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -191,6 +192,14 @@ public UserManagementSteps(WebDriverHelpers webDriverHelpers, AssertHelpers asse
"User Roles Filer ComboBox failed in User Management Page"),
10);
});

And(
"^I click on User roles tab from User Management Page$",
() -> {
webDriverHelpers.scrollToElement(USER_ROLES_TAB);
webDriverHelpers.clickOnWebElementBySelector(USER_ROLES_TAB);
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(USER_RIGHTS_INPUT);
});
}

private void searchForUser(String userName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2022 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

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

import static org.sormas.e2etests.pages.application.users.UserRolesPage.NEW_USER_ROLE_BUTTON;
import static org.sormas.e2etests.pages.application.users.UserRolesPage.USER_ROLE_TEMPLATE_COMBOBOX;

import cucumber.api.java8.En;
import javax.inject.Inject;
import org.sormas.e2etests.helpers.WebDriverHelpers;

public class UserRolesSteps implements En {
private final WebDriverHelpers webDriverHelpers;

@Inject
public UserRolesSteps(final WebDriverHelpers webDriverHelpers) {
this.webDriverHelpers = webDriverHelpers;

When(
"I click on New user role button on User Roles Page",
() -> {
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(NEW_USER_ROLE_BUTTON);
webDriverHelpers.clickOnWebElementBySelector(NEW_USER_ROLE_BUTTON);
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(
USER_ROLE_TEMPLATE_COMBOBOX);
});

And(
"^I choose \"([^\"]*)\" as the user role template$",
(String userTemplate) -> {
webDriverHelpers.selectFromCombobox(USER_ROLE_TEMPLATE_COMBOBOX, userTemplate);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,11 @@ Feature: Create user
When I fill phone number with a wrong format in the Edit User Page
And I click on the Save button in the Edit User Page
Then I verify the error message is displayed in the Edit User Page

@tmsLink=SORDEV-12303 @env_main
Scenario: Edit and create user roles
Given I log in as a Admin 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

0 comments on commit 61058d9

Please sign in to comment.