@Test
  public void F_more() {

    // List<WebElement> editBox=driver.findElements(By.className("android.widget.TextView"));
    // editBox.get(3).click();

    // driver.findElement(By.name("Collections")).click();

    // driver.findElement(By.name("COOL!")).click();

    List<WebElement> collection1 =
        driver.findElements(By.className("android.view.View")); // Taping on Collection folder
    collection1.get(5).click();

    TouchAction tActionn = new TouchAction(driver); // Tap function
    tActionn.tap(150, 301).release().perform();

    // driver.findElement(By.xpath("//*[@class='android.view.View' and @index='5']")).click();

    driver.findElementByAccessibilityId("More").click();
    driver.findElementByName("Info").click();
    driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click();

    driver.findElementByAccessibilityId("More").click();
    driver.findElementByName("Add to Collection").click();
    driver.findElement(By.id("com.mimedia.gallery:id/merged_collection_cover")).click();
    driver.findElementByName("Add to Collection").click();

    driver.findElementByAccessibilityId("More").click();

    driver.findElementByName("Add to MiDrive").click();
    List<WebElement> midrive = driver.findElements(By.className("android.widget.FrameLayout"));
    midrive.get(0).click();
    // driver.findElement(By.xpath("//*[@class='android.widget.FrameLayout' and
    // @index='0']")).click();
    driver.findElementByName("Add to MiDrive").click();

    driver.findElementByAccessibilityId("More").click();
    driver.findElementByName("Delete").click();
    driver.findElementByName("Cancel").click();

    driver.findElementByAccessibilityId("More").click();
    driver.findElementByName("Delete").click();
    driver.findElementByName("Delete").click();
    driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click();

    TouchAction tActionn1 = new TouchAction(driver); // Tap function
    tActionn1.tap(150, 301).release().perform();
    WebDriver augmentedDriver = new Augmenter().augment(driver); // Landscape orientation
    ((Rotatable) augmentedDriver).rotate(ScreenOrientation.LANDSCAPE); // Landscape orientation
    WebDriver augmentedDriver1 = new Augmenter().augment(driver); // Landscape orientation
    ((Rotatable) augmentedDriver1).rotate(ScreenOrientation.PORTRAIT);
    for (int i = 0; i <= 0; i++) {
      driver
          .findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon"))
          .click(); // Back key twice
    }
  }
  @Test
  public void E_collectionscreen() {

    driver.findElement(By.name("Collections")).click();
    WebElement plus =
        driver.findElement(By.id("com.mimedia.gallery:id/merged_collection_list_create"));
    plus.click();
    driver.findElement(By.name("New collection")).sendKeys("Simone");
    driver.findElement(By.name("Create")).click();
    driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click();
    List<WebElement> editBox =
        driver.findElements(By.className("android.view.View")); // select collections folder
    editBox.get(6).click();
    driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click();
  }
  @Test
  public void G_sharing() {
    // driver.findElement(By.name("Gallery")).click();
    // List<WebElement> editBox=driver.findElements(By.className("android.widget.TextView"));
    // editBox.get(3).click();
    List<WebElement> collection1 =
        driver.findElements(By.className("android.view.View")); // Taping on Collection folder
    collection1.get(5).click();
    driver.findElement(By.xpath("//*[@class='android.view.View' and @index='2']")).click();

    // TouchAction tActionn=new TouchAction(driver); //Tap function
    // tActionn.tap(150,301).release().perform();
    driver.findElementByAccessibilityId("Share").click();
    driver.navigate().back();
    driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click();
  }
Exemplo n.º 4
0
  @Test
  public void testBeHealthier() throws InterruptedException {
    // Chose Be Healthier Program
    driver.findElement(By.name("Be Healthier")).click();
    // Select Age Button
    driver.findElement(By.id("button_age")).click();
    // Swipe Across Months
    driver.swipe(192, 681, 192, 879, 1000);
    // Swipe Across Days
    driver.swipe(432, 681, 432, 1015, 2000);
    // Swipe Across years
    driver.swipe(672, 681, 672, 1450, 3000);
    // Click OK after selecting date of birth
    driver.findElement(By.id("button1")).click();
    // Select Age Button to get entered birthday
    String dateOfBirth = driver.findElement(By.id("button_age")).getText();
    // Select Male as a sex
    driver.findElement(By.id("radio_male")).click();
    // Click continue to next Screen
    driver.findElement(By.id("button_continue")).click();
    // Enter height
    driver.findElement(By.id("edittext_kg")).sendKeys("172");
    // Click continue to next Screen
    driver.findElement(By.id("button_continue")).click();
    // Enter weight
    driver.findElement(By.id("edittext_kg")).sendKeys("72");
    // Click continue to next Screen
    driver.findElement(By.id("button_continue")).click();
    // Wait until personalizing the app
    Thread.sleep(20000);
    // Skip first meal
    driver.findElement(By.id("skip_button")).click();
    // Wait until getting plan page
    Thread.sleep(5000);
    // Get target calories per day to assert latter
    String targetCaloriesPerDay = driver.findElement(By.id("textview_diary_left_value1")).getText();
    // Press the menu button
    driver
        .findElement(By.id("toolbar"))
        .findElement(By.className("android.widget.ImageButton"))
        .click();
    ;
    Thread.sleep(1000);
    // Press Settings
    driver.findElement(By.name("Settings")).click();
    Thread.sleep(1000);
    // Press Personal Details
    driver.findElement(By.name("Personal Details")).click();
    Thread.sleep(1000);

    // Assert stored values against entered values
    collector.checkThat(
        "Assert Main Screen Target Calories Per Day",
        targetCaloriesPerDay,
        CoreMatchers.equalTo("2250"));
    collector.checkThat(
        "Assert Curren tWeight ",
        driver.findElements(By.id("textview_second")).get(0).getText(),
        CoreMatchers.equalTo("72 kg"));
    collector.checkThat(
        "Assert Calories Per Day ",
        "2250 kcal",
        CoreMatchers.equalTo(driver.findElements(By.id("textview_second")).get(1).getText()));
    collector.checkThat(
        "Assert Height ",
        driver.findElements(By.id("textview_second")).get(2).getText(),
        CoreMatchers.equalTo("172 cm"));
    collector.checkThat(
        "Assert Date Of Birth ",
        driver.findElements(By.id("textview_second")).get(3).getText(),
        CoreMatchers.equalTo(dateOfBirth));
    collector.checkThat(
        "Assert Gender ",
        driver.findElements(By.id("textview_second")).get(4).getText(),
        CoreMatchers.equalTo("Male"));

    // Press the back button to log out
    driver
        .findElement(By.id("action_bar"))
        .findElement(By.className("android.widget.ImageButton"))
        .click();
    driver.scrollTo("Log out").click();
    driver.findElement(By.id("button1")).click();
    // Wait 10 seconds before starting next test case
    Thread.sleep(10000);
    driver.quit();
  }