Exemple #1
0
  @Test(dataProvider = "getAllRoles", dataProviderClass = DataProviders.class)
  public void testValidLogin(final User user) {
    homePage = new HomePage(driver);
    userInfoPage = homePage.logIn(user.getLogin(), user.getPassword());

    loggingAssert.assertTrue(
        userInfoPage
            .getElementText(UserInfoPageLocators.USER_ROLE_LABEL)
            .equals(Roles.getRoleName(user.getRoleReference())),
        "User roles match");

    userInfoPage.clickLogOutButton();
  }
Exemple #2
0
  public User getByRole(final Roles role) throws DAOException {
    List<User> list;
    final String sqlQuery = getByRoleQuery();

    try (final PreparedStatement statement = connection.prepareStatement(sqlQuery)) {
      statement.setInt(1, role.ordinal() + 1);
      final ResultSet resultSet = statement.executeQuery();
      list = (List<User>) parseResultSet(resultSet);
    } catch (SQLException e) {
      throw new DAOException(e);
    }
    return list.get(0);
  }