@Test
 public void sanityTest() {
   LandingPage page1 = new LandingPage(driver);
   LandingPage onlandingPage = page1.goToLandingPage();
   LoginPage onloginPage = onlandingPage.goToLoginPage();
   HomePage onHomePage = onloginPage.loginToAccount();
 }
  @Test
  @InSequence(2)
  public void adminCreateApplicationTest() {
    driver.get(contextRoot.toExternalForm());
    loginPage.waitForPage();
    loginPage.login(ADMIN_USERNAME, PASSWORD);
    if (passwordChangePage.isPagePresent()) {
      passwordChangePage.changePassword(PASSWORD);
    }
    navigation.goToApplications();
    pushAppsPage.waitForPage();

    navigation.goToApplications();
    // initially there shouldn't exist any push applications
    while (!pushAppsPage.getApplicationList().isEmpty()) {
      Application application = pushAppsPage.getApplicationList().get(0);
      application.remove();
      modal.waitForDialog();
      modal.confirmName(application.getName());
      modal.remove();
    }

    pushAppsPage.pressCreateButton();
    pushAppEditPage.registerNewPushApp(ADMIN_APPLICATION, "");

    header.logout();
  }
  @Test
  @InSequence(1)
  public void createNewUserTest() throws URISyntaxException {
    driver.get(authContextRoot.toURI().resolve(CONSOLE_PATH).toString());
    loginPage.waitForPage();
    loginPage.login(ADMIN_USERNAME, PASSWORD);
    if (passwordChangePage.isPagePresent()) {
      passwordChangePage.changePassword(PASSWORD);
    }
    keyCloakNavigation.waitForPage();
    keyCloakNavigation.users();

    User newUser = new User();
    newUser.setUsername(NEW_USER_USERNAME);
    newUser.setEnabled(true);

    usersPage.addUser(newUser);

    userPageNavBar.roleMappings();
    roleMappingsPage.assignRole("developer");
    userPageNavBar.credentials();
    credentialsPage.setPassword(NEW_USER_PASSWORD);
    modal.waitForDialog();
    modal.remove();
    dropdown.click("Sign Out");
    loginPage.waitForPage();
  }
Example #4
0
 @Test
 public void testLogin() {
   WebDriver driver = new FirefoxDriver();
   LoginPage loginPage = new LoginPage(driver);
   // UserHomePage userHomePage=new UserHomePage(driver);
   UserHomePage userHomePage = loginPage.testLogin();
   driver.quit();
 }
Example #5
0
 /**
  * Verify that a logging in with a fake user will not grant the user access and redisplay the
  * login panel.
  *
  * @throws Exception if error
  */
 @Test
 public void loginWithFakeCredentials() throws Exception {
   drone.navigateTo(shareUrl);
   LoginPage page = (LoginPage) ShareUtil.loginAs(drone, shareUrl, "fake-admin", "fake-password");
   Assert.assertTrue(page.isBrowserTitle("login"));
   Assert.assertTrue(page.hasErrorMessage());
   Assert.assertTrue(page.getErrorMessage().length() > 1);
 }
Example #6
0
 @And("^user click on (.*) below to perform actions on application$")
 public void user_perform_below_actions_on_application(String link) {
   if (link.equalsIgnoreCase("GiftCards")) {
     loginPage.giftCardsLink().click();
     loginPage.clickGiftsTyBeans().click();
   }
   if (link.equalsIgnoreCase("cards")) {
     loginPage.cardsLink().click();
   }
 }
  @Test
  @InSequence(7)
  public void newUserApplicationListTest() {
    driver.get(contextRoot.toExternalForm());
    loginPage.waitForPage();
    loginPage.login(NEW_USER_USERNAME, NEW_USER_PASSWORD);
    if (passwordChangePage.isPagePresent()) {
      passwordChangePage.changePassword(NEW_USER_PASSWORD);
    }

    navigation.goToApplications();
    pushAppsPage.waitForPage();

    assertEquals(1, pushAppsPage.countApplications());
    assertTrue(pushAppsPage.applicationExists(NEW_USER_APPLICATION, ""));
  }
Example #8
0
 @And("^successfully add to basket (.*) should display$")
 public void successfully_add_to_basket_message_should_display(String message) {
   // loginPage.addToBasketMessage();
   // Assert.assertEquals("The requested quantity for \"Yankee Candle Beach Flowers Small Jar\" is
   // not available.",loginPage.addToBasketMessage());
   loginPage.addToBasketMessage();
 }
Example #9
0
  /**
   * Log a user into Alfresco with valid credentials and then logout
   *
   * @throws Exception if error
   */
  @Test
  public void loginAndLogout() throws Exception {
    drone.navigateTo(shareUrl);
    LoginPage page = drone.getCurrentPage().render();
    Assert.assertTrue(page.isBrowserTitle("login"));
    Assert.assertFalse(page.hasErrorMessage());

    DashBoardPage dashboardPage =
        (DashBoardPage) ShareUtil.loginAs(drone, shareUrl, username, password);
    dashboardPage.render();
    Assert.assertFalse(page.isBrowserTitle("login"));
    Assert.assertTrue(dashboardPage.isBrowserTitle("dashboard"));
    Assert.assertTrue(dashboardPage.isLoggedIn());
    SharePage pageResponse = dashboardPage.getNav().logout().render();
    Assert.assertTrue(pageResponse.isBrowserTitle("login"));
  }
Example #10
0
  @Then("^I should get message (.*)$")
  public void I_should_only_login_with_valid_details(String loginValidation) {
    Assert.assertEquals(loginValidation, loginPage.loginSuccess());
    // Assert.assertEquals(loginValidation,loginPage.getUserNameValidation());
    // Assert.assertEquals(loginValidation,loginPage.getPasswordMessage());

  }
  @Before
  public void setUp() {
    loginPage = new LoginPage();
    String email = "*****@*****.**";
    String password = "******";
    String userName = "******";

    mainApp = loginPage.loginAs(email, password, userName);
  }
Example #12
0
  @Test
  public void testRegistrationWhenLoggedIn() {
    WebDriver driver = driverService.getSharedWebDriver();
    LoginPage.autoLogin(driver);
    RegistrationPage registrationPage = RegistrationPage.open(driver);
    registrationPage.register(RandomStringUtils.randomAlphabetic(15));

    assertTrue(driver.findElements(By.cssSelector(".alert-success")).isEmpty());
    assertEquals(urlFor("/"), driver.getCurrentUrl());
  }
  @Test
  @InSequence(0)
  public void activateDeveloperTest() throws URISyntaxException {
    String ble = contextRoot.toExternalForm();
    driver.manage().timeouts().setScriptTimeout(15, TimeUnit.SECONDS);

    driver.get(authContextRoot.toURI().resolve(CONSOLE_PATH).toString());
    loginPage.waitForPage();
    loginPage.login(ADMIN_USERNAME, PASSWORD);
    if (passwordChangePage.isPagePresent()) {
      passwordChangePage.changePassword(PASSWORD);
    }
    keyCloakNavigation.waitForPage();
    keyCloakNavigation.users();
    usersPage.activateUser(DEVELOPER_USERNAME);

    dropdown.click("Sign Out");
    loginPage.waitForPage();
  }
  @Test
  @InSequence(3)
  public void newUserCreateApplicationTest() {
    driver.get(contextRoot.toExternalForm());
    loginPage.waitForPage();
    loginPage.login(NEW_USER_USERNAME, NEW_USER_PASSWORD);
    if (passwordChangePage.isPagePresent()) {
      passwordChangePage.changePassword(NEW_USER_PASSWORD);
    }
    navigation.goToApplications();
    pushAppsPage.waitForPage();

    navigation.goToApplications();

    pushAppsPage.pressCreateButton();
    pushAppEditPage.registerNewPushApp(NEW_USER_APPLICATION, "");

    header.logout();
  }
  @Test
  @InSequence(6)
  public void adminApplicationListTest() {
    driver.get(contextRoot.toExternalForm());
    loginPage.login(ADMIN_USERNAME, PASSWORD);
    if (passwordChangePage.isPagePresent()) {
      passwordChangePage.changePassword(PASSWORD);
    }

    navigation.goToApplications();
    pushAppsPage.waitForPage();

    assertEquals(3, pushAppsPage.countApplications());
    assertTrue(pushAppsPage.applicationExists(ADMIN_APPLICATION, ""));
    assertTrue(pushAppsPage.applicationExists(DEVELOPER_APPLICATION, ""));
    assertTrue(pushAppsPage.applicationExists(NEW_USER_APPLICATION, ""));
    header.logout();
    loginPage.waitForPage();
  }
Example #16
0
  @BeforeClass
  public void setUp() throws Exception {

    // enabling Webservice
    webService = Service.create(new URL(url + "?wsdl"), new QName(namespaceUri, localPart));
    buecherService = webService.getPort(BuecherService.class);

    // creating some books in the store
    createTestBooks(numOfBooks);

    // enabling Selenium Gui driver service
    // and login
    product = new Product();
    product.title = "Books Project (" + browser + ")";
    product.description = "Contains a story for every missing book...";

    SeleniumProperties.browser = browser;
    GeneralPage.setDriver(SeleniumProperties.browser);
    GeneralPage.start();

    LoginPage loginPage = new LoginPage();
    startPage = loginPage.login(SeleniumProperties.adminName, SeleniumProperties.adminPwd);
  }
  @Test
  @InSequence(4)
  public void developerApplicationListTest() {
    driver.get(contextRoot.toExternalForm());
    loginPage.login(DEVELOPER_USERNAME, DEVELOPER_PASSWORD);
    if (passwordChangePage.isPagePresent()) {
      passwordChangePage.changePassword(DEVELOPER_PASSWORD);
    }

    navigation.goToApplications();
    pushAppsPage.waitForPage();

    assertEquals(0, pushAppsPage.countApplications());
    assertFalse(pushAppsPage.applicationExists(ADMIN_APPLICATION, ""));
  }
Example #18
0
 @And("^I submit following valid details to sign in$")
 public void I_enter_following_valid_details_to_sign_in(DataTable tables) throws Throwable {
   List<Map<String, String>> maps = tables.asMaps();
   for (Map<String, String> mp : maps) {
     signin.enterFirstname().clear();
     signin.enterFirstname().sendKeys(mp.get("firstname"));
     signin.lastName().clear();
     signin.lastName().sendKeys(mp.get("lastname"));
     signin.emailAddress().clear();
     signin.emailAddress().sendKeys(mp.get("email"));
     signin.password().clear();
     signin.password().sendKeys(mp.get("password"));
     signin.confirmPassword().clear();
     signin.confirmPassword().sendKeys(mp.get("confirmpassword"));
     loginPage.clickSignInButton();
   }
 }
Example #19
0
 @Given("^I m on clinton application home page$")
 public void I_m_on_clinton_application_home_page() {
   loginPage.clintonHomepage("http://www.clintoncards.co.uk");
 }
Example #20
0
 @When("^I enter(.*) and (.*)$")
 public void password(String username, String password) {
   loginPage.i_enter_username_password(username, password);
 }
Example #21
0
  @Given("^I am on currys home page$")
  public void i_navigate_homepage() {

    loginPage.homePage("https://secure.currys.co.uk/gbuk/s/authentication.html");
  }
Example #22
0
  @Then("^I should login successfully$")
  public void i_should_login_successfully() {
    loginPage.validateTitle();
    //	Assert.assertEquals(expect," Hello selenium");

  }
Example #23
0
 @And("^I click login button$")
 public void I_click_login_button() {
   loginPage.loginButton();
 }
Example #24
0
  @When("^I type my credentials as(.*) and(.*)$")
  public void enter_username_password(String user, String pass) {

    loginPage.i_enter_username_password(user, pass);
  }
Example #25
0
 @Then("^click on basket link$")
 public void I_am_on_sports_page() throws Throwable {
   loginPage.navigateToBaset();
 }
Example #26
0
 @And("^checkout and verify the same (.*) item added to basket$")
 public void verify_validationMessage(String product) {
   loginPage.checkoutButton().click();
   Assert.assertTrue(loginPage.getProductItemByLinkText(product).isDisplayed());
 }
Example #27
0
 @And("^user click (.*) to add item$")
 public void user_click_addtobasket_to_add_item(String added) {
   loginPage.userAddToCartButtonClick();
 }
Example #28
0
 @When("^I click register button$")
 public void I_click_register_button() {
   loginPage.clickRegister();
 }
Example #29
0
 @Then("^I am on yahoo page$")
 public void I_am_on_yahoo_page() throws Throwable {
   loginPage.navigateToAUrl("http://currys.co.uk");
 }
Example #30
0
 @Given("^I am on main home page$")
 public void i_am_on_currys_homepage() {
   loginPage.openBrowser("https://secure.currys.co.uk/gbuk/s/authentication.html");
 }