-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
125 additions
and
85 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package android.PageManagement; | ||
|
||
import BaseConfig.SettingAndroidEnv; | ||
import android.Utility.TestUtils; | ||
import io.appium.java_client.AppiumBy; | ||
import io.appium.java_client.android.AndroidDriver; | ||
import io.appium.java_client.android.nativekey.AndroidKey; | ||
import io.appium.java_client.android.nativekey.KeyEvent; | ||
import io.appium.java_client.pagefactory.AndroidFindBy; | ||
import io.appium.java_client.pagefactory.iOSXCUITFindBy; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
|
||
public class HomePage extends SettingAndroidEnv { | ||
int pause_Short = 1; | ||
int pause_long = 2; | ||
int pause_extended = 3; | ||
|
||
WebDriver driver; | ||
|
||
public static AndroidDriver andro; | ||
|
||
TestUtils testUtils; | ||
|
||
public HomePage(WebDriver driver) { | ||
this.driver = driver; | ||
PageFactory.initElements(driver, this); | ||
testUtils = new TestUtils(driver); | ||
} | ||
|
||
/** | ||
* Our Elements Will Be Stored Here. | ||
*/ | ||
|
||
@FindBy(xpath = "(//android.widget.ImageView) [5]") | ||
WebElement tshirtBox; | ||
|
||
@FindBy(xpath = "(//android.widget.TextView) [1]") | ||
WebElement tshirtText; | ||
|
||
@FindBy(xpath = "//android.view.ViewGroup[@content-desc='open menu']/android.widget.ImageView") | ||
WebElement menuButton; | ||
|
||
@FindBy(linkText = "Catalog") | ||
WebElement webviewMenu; | ||
|
||
@iOSXCUITFindBy(accessibility = "messageSaveBtn") | ||
@AndroidFindBy(xpath = "//android.view.ViewGroup[@content-desc='messageSaveBtn']") | ||
|
||
|
||
|
||
|
||
public void clickingOnAppElement(){ | ||
testUtils.elementIsDisplayed(tshirtBox, 60); | ||
testUtils.clickingOnElement(tshirtBox); | ||
testUtils.wait(1); | ||
testUtils.verifyText(tshirtText, "Sauce Labs Backpack"); | ||
|
||
} | ||
|
||
public void menu() { | ||
testUtils.elementIsDisplayed(menuButton, 60); | ||
testUtils.wait(pause_Short); | ||
testUtils.clickingOnElement(menuButton); | ||
testUtils.wait(pause_Short); | ||
testUtils.clickingOnElement(menuButton); | ||
testUtils.wait(pause_Short); | ||
driver.findElement(AppiumBy.accessibilityId("longpress reset app")).isDisplayed(); | ||
driver.findElement(AppiumBy.androidUIAutomator("new UiScrollable(new UiSelector()).click(text());")); | ||
andro.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/test/java/android/TestCases/AndroidTestAutomation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package TestCases; | ||
|
||
import BaseConfig.SettingAndroidEnv; | ||
import Utility.TestUtils; | ||
import io.appium.java_client.android.nativekey.AndroidKey; | ||
import io.appium.java_client.android.nativekey.KeyEvent; | ||
import io.appium.java_client.pagefactory.AndroidFindBy; | ||
import io.appium.java_client.pagefactory.iOSXCUITFindBy; | ||
import org.openqa.selenium.By; | ||
import org.testng.annotations.Test; | ||
|
||
public class AndroidTestAutomation extends SettingAndroidEnv { | ||
|
||
@Test (testName = "Test01", description = " Android App Automation") | ||
public void test01() { | ||
TestUtils test = new TestUtils(driver); | ||
test.wait(1); | ||
String title = driver.findElements(By.xpath("//android.widget.TextView [1]")).get(0).getText(); | ||
System.out.println(title); | ||
driver.findElement(By.id("android:id/text1")).click(); | ||
driver.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); //Navigate back from current screen | ||
test.wait(1); | ||
driver.findElement(By.xpath("//android.widget.TextView[@text='Animation']")).click(); | ||
driver.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); | ||
driver.findElement(By.xpath("//android.widget.TextView[@text='App']")).click(); | ||
driver.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); | ||
driver.findElement(By.xpath("//android.widget.TextView[@text='Content']")).click(); | ||
driver.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); | ||
driver.findElement(By.xpath("//android.widget.TextView[@text='Graphics']")).click(); | ||
driver.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); | ||
driver.findElement(By.xpath("//android.widget.TextView[@text='Media']")).click(); | ||
driver.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); | ||
driver.findElement(By.xpath("//android.widget.TextView[@text='NFC']")).click(); | ||
driver.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); | ||
driver.findElement(By.xpath("//android.widget.TextView[@text='OS']")).click(); | ||
driver.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); | ||
driver.findElement(By.xpath("//android.widget.TextView[@text='Preference']")).click(); | ||
driver.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); | ||
driver.findElement(By.xpath("//android.widget.TextView[@text='Text']")).click(); | ||
driver.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); | ||
driver.findElement(By.xpath("//android.widget.TextView[@text='Views']")).click(); | ||
driver.pressKey(new KeyEvent().withKey(AndroidKey.BACK)); | ||
|
||
|
||
} | ||
} |