├── .DS_Store
├── .gitignore
├── app
├── proverbial_android.apk
└── proverbial_ios.ipa
├── pom.xml
├── readme.md
├── src
├── main
│ └── java
│ │ └── io
│ │ └── github
│ │ └── mfaisalkhatri
│ │ ├── drivers
│ │ ├── AndroidDriverManager.java
│ │ └── IOSDriverManager.java
│ │ ├── server
│ │ └── ServiceManager.java
│ │ └── utilities
│ │ └── Helper.java
└── test
│ └── java
│ └── io
│ └── github
│ └── mfaisalkhatri
│ └── mobileautomation
│ ├── pages
│ ├── android
│ │ ├── BrowserPage.java
│ │ ├── GeoLocationPage.java
│ │ ├── HomePage.java
│ │ ├── IPLocationPage.java
│ │ ├── NotificationPage.java
│ │ └── SpeedTestPage.java
│ └── ios
│ │ ├── findmyapp
│ │ ├── Device.java
│ │ └── MainPage.java
│ │ └── proverbialapp
│ │ ├── BrowserPage.java
│ │ ├── GeoLocationPage.java
│ │ ├── HomePage.java
│ │ ├── NotificationPage.java
│ │ └── SpeedTestPage.java
│ └── tests
│ ├── android
│ ├── AndroidTests.java
│ ├── BaseTest.java
│ └── ProverbialAppNotificationTests.java
│ └── ios
│ ├── BaseTest.java
│ └── IOSTests.java
└── testng.xml
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mfaisalkhatri/react-native-app-tests/51613dee2c4fa7d0bba85e387fe5a24ae4f61b8c/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # IntelliJ IDEA
2 | /.idea/
3 | *.iml
4 | .DS_Store
5 |
6 | # Other output folders
7 | /target/
8 | /bin/
9 | /test-output/
10 | /logs/
11 | /reports/
12 | /.vscode/
13 | *.png
--------------------------------------------------------------------------------
/app/proverbial_android.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mfaisalkhatri/react-native-app-tests/51613dee2c4fa7d0bba85e387fe5a24ae4f61b8c/app/proverbial_android.apk
--------------------------------------------------------------------------------
/app/proverbial_ios.ipa:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mfaisalkhatri/react-native-app-tests/51613dee2c4fa7d0bba85e387fe5a24ae4f61b8c/app/proverbial_ios.ipa
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | io.github.mfaisalkhatri
8 | react-native-app-mobile-testing
9 | 1.0-SNAPSHOT
10 |
11 |
12 | 9.2.2
13 | 7.9.0
14 | 1.18.32
15 | 3.13.0
16 | 3.2.5
17 | 2.16.0
18 | 17
19 | UTF-8
20 | testng.xml
21 | -Dfile.encoding=UTF-8 -Xdebug -Xnoagent
22 | UTF-8
23 |
24 |
25 |
26 |
27 |
28 | org.testng
29 | testng
30 | ${testng-version}
31 | test
32 |
33 |
34 |
35 | io.appium
36 | java-client
37 | ${appium-java-client-version}
38 |
39 |
40 |
41 | org.projectlombok
42 | lombok
43 | ${lombok-version}
44 | provided
45 |
46 |
47 |
48 | commons-io
49 | commons-io
50 | ${commons-io.version}
51 |
52 |
53 |
54 |
55 |
56 |
57 | org.apache.maven.plugins
58 | maven-compiler-plugin
59 | ${maven.compiler.version}
60 |
61 | ${java.release.version}
62 | ${maven.source.encoding}
63 | true
64 |
65 |
66 |
67 | org.apache.maven.plugins
68 | maven-surefire-plugin
69 | ${surefire-version}
70 |
71 |
72 |
73 | test
74 |
75 |
76 |
77 |
78 | false
79 |
80 |
81 | usedefaultlisteners
82 | false
83 |
84 |
85 |
86 | ${suite-xml}
87 |
88 | ${argLine}
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 |
2 | 
3 |
4 | ## Don't forget to give a :star: to make the project popular.
5 |
6 | ## :question: What is this Repository about?
7 | - This repo contains automation tests of Proverbial app built in react-native by [LambdaTest](https://www.lambdatest.com/)
8 | - Appium framework is used to write the mobile automation tests
9 | - This repo uses Maven as build tool and TestNG testing framework to run the tests.
10 | - To run the test from command line use the following command:
11 | - `mvn clean install -DLT_USERNAME= -DLT_ACCESS_KEY=`
12 |
13 | ## :writing_hand: Blog Links
14 |
15 | - [React Native Testing For Apps On iOS And Android Using Appium](https://www.lambdatest.com/blog/test-react-native-apps-on-ios-and-android/)
16 | - [Complete Tutorial On Appium Parallel Testing - With Examples](https://www.lambdatest.com/blog/appium-parallel-testing/)
17 | - [How to Choose Mobile Devices for Testing](https://medium.com/@iamfaisalkhatri/how-to-choose-mobile-devices-for-testing-pcloudy-blog-96179529d0f3)
18 | - [What is an Android Emulator? How to Start and use it?](https://medium.com/@iamfaisalkhatri/what-is-an-android-emulator-how-to-start-and-use-it-66fdcf52be7e)
19 | - [How to start Appium Server Programmatically?](https://medium.com/@iamfaisalkhatri/how-to-start-appium-server-programmatically-ec07292ab59)
20 | - [Guide to Mobile Testing](https://medium.com/@iamfaisalkhatri/guide-to-mobile-testing-d0dd2d9b59f1)
21 |
22 |
23 |
24 | 🧬 Need Assistance?
25 |
26 | - Discuss your queries by writing to me @ `mohammadfaisalkhatri@gmail.com`
27 | OR ping me on any of the social media sites using the below link:
28 | - [Linktree](https://linktr.ee/faisalkhatri)
29 |
30 |
31 | ## :thought_balloon: Checkout the blogs related to Testing on [my website](https://mfaisalkhatri.github.io) and [medium](https://medium.com/@iamfaisalkhatri) and on [LambdaTest Blogs](https://www.lambdatest.com/blog/author/mfaisalkhatri/)
32 |
--------------------------------------------------------------------------------
/src/main/java/io/github/mfaisalkhatri/drivers/AndroidDriverManager.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.drivers;
2 |
3 | import io.appium.java_client.MobileCommand;
4 | import io.appium.java_client.android.AndroidDriver;
5 | import io.appium.java_client.android.options.UiAutomator2Options;
6 | import io.appium.java_client.remote.MobilePlatform;
7 | import io.appium.java_client.service.local.flags.GeneralServerFlag;
8 | import lombok.Builder;
9 | import lombok.SneakyThrows;
10 | import org.openqa.selenium.Capabilities;
11 | import org.openqa.selenium.remote.CapabilityType;
12 |
13 | import java.net.URL;
14 | import java.time.Duration;
15 | import java.util.HashMap;
16 |
17 | import static java.text.MessageFormat.format;
18 |
19 | @Builder
20 | public class AndroidDriverManager {
21 |
22 | private static final ThreadLocal DRIVER = new ThreadLocal<>();
23 |
24 | private String buildName;
25 | private String testName;
26 | private String platformName;
27 | private String platformVersion;
28 | private String deviceName;
29 | private String app;
30 | private static final String LT_USERNAME = System.getenv("LT_USERNAME");
31 | private static final String LT_ACCESS_KEY = System.getenv("LT_ACCESS_KEY");
32 | private static final String GRID_URL = "@mobile-hub.lambdatest.com/wd/hub";
33 |
34 |
35 | @SneakyThrows
36 | public AndroidDriverManager createAndroidDriver() {
37 | DRIVER.set(new AndroidDriver(new URL(format("https://{0}:{1}{2}", LT_USERNAME, LT_ACCESS_KEY, GRID_URL)),
38 | uiAutomator2Options()));
39 | setupDriverTimeouts();
40 | return this;
41 | }
42 |
43 |
44 | public AndroidDriver getDriver() {
45 | return DRIVER.get();
46 | }
47 |
48 | public void quitDriver() {
49 | if (null != DRIVER.get()) {
50 | getDriver().quit();
51 | DRIVER.remove();
52 | }
53 | }
54 |
55 | private void setupDriverTimeouts() {
56 | getDriver().manage()
57 | .timeouts()
58 | .implicitlyWait(Duration.ofSeconds(30));
59 | }
60 |
61 |
62 | private UiAutomator2Options uiAutomator2Options() {
63 | final UiAutomator2Options uiAutomator2Options = new UiAutomator2Options();
64 | uiAutomator2Options
65 | .setAutoGrantPermissions(true)
66 | .withBrowserName("Chrome")
67 | .setCapability("lt:Options", getLambdaTestOptions());
68 |
69 | return uiAutomator2Options;
70 | }
71 |
72 |
73 | private HashMap getLambdaTestOptions() {
74 | final HashMap ltOptions = new HashMap<>();
75 | ltOptions.put("w3c", true);
76 | ltOptions.put("platformName", this.platformName);
77 | ltOptions.put("platformVersion", this.platformVersion);
78 | ltOptions.put("deviceName", this.deviceName);
79 | ltOptions.put("app", this.app);
80 | ltOptions.put("build", this.buildName);
81 | ltOptions.put("name", this.testName);
82 | ltOptions.put("autoGrantPermissions", true);
83 | ltOptions.put("isRealMobile", true);
84 | ltOptions.put("visual", true);
85 | ltOptions.put("console", true);
86 | ltOptions.put("devicelog", true);
87 | HashMap locationObj = new HashMap<>();
88 | locationObj.put("lat", "51.5072");
89 | locationObj.put("long", "0.1276");
90 | ltOptions.put("location", locationObj);
91 | ltOptions.put("plugin", "java-testNG");
92 | return ltOptions;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/src/main/java/io/github/mfaisalkhatri/drivers/IOSDriverManager.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.drivers;
2 |
3 | import io.appium.java_client.ios.IOSDriver;
4 | import io.appium.java_client.ios.options.XCUITestOptions;
5 | import lombok.Builder;
6 | import lombok.SneakyThrows;
7 | import org.openqa.selenium.remote.DesiredCapabilities;
8 |
9 | import java.net.URL;
10 | import java.time.Duration;
11 | import java.util.HashMap;
12 |
13 | import static java.text.MessageFormat.format;
14 |
15 | @Builder
16 | public class IOSDriverManager {
17 | private static final ThreadLocal DRIVER = new ThreadLocal<>();
18 | private String buildName;
19 | private String testName;
20 | private String platformName;
21 | private String platformVersion;
22 | private String deviceName;
23 | private String app;
24 | private static final String LT_USERNAME = System.getenv("LT_USERNAME");
25 | private static final String LT_ACCESS_KEY = System.getenv("LT_ACCESS_KEY");
26 | private static final String GRID_URL = "@mobile-hub.lambdatest.com/wd/hub";
27 |
28 |
29 | @SneakyThrows
30 | public IOSDriverManager createIOSDriver() {
31 | DRIVER.set(new IOSDriver(new URL(format("https://{0}:{1}{2}", LT_USERNAME, LT_ACCESS_KEY, GRID_URL)),
32 | xcuiTestOptions()));
33 | setupDriverTimeouts();
34 | return this;
35 | }
36 |
37 |
38 | private XCUITestOptions xcuiTestOptions() {
39 | final XCUITestOptions xcuiTestOptions = new XCUITestOptions();
40 | xcuiTestOptions
41 | .setAutoAcceptAlerts(true)
42 | .setAutoDismissAlerts(true)
43 | .withBrowserName("chrome")
44 | .setCapability("lt:Options", getLambdaTestOptions());
45 |
46 | return xcuiTestOptions;
47 | }
48 |
49 | public IOSDriver getDriver() {
50 | return DRIVER.get();
51 | }
52 |
53 |
54 | public void quitDriver() {
55 | if (null != DRIVER.get()) {
56 | getDriver().quit();
57 | DRIVER.remove();
58 | }
59 | }
60 |
61 | private void setupDriverTimeouts() {
62 | getDriver().manage()
63 | .timeouts()
64 | .implicitlyWait(Duration.ofSeconds(30));
65 | }
66 |
67 | private HashMap getLambdaTestOptions() {
68 | final HashMap ltOptions = new HashMap<>();
69 | ltOptions.put("w3c", true);
70 | ltOptions.put("platformName", this.platformName);
71 | ltOptions.put("platformVersion", this.platformVersion);
72 | ltOptions.put("deviceName", this.deviceName);
73 | ltOptions.put("app", this.app);
74 | ltOptions.put("build", this.buildName);
75 | ltOptions.put("name", this.testName);
76 | ltOptions.put("autoAcceptAlerts", true);
77 | ltOptions.put("autoDismissAlerts", true);
78 | ltOptions.put("isRealMobile", true);
79 | ltOptions.put("visual", true);
80 | ltOptions.put("console", true);
81 | ltOptions.put("devicelog", true);
82 | HashMap locationObj = new HashMap<>();
83 | locationObj.put("lat", "51.5072");
84 | locationObj.put("long", "0.1276");
85 | ltOptions.put("location", locationObj);
86 | ltOptions.put("plugin", "java-testNG");
87 | return ltOptions;
88 | }
89 |
90 |
91 |
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/src/main/java/io/github/mfaisalkhatri/server/ServiceManager.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.server;
2 |
3 | import io.appium.java_client.service.local.AppiumDriverLocalService;
4 | import io.appium.java_client.service.local.AppiumServiceBuilder;
5 | import io.appium.java_client.service.local.flags.GeneralServerFlag;
6 |
7 | public class ServiceManager {
8 |
9 | private static AppiumServiceBuilder serviceBuilder;
10 | private static AppiumDriverLocalService service;
11 |
12 | public static void startService () {
13 | serviceBuilder = new AppiumServiceBuilder ().usingAnyFreePort ()
14 | .withArgument (GeneralServerFlag.SESSION_OVERRIDE)
15 | .withArgument (GeneralServerFlag.LOG_LEVEL, "true");
16 | service = AppiumDriverLocalService.buildService (serviceBuilder);
17 | service.start ();
18 | }
19 |
20 | public static void stopService () {
21 | service.stop ();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/io/github/mfaisalkhatri/utilities/Helper.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.utilities;
2 |
3 | import io.github.mfaisalkhatri.drivers.AndroidDriverManager;
4 | import lombok.SneakyThrows;
5 | import org.openqa.selenium.WebElement;
6 |
7 | public class Helper {
8 |
9 | AndroidDriverManager driverManager;
10 |
11 | public Helper (final AndroidDriverManager driverManager) {
12 | this.driverManager = driverManager;
13 | }
14 |
15 | public static void clickOn (WebElement element) {
16 | element.click ();
17 | }
18 |
19 | @SneakyThrows
20 | public static void waitForsomeTime () {
21 | Thread.sleep (2000);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/android/BrowserPage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.android;
2 |
3 | import static io.github.mfaisalkhatri.utilities.Helper.clickOn;
4 | import static io.github.mfaisalkhatri.utilities.Helper.waitForsomeTime;
5 |
6 | import io.appium.java_client.AppiumBy;
7 | import io.github.mfaisalkhatri.drivers.AndroidDriverManager;
8 | import org.openqa.selenium.WebElement;
9 |
10 | public class BrowserPage {
11 |
12 | private AndroidDriverManager driverManager;
13 |
14 | public BrowserPage (final AndroidDriverManager driverManager) {
15 | this.driverManager = driverManager;
16 | }
17 |
18 | public WebElement searchBox () {
19 | return driverManager.getDriver ()
20 | .findElement (AppiumBy.id ("url"));
21 | }
22 |
23 | public void searchFor (String url) {
24 | searchBox ().sendKeys (url);
25 | clickOn (findBtn ());
26 | waitForsomeTime ();
27 | }
28 |
29 | public WebElement findBtn () {
30 | return driverManager.getDriver ()
31 | .findElement (AppiumBy.id ("find"));
32 | }
33 |
34 | public void navigateToHomePage () {
35 | driverManager.getDriver ()
36 | .navigate ()
37 | .back ();
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/android/GeoLocationPage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.android;
2 |
3 | import java.time.Duration;
4 |
5 | import io.appium.java_client.AppiumBy;
6 | import io.github.mfaisalkhatri.drivers.AndroidDriverManager;
7 | import org.openqa.selenium.WebElement;
8 | import org.openqa.selenium.support.ui.ExpectedConditions;
9 | import org.openqa.selenium.support.ui.WebDriverWait;
10 |
11 | public class GeoLocationPage {
12 |
13 | private final AndroidDriverManager driverManager;
14 | private final WebDriverWait wait;
15 |
16 | public GeoLocationPage (final AndroidDriverManager driverManager) {
17 | this.driverManager = driverManager;
18 | this.wait = new WebDriverWait (driverManager.getDriver (), Duration.ofSeconds (30));
19 | }
20 |
21 | public WebElement content () {
22 | return this.wait.until (ExpectedConditions.presenceOfElementLocated (AppiumBy.id ("android:id/content")));
23 | }
24 |
25 | public void navigateToHomePage () {
26 | this.driverManager.getDriver ()
27 | .navigate ()
28 | .back ();
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/android/HomePage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.android;
2 |
3 | import java.time.Duration;
4 |
5 | import io.appium.java_client.AppiumBy;
6 | import io.github.mfaisalkhatri.drivers.AndroidDriverManager;
7 | import org.openqa.selenium.WebElement;
8 | import org.openqa.selenium.support.ui.ExpectedConditions;
9 | import org.openqa.selenium.support.ui.WebDriverWait;
10 |
11 | public class HomePage {
12 |
13 | AndroidDriverManager driverManager;
14 | WebDriverWait wait;
15 |
16 | public HomePage (final AndroidDriverManager driverManager) {
17 | this.driverManager = driverManager;
18 | wait = new WebDriverWait (driverManager.getDriver (), Duration.ofSeconds (20));
19 | }
20 |
21 | public WebElement textBtn () {
22 | return driverManager.getDriver ()
23 | .findElement (AppiumBy.id ("Text"));
24 | }
25 |
26 | public String getText () {
27 | return driverManager.getDriver ()
28 | .findElement (AppiumBy.id ("Textbox"))
29 | .getText ();
30 | }
31 |
32 | public WebElement notificationBtn () {
33 | return driverManager.getDriver ()
34 | .findElement (AppiumBy.id ("notification"));
35 | }
36 |
37 | public WebElement notificationBar () {
38 | return driverManager.getDriver ()
39 | .findElement (AppiumBy.id ("action_bar"));
40 | }
41 |
42 | public WebElement toastBtn () {
43 | return driverManager.getDriver ()
44 | .findElement (AppiumBy.id ("toast"));
45 | }
46 |
47 | public String toastMessage () {
48 | return wait.until (ExpectedConditions.presenceOfElementLocated (AppiumBy.xpath ("//android.widget.Toast[1]")))
49 | .getText ();
50 | }
51 |
52 | public WebElement geoLocationBtn () {
53 | return driverManager.getDriver ()
54 | .findElement (AppiumBy.id ("geoLocation"));
55 | }
56 |
57 | public WebElement speedTestBtn () {
58 | return driverManager.getDriver ()
59 | .findElement (AppiumBy.id ("speedTest"));
60 | }
61 |
62 | public WebElement browserMenu () {
63 | return driverManager.getDriver ()
64 | .findElement (AppiumBy.accessibilityId ("Browser"));
65 | }
66 |
67 | public void openMenu () {
68 | driverManager.getDriver ().findElement (AppiumBy.accessibilityId ("drawer open")).click ();
69 | }
70 |
71 | public void clickPushNotificationMenu () {
72 | driverManager.getDriver ().findElement (AppiumBy.id ("pushNotification")).click ();
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/android/IPLocationPage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.android;
2 |
3 | import io.github.mfaisalkhatri.drivers.AndroidDriverManager;
4 | import org.openqa.selenium.By;
5 | import org.openqa.selenium.support.ui.ExpectedConditions;
6 | import org.openqa.selenium.support.ui.WebDriverWait;
7 |
8 | import java.time.Duration;
9 |
10 | public class IPLocationPage {
11 |
12 | private AndroidDriverManager driverManager;
13 | private WebDriverWait wait;
14 |
15 | public IPLocationPage (final AndroidDriverManager driverManager) {
16 | this.driverManager = driverManager;
17 | wait = new WebDriverWait (driverManager.getDriver (), Duration.ofSeconds (30));
18 | }
19 |
20 | public String getCountryText() {
21 | return wait.until(ExpectedConditions.visibilityOfElementLocated
22 | (By.cssSelector(".table > tbody > tr:nth-child(4) > td"))).getText();
23 | }
24 |
25 | public String getLatitude() {
26 | return wait.until(ExpectedConditions.visibilityOfElementLocated
27 | (By.cssSelector(".table > tbody > tr:nth-child(2) > td"))).getText();
28 | }
29 |
30 | public String getLongitude() {
31 | return wait.until(ExpectedConditions.visibilityOfElementLocated
32 | (By.cssSelector(".table > tbody > tr:nth-child(3) > td"))).getText();
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/android/NotificationPage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.android;
2 |
3 | import java.util.List;
4 |
5 | import io.appium.java_client.android.AndroidDriver;
6 | import io.github.mfaisalkhatri.drivers.AndroidDriverManager;
7 | import org.openqa.selenium.By;
8 | import org.openqa.selenium.WebElement;
9 |
10 | /**
11 | * @author Faisal Khatri
12 | * @since 1/13/2023
13 | **/
14 | public class NotificationPage {
15 |
16 | AndroidDriverManager driverManager;
17 |
18 | public NotificationPage (final AndroidDriverManager driverManager) {
19 | this.driverManager = driverManager;
20 | }
21 |
22 | private List notificationTitles () {
23 | return driverManager.getDriver ()
24 | .findElements (By.id ("android:id/title"));
25 | }
26 |
27 | public String getFirstNotificationTitle () {
28 | return notificationTitles ().get (0)
29 | .getText ();
30 | }
31 |
32 | private List notificationTexts () {
33 | return driverManager.getDriver ()
34 | .findElements (By.id ("android:id/text"));
35 | }
36 |
37 | public String getFirstNotificationText () {
38 | return notificationTexts ().get (0)
39 | .getText ();
40 | }
41 |
42 | public void openNotificationPanel () {
43 | driverManager.getDriver ()
44 | .openNotifications ();
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/android/SpeedTestPage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.android;
2 |
3 | import io.appium.java_client.AppiumBy;
4 | import io.github.mfaisalkhatri.drivers.AndroidDriverManager;
5 | import org.openqa.selenium.WebElement;
6 |
7 | public class SpeedTestPage {
8 |
9 | private final AndroidDriverManager driverManager;
10 |
11 | public SpeedTestPage (final AndroidDriverManager driverManager) {
12 | this.driverManager = driverManager;
13 | }
14 |
15 | public WebElement headerText () {
16 | return this.driverManager.getDriver ()
17 | .findElement (AppiumBy.accessibilityId ("Speedtest"));
18 | }
19 |
20 | public void navigateToHomePage () {
21 | this.driverManager.getDriver ()
22 | .navigate ()
23 | .back ();
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/ios/findmyapp/Device.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.ios.findmyapp;
2 |
3 | import io.appium.java_client.AppiumBy;
4 | import io.github.mfaisalkhatri.drivers.IOSDriverManager;
5 |
6 | /**
7 | * @author Faisal Khatri
8 | * @since 1/12/2023
9 | **/
10 | public class Device {
11 |
12 | private final IOSDriverManager iosDriverManager;
13 |
14 | public Device(final IOSDriverManager iosDriverManager) {
15 | this.iosDriverManager = iosDriverManager;
16 | }
17 |
18 | public void openFindMyApp () {
19 | iosDriverManager.getDriver()
20 | .findElement (AppiumBy.iOSNsPredicateString ("label==\"Find My\""))
21 | .click ();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/ios/findmyapp/MainPage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.ios.findmyapp;
2 |
3 | import static io.github.mfaisalkhatri.utilities.Helper.clickOn;
4 |
5 | import java.time.Duration;
6 |
7 | import io.appium.java_client.AppiumBy;
8 | import io.github.mfaisalkhatri.drivers.IOSDriverManager;
9 | import org.openqa.selenium.WebElement;
10 | import org.openqa.selenium.support.ui.WebDriverWait;
11 |
12 | /**
13 | * @author Faisal Khatri
14 | * @since 1/12/2023
15 | **/
16 | public class MainPage {
17 |
18 | private final IOSDriverManager iosDriverManager;
19 | private final WebDriverWait wait;
20 |
21 | public MainPage (final IOSDriverManager iosDriverManager) {
22 | this.iosDriverManager = iosDriverManager;
23 | wait = new WebDriverWait (iosDriverManager.getDriver (), Duration.ofSeconds (20));
24 | }
25 |
26 | private WebElement continueBtn () {
27 | return iosDriverManager.getDriver ()
28 | .findElement (AppiumBy.iOSClassChain (
29 | "**/XCUIElementTypeButton[`label == \"Continue\"`]**/XCUIElementTypeButton[`label == \"Continue\"`]"));
30 | }
31 |
32 | private WebElement devicesBtn () {
33 | return iosDriverManager.getDriver ()
34 | .findElement (AppiumBy.iOSNsPredicateString ("label == \"Devices\""));
35 | }
36 |
37 | private WebElement meButton () {
38 | return iosDriverManager.getDriver ()
39 | .findElement (AppiumBy.accessibilityId ("meButton"));
40 | }
41 |
42 | public boolean isDevicesBtnDisplayed (){
43 | return devicesBtn ().isDisplayed ();
44 | }
45 |
46 |
47 | public boolean isContinueBtnDisplayed () {
48 | return continueBtn ().isDisplayed ();
49 | }
50 |
51 | public void clickMeBtn () {
52 | clickOn (meButton ());
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/ios/proverbialapp/BrowserPage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.ios.proverbialapp;
2 |
3 | import static io.github.mfaisalkhatri.utilities.Helper.clickOn;
4 | import static io.github.mfaisalkhatri.utilities.Helper.waitForsomeTime;
5 |
6 | import io.appium.java_client.AppiumBy;
7 | import io.github.mfaisalkhatri.drivers.IOSDriverManager;
8 | import org.openqa.selenium.WebElement;
9 |
10 | public class BrowserPage {
11 |
12 | private final IOSDriverManager iosDriverManager;
13 |
14 | public BrowserPage (final IOSDriverManager iosDriverManager) {
15 | this.iosDriverManager = iosDriverManager;
16 | }
17 |
18 | public WebElement searchBox () {
19 | return this.iosDriverManager.getDriver ()
20 | .findElement (AppiumBy.accessibilityId ("url"));
21 | }
22 |
23 | public void searchFor (String url) {
24 | searchBox ().sendKeys (url);
25 | clickOn (findBtn ());
26 | waitForsomeTime ();
27 | }
28 |
29 | public WebElement findBtn () {
30 | return this.iosDriverManager.getDriver ()
31 | .findElement (AppiumBy.accessibilityId ("Find"));
32 | }
33 |
34 | public void navigateToHomePage () {
35 | this.iosDriverManager.getDriver ()
36 | .navigate ()
37 | .back ();
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/ios/proverbialapp/GeoLocationPage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.ios.proverbialapp;
2 |
3 | import static io.github.mfaisalkhatri.utilities.Helper.clickOn;
4 |
5 | import java.time.Duration;
6 |
7 | import io.appium.java_client.AppiumBy;
8 | import io.github.mfaisalkhatri.drivers.IOSDriverManager;
9 | import org.openqa.selenium.WebElement;
10 | import org.openqa.selenium.support.ui.ExpectedConditions;
11 | import org.openqa.selenium.support.ui.WebDriverWait;
12 |
13 | public class GeoLocationPage {
14 |
15 | private final IOSDriverManager iosDriverManager;
16 | private final WebDriverWait wait;
17 |
18 | public GeoLocationPage (final IOSDriverManager iosDriverManager) {
19 | this.iosDriverManager = iosDriverManager;
20 | this.wait = new WebDriverWait (iosDriverManager.getDriver (), Duration.ofSeconds (30));
21 | }
22 |
23 | public WebElement banner () {
24 | return this.wait.until (ExpectedConditions.presenceOfElementLocated (AppiumBy.accessibilityId ("banner")));
25 | }
26 |
27 | public WebElement backBtn () {
28 | return this.iosDriverManager.getDriver ()
29 | .findElement (AppiumBy.accessibilityId ("Back"));
30 | }
31 |
32 | public void navigateToHomePage () {
33 | clickOn (backBtn ());
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/ios/proverbialapp/HomePage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.ios.proverbialapp;
2 |
3 | import java.time.Duration;
4 |
5 | import io.appium.java_client.AppiumBy;
6 | import io.github.mfaisalkhatri.drivers.IOSDriverManager;
7 | import org.openqa.selenium.WebElement;
8 | import org.openqa.selenium.support.ui.ExpectedConditions;
9 | import org.openqa.selenium.support.ui.WebDriverWait;
10 |
11 | public class HomePage {
12 |
13 | private final IOSDriverManager iosDriverManager;
14 | private final WebDriverWait wait;
15 |
16 | public HomePage (final IOSDriverManager iosDriverManager) {
17 | this.iosDriverManager = iosDriverManager;
18 | this.wait = new WebDriverWait (iosDriverManager.getDriver (), Duration.ofSeconds (20));
19 | }
20 |
21 | public WebElement textBtn () {
22 | return this.iosDriverManager.getDriver ()
23 | .findElement (AppiumBy.accessibilityId ("Text"));
24 | }
25 |
26 | public String getText () {
27 | return this.iosDriverManager.getDriver ()
28 | .findElement (AppiumBy.accessibilityId ("Textbox"))
29 | .getText ();
30 | }
31 |
32 | public WebElement notificationBtn () {
33 | return this.iosDriverManager.getDriver ()
34 | .findElement (AppiumBy.accessibilityId ("notification"));
35 | }
36 |
37 | public WebElement notificationBar () {
38 | return this.wait.until (
39 | ExpectedConditions.presenceOfElementLocated (AppiumBy.accessibilityId ("NotificationShortLookView")));
40 | }
41 |
42 | public WebElement toastBtn () {
43 | return this.iosDriverManager.getDriver ()
44 | .findElement (AppiumBy.accessibilityId ("toast"));
45 | }
46 |
47 | public String toastMessage () {
48 | return this.wait.until (ExpectedConditions.presenceOfElementLocated (
49 | AppiumBy.xpath ("//*[contains(@label, 'Toast should be visible')]")))
50 | .getText ();
51 | }
52 |
53 | public WebElement geoLocationBtn () {
54 | return this.iosDriverManager.getDriver ()
55 | .findElement (AppiumBy.accessibilityId ("geoLocation"));
56 | }
57 |
58 | public WebElement speedTestBtn () {
59 | return this.iosDriverManager.getDriver ()
60 | .findElement (AppiumBy.accessibilityId ("speedTest"));
61 | }
62 |
63 | public WebElement browserMenu () {
64 | return this.iosDriverManager.getDriver ()
65 | .findElement (AppiumBy.accessibilityId ("Browser"));
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/ios/proverbialapp/NotificationPage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.ios.proverbialapp;
2 |
3 | import java.time.Duration;
4 | import java.util.List;
5 |
6 | import io.appium.java_client.AppiumBy;
7 | import io.github.mfaisalkhatri.drivers.IOSDriverManager;
8 | import lombok.SneakyThrows;
9 | import org.openqa.selenium.Point;
10 | import org.openqa.selenium.WebElement;
11 | import org.openqa.selenium.interactions.PointerInput;
12 | import org.openqa.selenium.interactions.Sequence;
13 |
14 | /**
15 | * @author Faisal Khatri
16 | * @since 1/13/2023
17 | **/
18 | public class NotificationPage {
19 | private final IOSDriverManager iosDriverManager;
20 |
21 | public NotificationPage (final IOSDriverManager iosDriverManager) {
22 | this.iosDriverManager = iosDriverManager;
23 | }
24 |
25 | @SneakyThrows
26 | public void openNotificationPanel () {
27 | Thread.sleep (5000);
28 | final var screenSize = this.iosDriverManager.getDriver ()
29 | .manage ()
30 | .window ()
31 | .getSize ();
32 | final var yMargin = 5;
33 | final var xTop = screenSize.width;
34 | final var top = new Point (xTop, yMargin);
35 | final var bottom = new Point (xTop, screenSize.height - yMargin);
36 |
37 | final PointerInput finger = new PointerInput (PointerInput.Kind.TOUCH, "finger");
38 | final Sequence swipe = new Sequence (finger, 1);
39 | swipe.addAction (
40 | finger.createPointerMove (Duration.ofMillis (0), PointerInput.Origin.viewport (), top.x, top.y));
41 | swipe.addAction (finger.createPointerDown (PointerInput.MouseButton.LEFT.asArg ()));
42 | swipe.addAction (
43 | finger.createPointerMove (Duration.ofMillis (1000), PointerInput.Origin.viewport (), bottom.x, bottom.y));
44 | swipe.addAction (finger.createPointerUp (PointerInput.MouseButton.LEFT.asArg ()));
45 | this.iosDriverManager.getDriver ()
46 | .perform (List.of (swipe));
47 |
48 | }
49 |
50 | private WebElement notificationElement () {
51 | return this.iosDriverManager.getDriver ()
52 | .findElement (AppiumBy.accessibilityId ("NotificationCell"));
53 | }
54 |
55 | public String getNotificationText () {
56 | return notificationElement ().getText ();
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/pages/ios/proverbialapp/SpeedTestPage.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.pages.ios.proverbialapp;
2 |
3 | import io.appium.java_client.AppiumBy;
4 | import io.github.mfaisalkhatri.drivers.IOSDriverManager;
5 |
6 | public class SpeedTestPage {
7 |
8 | private final IOSDriverManager iosDriverManager;
9 |
10 | public SpeedTestPage (final IOSDriverManager iosDriverManager) {
11 | this.iosDriverManager = iosDriverManager;
12 | }
13 |
14 | public String headerText () {
15 | return this.iosDriverManager.getDriver ()
16 | .findElement (AppiumBy.iOSClassChain ("**/XCUIElementTypeImage[`label == \"Speedtest\"`]"))
17 | .getText ();
18 | }
19 |
20 | public void navigateToHomePage () {
21 | this.iosDriverManager.getDriver ()
22 | .navigate ()
23 | .back ();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/tests/android/AndroidTests.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.tests.android;
2 |
3 | import io.appium.java_client.Location;
4 | import io.github.mfaisalkhatri.mobileautomation.pages.android.*;
5 | import org.apache.commons.io.FileUtils;
6 | import org.openqa.selenium.OutputType;
7 | import org.openqa.selenium.TakesScreenshot;
8 | import org.testng.annotations.BeforeClass;
9 | import org.testng.annotations.Test;
10 |
11 | import java.io.File;
12 | import java.io.IOException;
13 | import java.text.SimpleDateFormat;
14 | import java.util.Date;
15 |
16 | import static io.github.mfaisalkhatri.utilities.Helper.clickOn;
17 | import static org.testng.Assert.assertEquals;
18 | import static org.testng.Assert.assertTrue;
19 |
20 | public class AndroidTests extends BaseTest {
21 |
22 | private HomePage homePage;
23 | private BrowserPage browserPage;
24 | private GeoLocationPage geoLocationPage;
25 | private SpeedTestPage speedTestPage;
26 |
27 | @BeforeClass
28 | public void setupTest() {
29 | this.homePage = new HomePage(this.androidDriverManager);
30 | this.browserPage = new BrowserPage(this.androidDriverManager);
31 | this.geoLocationPage = new GeoLocationPage(this.androidDriverManager);
32 | this.speedTestPage = new SpeedTestPage(this.androidDriverManager);
33 |
34 | }
35 |
36 | @Test
37 | public void textTests() {
38 | assertEquals(this.homePage.getText(), "Hello! Welcome to lambdatest Sample App called Proverbial");
39 | clickOn(this.homePage.textBtn());
40 | assertEquals(this.homePage.getText(), "Proverbial");
41 | }
42 |
43 | @Test
44 | public void notificationTest() {
45 | takeScreenshot();
46 | clickOn(this.homePage.notificationBtn());
47 | assertTrue(this.homePage.notificationBar().isDisplayed());
48 | clickOn(this.homePage.notificationBar());
49 | }
50 |
51 | @Test
52 | public void toastMessageTest() {
53 | clickOn(this.homePage.toastBtn());
54 | assertEquals(this.homePage.toastMessage(), "Toast should be visible");
55 | }
56 |
57 | @Test
58 | public void geoLocationTest() {
59 | clickOn(this.homePage.geoLocationBtn());
60 | assertTrue(this.geoLocationPage.content()
61 | .isDisplayed());
62 | this.geoLocationPage.navigateToHomePage();
63 | }
64 |
65 | @Test
66 | public void speedTestPageTest() {
67 | clickOn(this.homePage.speedTestBtn());
68 | assertTrue(this.speedTestPage.headerText().isDisplayed());
69 | this.speedTestPage.navigateToHomePage();
70 | }
71 |
72 | @Test
73 | public void browserTest() {
74 | clickOn(this.homePage.browserMenu());
75 | this.browserPage.searchFor("https://lambdatest.com");
76 | }
77 |
78 | public void takeScreenshot() {
79 | final Date date = new Date();
80 | final SimpleDateFormat format = new SimpleDateFormat("dd_MM_YYYY_HH_mm");
81 |
82 | final File scrFile = ((TakesScreenshot) this.androidDriverManager.getDriver()).getScreenshotAs(OutputType.FILE);
83 | try {
84 | FileUtils.copyFile(scrFile, new File("./screenshot_" + format.format(date.getTime()) + ".png"));
85 | } catch (final IOException e) {
86 | throw new RuntimeException(e);
87 | }
88 | }
89 |
90 | @Test
91 | public void getGeoLocationCoOrdinatesTest() {
92 | final Location location = this.androidDriverManager.getDriver().getLocation();
93 |
94 | assertEquals(location.getLatitude(), 51.5072);
95 | assertEquals(location.getLongitude(), 0.1276);
96 | }
97 |
98 | @Test
99 | public void testGeoLocation() {
100 | this.androidDriverManager.getDriver().get("https://iplocation.com/");
101 | final IPLocationPage ipLocationPage = new IPLocationPage(this.androidDriverManager);
102 | assertEquals(ipLocationPage.getCountryText(), "United Kingdom");
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/tests/android/BaseTest.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.tests.android;
2 |
3 | import io.github.mfaisalkhatri.drivers.AndroidDriverManager;
4 | import org.testng.annotations.AfterClass;
5 | import org.testng.annotations.BeforeClass;
6 | import org.testng.annotations.Optional;
7 | import org.testng.annotations.Parameters;
8 |
9 | public class BaseTest {
10 |
11 | protected AndroidDriverManager androidDriverManager;
12 |
13 | @Parameters({"buildName", "testName", "app", "platformName", "platformVersion", "deviceName"})
14 | @BeforeClass
15 | public void setupTest(final String buildName, final String testName, @Optional("app") final String app, final String platformName, final String platformVersion,
16 | final String deviceName) {
17 |
18 | this.androidDriverManager = AndroidDriverManager.builder()
19 | .buildName(buildName)
20 | .testName(testName)
21 | .app(app)
22 | .platformName(platformName)
23 | .platformVersion(platformVersion)
24 | .deviceName(deviceName)
25 | .build()
26 | .createAndroidDriver();
27 | }
28 |
29 | @AfterClass
30 | public void tearDown() {
31 | this.androidDriverManager.quitDriver();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/tests/android/ProverbialAppNotificationTests.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.tests.android;
2 |
3 | import static org.testng.Assert.assertEquals;
4 |
5 | import io.github.mfaisalkhatri.mobileautomation.pages.android.HomePage;
6 | import io.github.mfaisalkhatri.mobileautomation.pages.android.NotificationPage;
7 | import org.testng.annotations.Test;
8 |
9 | /**
10 | * @author Faisal Khatri
11 | * @since 1/12/2023
12 | **/
13 | public class ProverbialAppNotificationTests extends BaseTest {
14 |
15 | @Test
16 | public void testNotification () {
17 | final HomePage homePage = new HomePage (this.androidDriverManager);
18 | homePage.openMenu ();
19 | homePage.clickPushNotificationMenu ();
20 |
21 | final NotificationPage notificationPage = new NotificationPage (this.androidDriverManager);
22 | notificationPage.openNotificationPanel ();
23 | assertEquals (notificationPage.getFirstNotificationTitle (), "Test Notification");
24 | assertEquals (notificationPage.getFirstNotificationText (), "Please enjoy this notification");
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/tests/ios/BaseTest.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.tests.ios;
2 |
3 | import io.github.mfaisalkhatri.drivers.IOSDriverManager;
4 | import org.testng.annotations.AfterClass;
5 | import org.testng.annotations.BeforeClass;
6 | import org.testng.annotations.Optional;
7 | import org.testng.annotations.Parameters;
8 |
9 | public class BaseTest {
10 |
11 | protected IOSDriverManager iosDriverManager;
12 |
13 | @Parameters({"buildName", "testName", "app", "platformName", "platformVersion", "deviceName"})
14 | @BeforeClass
15 | public void setupTest(final String buildName, final String testName, @Optional("app") final String app, final String platformName, final String platformVersion,
16 | final String deviceName) {
17 |
18 | this.iosDriverManager = IOSDriverManager.builder()
19 | .buildName(buildName)
20 | .testName(testName)
21 | .app(app)
22 | .platformName(platformName)
23 | .platformVersion(platformVersion)
24 | .deviceName(deviceName)
25 | .build()
26 | .createIOSDriver();
27 | }
28 |
29 | @AfterClass
30 | public void tearDown() {
31 | this.iosDriverManager.quitDriver();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/test/java/io/github/mfaisalkhatri/mobileautomation/tests/ios/IOSTests.java:
--------------------------------------------------------------------------------
1 | package io.github.mfaisalkhatri.mobileautomation.tests.ios;
2 |
3 | import static io.github.mfaisalkhatri.utilities.Helper.clickOn;
4 | import static org.testng.Assert.assertEquals;
5 | import static org.testng.Assert.assertTrue;
6 |
7 | import io.github.mfaisalkhatri.mobileautomation.pages.ios.findmyapp.Device;
8 | import io.github.mfaisalkhatri.mobileautomation.pages.ios.findmyapp.MainPage;
9 | import io.github.mfaisalkhatri.mobileautomation.pages.ios.proverbialapp.BrowserPage;
10 | import io.github.mfaisalkhatri.mobileautomation.pages.ios.proverbialapp.GeoLocationPage;
11 | import io.github.mfaisalkhatri.mobileautomation.pages.ios.proverbialapp.HomePage;
12 | import io.github.mfaisalkhatri.mobileautomation.pages.ios.proverbialapp.NotificationPage;
13 | import io.github.mfaisalkhatri.mobileautomation.pages.ios.proverbialapp.SpeedTestPage;
14 | import org.testng.annotations.BeforeClass;
15 | import org.testng.annotations.Test;
16 |
17 | public class IOSTests extends BaseTest {
18 |
19 | private HomePage homePage;
20 | private GeoLocationPage geoLocationPage;
21 | private BrowserPage browserPage;
22 | private SpeedTestPage speedTestPage;
23 |
24 | @BeforeClass
25 | public void setupTest () {
26 | this.homePage = new HomePage (this.iosDriverManager);
27 | this.geoLocationPage = new GeoLocationPage (this.iosDriverManager);
28 | this.browserPage = new BrowserPage (this.iosDriverManager);
29 | this.speedTestPage = new SpeedTestPage (this.iosDriverManager);
30 | }
31 |
32 | @Test
33 | public void textTests () {
34 | assertEquals (this.homePage.getText (), "Hello! Welcome to lambdatest Sample App called Proverbial");
35 | clickOn (this.homePage.textBtn ());
36 | assertEquals (this.homePage.getText (), "Proverbial");
37 | }
38 |
39 | @Test
40 | public void notificationTest () {
41 | clickOn (this.homePage.notificationBtn ());
42 | assertTrue (this.homePage.notificationBar ()
43 | .isDisplayed ());
44 | // final NotificationPage notificationPage = new NotificationPage (this.iosDriverManager);
45 | // notificationPage.openNotificationPanel ();
46 | // assertTrue (notificationPage.getNotificationText ()
47 | // .contains ("Test Notification, Please enjoy this notification"));
48 |
49 | }
50 |
51 | @Test
52 | public void toastMessageTest () {
53 | clickOn (this.homePage.toastBtn ());
54 |
55 | }
56 |
57 | @Test
58 | public void geoLocationTest () {
59 | clickOn (this.homePage.geoLocationBtn ());
60 | assertTrue (this.geoLocationPage.banner ()
61 | .isDisplayed ());
62 | this.geoLocationPage.navigateToHomePage ();
63 | }
64 |
65 | @Test
66 | public void speedTestPageTest () {
67 | clickOn (this.homePage.speedTestBtn ());
68 | assertEquals (this.speedTestPage.headerText (), "Speedtest");
69 | this.speedTestPage.navigateToHomePage ();
70 | }
71 |
72 | @Test
73 | public void browserTest () {
74 | clickOn (this.homePage.browserMenu ());
75 | this.browserPage.searchFor ("https://lambdatest.com");
76 | }
77 |
78 | @Test
79 | public void findMyAppTest () {
80 | final Device device = new Device (this.iosDriverManager);
81 | device.openFindMyApp ();
82 | final MainPage mainPage = new MainPage (this.iosDriverManager);
83 | assertTrue (mainPage.isDevicesBtnDisplayed ());
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/testng.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------