Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Created July 15, 2022 16:42
Show Gist options
  • Save SarahElson/deffdd31fc1c19e135a40c1015a4264e to your computer and use it in GitHub Desktop.
Save SarahElson/deffdd31fc1c19e135a40c1015a4264e to your computer and use it in GitHub Desktop.
Automated App Testing Using Appium With TestNG [Tutorial]
package com.lambdatest.appium.sample.ios;
import static com.lambdatest.appium.sample.enums.Platform.IOS;
import static org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
import java.net.MalformedURLException;
import com.lambdatest.appium.sample.BaseTest;
import com.lambdatest.appium.sample.enums.Environment;
import com.lambdatest.appium.sample.enums.Platform;
import com.lambdatest.appium.sample.pages.HomePage;
import com.lambdatest.appium.sample.utils.Swipe;
import io.appium.java_client.MobileElement;
import io.appium.java_client.ios.IOSDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
// 1.
public class IOSTest extends BaseTest<IOSDriver<MobileElement>> {
private static final Platform PLATFORM = IOS;
private HomePage homePage;
// 2.
@Parameters ({ "environment", "deviceName", "version", "app" })
@BeforeTest
public void setupDriver (final Environment environment, final String deviceName, final String version,
final String app) throws MalformedURLException {
this.homePage = new HomePage ();
this.driver = new IOSDriver<> (getUrl (environment), getOptions (environment, "iOS", deviceName, version, app));
this.wait = new WebDriverWait (this.driver, 10);
this.swipe = new Swipe<> (this.driver);
}
// 3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment