Commit 2d7bdae4 authored by Sergey Nazarenko's avatar Sergey Nazarenko
Browse files

Changed architecture.

Made Capabilities single class
parent eaad682e
This diff is collapsed.
......@@ -38,7 +38,6 @@ public class LoginPage {
public void invalidLogin() throws InterruptedException {
wait(10);
driver.findElement(signIn).click();
for (String invalidPhone : invalidLoginPhone) {
driver.findElement(phoneInput).clear();
......
......@@ -2,6 +2,7 @@ package Utils;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.Wait;
import java.net.MalformedURLException;
......@@ -15,29 +16,29 @@ public class AndroidSetup
}
public static String White = "2101322bd623a34a";
public static String Black = "42031589dcde8100";
private String UDID;
public String UDID = White;
private String Path = "/home/master/Desktop/Snaapy_07.07.17_11.15.apk";
private String Platform = "Android";
private String DeviceName = "device";
private String AutomationName = "Appium";
String device;
public String GetUDID(String UDID) throws InterruptedException {
public String getUDID(String device) throws InterruptedException, MalformedURLException {
if (UDID == Black)
if (UDID == White)
{
device = Black;
Capabilities(Black);
device = White;
capabilities(White);
}
else
{
Capabilities(White);
capabilities(Black);
}
return device;
}
private void Capabilities(String device) throws InterruptedException {
public void capabilities(String device) throws InterruptedException, MalformedURLException {
this.UDID = device;
DesiredCapabilities capabilities = new DesiredCapabilities();
......@@ -47,10 +48,6 @@ public class AndroidSetup
capabilities.setCapability("udid", UDID);
capabilities.setCapability("deviceName", DeviceName);
capabilities.setCapability("app", Path);
try {
AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
} catch (MalformedURLException e) {
e.printStackTrace();
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
}
}
......@@ -8,6 +8,7 @@ import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.*;
import Pages.LoginPage;
import java.net.MalformedURLException;
import java.net.URL;
import static Utils.AndroidSetup.Black;
......@@ -17,17 +18,20 @@ import static Utils.AndroidSetup.White;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class AppiumTest
{
AndroidDriver driver;
AndroidSetup androidSetup = new AndroidSetup(driver);
public AppiumTest() {
this.driver = driver;
}
@BeforeTest
public void setUp() throws Exception
{
public void setUp() throws MalformedURLException, InterruptedException {
//Here you change device UDID (ex. Black or White samsung)
//If you want to add new UDID, set it up in Utils/AndroidSetup.java
androidSetup.GetUDID(Black);
androidSetup.getUDID(White);
// DesiredCapabilities capabilities = new DesiredCapabilities();
// capabilities.setCapability("automationName", "Appium");
// capabilities.setCapability("platformName", "Android");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment