package test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileBy;
import io.appium.java_client.ios.IOSDriver;

import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;

import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.parser.JSONParser;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;

/**
 *
 * 
 * @author Feliks Rozenberg frozenbe@alumni.uwo.ca
 */
@SuppressWarnings("deprecation")
public class SimpleAppiumTest {

	private AppiumDriver<WebElement> driver;

	@Before
	public void setUp() throws Exception {
		// set up appium
		String appPath = System.getProperty("appPath");
		System.out.println("appPath: " + appPath);
		File app = new File(appPath);

		DesiredCapabilities capabilities = new DesiredCapabilities();
		capabilities.setCapability("platformVersion", "8.1");
		capabilities.setCapability("deviceName", "iPhone 6");
		capabilities.setCapability("app", app.getAbsolutePath());
		driver = new IOSDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
	}

	@After
	public void tearDown() throws Exception {
		driver.quit();
	}

	@Test
	public void testSignInValidCreds() throws Exception {

		Thread.sleep(3000);
		// Fill in and submit
		driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAElement[1]/UIAScrollView[1]/UIATextField[1]"))
				.sendKeys("frozenbe@alumni.uwo.ca");
		Thread.sleep(1000);
		driver.findElement(
				By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAElement[1]/UIAScrollView[1]/UIASecureTextField[1]"))
				.sendKeys("uniiverse");
		driver.findElement(MobileBy.AccessibilityId("Sign In")).click();
		Thread.sleep(3000);

		// Allow camera
		driver.switchTo().alert().accept();
		Thread.sleep(5000);

		// Switch tab
		driver.findElement(MobileBy.AccessibilityId("Sell")).click();
		Thread.sleep(5000);

		assertTrue(driver.findElement(MobileBy.AccessibilityId("Synthetic Free Listing")).isDisplayed());

	}

}

@@ -1832,16 +1832,48 @@
 idCreds(
+String userName, String password
 ) throws
@@ -1885,16 +1885,16 @@
 ption %7B%0A
-
 %0A%09%09Threa
@@ -2064,32 +2064,16 @@
 eys(
-%22frozenbe@alumni.uwo.ca%22
+userName
 );%0A%09
@@ -2236,19 +2236,16 @@
 eys(
-%22uniiverse%22
+password
 );%0A%09

Update SimpleAppiumTest.java