Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.appium_tests;
- import io.appium.java_client.remote.AndroidMobileCapabilityType;
- import io.appium.java_client.android.AndroidDriver;
- import io.appium.java_client.android.AndroidElement;
- import io.appium.java_client.TouchAction;
- import java.time.Duration;
- import io.appium.java_client.remote.MobileCapabilityType;
- import io.appium.java_client.touch.WaitOptions;
- import io.appium.java_client.touch.offset.PointOption;
- import org.openqa.selenium.support.ui.ExpectedConditions;
- import org.openqa.selenium.support.ui.WebDriverWait;
- import org.openqa.selenium.remote.DesiredCapabilities;
- import org.openqa.selenium.By;
- import org.junit.jupiter.api.*;
- import java.net.URL;
- import java.net.MalformedURLException;
- import java.util.List;
- import java.util.logging.Level;
- public class tc4_tirage_classic {
- private AndroidDriver<AndroidElement> driver;
- private DesiredCapabilities dc;
- public tc4_tirage_classic(AndroidDriver driver, DesiredCapabilities dc) {
- this.driver = driver;
- this.dc = dc;
- }
- public void testtc4_tirage_classic() {
- //driver.context("NATIVE_APP");
- System.out.println(driver.toString());
- //Wait Family range screen
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("range_background")));
- TestCase.swipe(driver);
- TestCase.swipe(driver);
- driver.findElement(By.id("range_background")).click();
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("range_background")));
- driver.findElement(By.id("range_background")).click();
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("main_button")));
- driver.findElement(By.id("main_button")).click();
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("tv_quantity_price")));
- driver.findElement(By.id("tv_quantity_price")).click();
- /* //Access to device's library = FIRST TIME only !!!
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("permission_allow_button")));
- driver.findElement(By.id("permission_allow_button")).click();
- */
- //Select album > photos
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("adapter_album_grid_name_album")));
- driver.findElement(By.id("adapter_album_grid_name_album")).click();
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("adapter_picture_grid_thumbnail")));
- List<AndroidElement> myElements = driver.findElements(By.id("adapter_picture_grid_thumbnail"));
- if (!myElements.isEmpty()) {
- for (int i = 0; i < 4; i++) {
- myElements.get(i).click();
- }
- }
- driver.findElement(By.id("main_button")).click();
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("main_button")));
- driver.findElement(By.id("main_button")).click();
- //Cart screen
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("main_button")));
- driver.findElement(By.id("main_button")).click();
- //Sign Up > Sign In screen
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("activity_register_goto_login")));
- driver.findElement(By.id("activity_register_goto_login")).click();
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- String UserEmail = "a241.zubovych@gmail.com";
- String UserPassword = "dui1zsx023";
- driver.findElements(By.id("edit_field")).get(0).click();
- driver.findElements(By.id("edit_field")).get(0).clear();
- driver.findElements(By.id("edit_field")).get(0).sendKeys(UserEmail);
- driver.findElements(By.id("edit_field")).get(1).click();
- driver.findElements(By.id("edit_field")).get(1).clear();
- driver.findElements(By.id("edit_field")).get(1).sendKeys(UserPassword);
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("main_button")));
- driver.findElement(By.id("main_button")).click();
- //Wait Cart screen again
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("main_button")));
- driver.findElement(By.id("main_button")).click();
- //Shipper screen
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='shipper_name']")));
- driver.findElement(By.id("main_button")).click();
- driver.findElement(By.id("main_button")).click();
- driver.findElement(By.id("rb_cb")).click();
- driver.findElement(By.id("et_add_source_card_number_ml")).sendKeys("4242424242424242");
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("keyboardView")));
- driver.findElement(By.id("et_add_source_expiry_ml")).click();
- driver.findElement(By.id("et_add_source_expiry_ml")).sendKeys("1122");
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("keyboardView")));
- driver.findElement(By.id("et_add_source_cvc_ml")).click();
- driver.findElement(By.id("et_add_source_cvc_ml")).sendKeys("333");
- new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("back")));
- // driver.findElement(By.xpath("//*[@id='back']")).click();
- driver.findElement(By.id("main_button")).click();
- driver.findElement(By.id("main_button")).click();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement