├── .DS_Store ├── .gitattributes ├── .gitignore ├── Appium ├── .DS_Store ├── Java │ ├── .DS_Store │ ├── AndroidKeep │ │ ├── AppiumTest │ │ │ ├── .classpath │ │ │ ├── .project │ │ │ ├── src │ │ │ │ ├── Pages │ │ │ │ │ ├── KeepPage.java │ │ │ │ │ ├── NoteEditor.java │ │ │ │ │ ├── RemindWin.java │ │ │ │ │ └── StickyBoard.java │ │ │ │ └── Test │ │ │ │ │ └── KeepTest.java │ │ │ └── testng.xml │ │ ├── README.md │ │ └── WithReporting │ │ │ ├── .classpath │ │ │ ├── .project │ │ │ ├── pom.xml │ │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── Reporting │ │ │ │ ├── Keep │ │ │ │ └── KeepTest.java │ │ │ │ └── Pages │ │ │ │ ├── KeepPage.java │ │ │ │ ├── NoteEditor.java │ │ │ │ ├── RemindWin.java │ │ │ │ └── StickyBoard.java │ │ │ └── testng.xml │ ├── IMDB-Appium │ │ ├── .classpath │ │ ├── .project │ │ ├── .settings │ │ │ ├── org.eclipse.core.resources.prefs │ │ │ ├── org.eclipse.jdt.core.prefs │ │ │ └── org.eclipse.m2e.core.prefs │ │ ├── README.md │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── java │ │ │ │ ├── AppObjects.java │ │ │ │ └── IMDBappium.java │ │ └── testng.xml │ ├── README.md │ ├── Reddit │ │ ├── .classpath │ │ ├── .project │ │ ├── README.md │ │ ├── Test App │ │ │ └── Reddit The Official App_v1.5.3_apkpure.com.apk │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── java │ │ │ │ ├── PageObject.java │ │ │ │ ├── Reddit.java │ │ │ │ └── Utils.java │ │ └── testng.xml │ ├── testing_landscape_portrait │ │ ├── README.md │ │ ├── pom.xml │ │ ├── src │ │ │ ├── main │ │ │ │ └── java │ │ │ │ │ └── AndroidDriverExtended.java │ │ │ └── test │ │ │ │ └── java │ │ │ │ ├── AbstractPage.java │ │ │ │ ├── PerfectoTestNG.java │ │ │ │ └── TestClass.java │ │ ├── testing_landscape_portrait.iml │ │ └── testng.xml │ └── testng_sample │ │ ├── .DS_Store │ │ ├── .classpath │ │ ├── .project │ │ ├── .settings │ │ ├── org.eclipse.jdt.core.prefs │ │ └── org.eclipse.m2e.core.prefs │ │ ├── README.md │ │ ├── pom.xml │ │ ├── src │ │ ├── .DS_Store │ │ ├── main │ │ │ ├── .DS_Store │ │ │ └── java │ │ │ │ ├── .DS_Store │ │ │ │ └── com │ │ │ │ ├── .DS_Store │ │ │ │ └── perfecto │ │ │ │ ├── .DS_Store │ │ │ │ ├── commons │ │ │ │ ├── .DS_Store │ │ │ │ ├── testng │ │ │ │ │ ├── InvalidCommandLineArgumentException.java │ │ │ │ │ ├── Keyword.java │ │ │ │ │ ├── Logger.java │ │ │ │ │ ├── TestCaseInputs.java │ │ │ │ │ ├── TestCases.java │ │ │ │ │ ├── TestNGDataProvider.java │ │ │ │ │ ├── TestNGListener.java │ │ │ │ │ └── TestNGSuite.java │ │ │ │ └── utils │ │ │ │ │ ├── AndroidAppConstant.java │ │ │ │ │ ├── DevicesToTestOn.java │ │ │ │ │ ├── GenerateTestData.java │ │ │ │ │ ├── IOSAppConstant.java │ │ │ │ │ ├── PerfectoCloudInformation.java │ │ │ │ │ ├── ReportiumConstant.java │ │ │ │ │ └── SuiteConstants.java │ │ │ │ ├── mobile │ │ │ │ ├── .DS_Store │ │ │ │ ├── android │ │ │ │ │ ├── CustomAndroidDriver.java │ │ │ │ │ ├── PerfectoDesiredCapability.java │ │ │ │ │ └── PerfectoDriver.java │ │ │ │ ├── ios │ │ │ │ │ ├── CustomIOSDriver.java │ │ │ │ │ ├── PerfectoDesiredCapability.java │ │ │ │ │ └── PerfectoDriver.java │ │ │ │ └── utils │ │ │ │ │ ├── DesiredCapability.java │ │ │ │ │ ├── DeviceUtils.java │ │ │ │ │ └── MobileScreen.java │ │ │ │ └── reporting │ │ │ │ └── Reports.java │ │ └── test │ │ │ ├── .DS_Store │ │ │ ├── java │ │ │ ├── .DS_Store │ │ │ └── com │ │ │ │ ├── .DS_Store │ │ │ │ └── perfecto │ │ │ │ ├── .DS_Store │ │ │ │ ├── keywords │ │ │ │ ├── .DS_Store │ │ │ │ └── percentage │ │ │ │ │ └── ValidatePrimaryCard.java │ │ │ │ ├── pom │ │ │ │ ├── LaunchScreen.java │ │ │ │ └── PrimaryCardScreen.java │ │ │ │ └── tests │ │ │ │ ├── .DS_Store │ │ │ │ └── calc │ │ │ │ ├── PercentageCalculationTest.java │ │ │ │ ├── PercentageCalculationTest2.java │ │ │ │ └── RotateScreenTest.java │ │ │ └── resources │ │ │ ├── .DS_Store │ │ │ ├── android │ │ │ └── app.properties │ │ │ ├── ios │ │ │ └── app.properties │ │ │ ├── perfecto │ │ │ ├── cloud.properties │ │ │ └── reportium.properties │ │ │ └── testdata │ │ │ ├── anothertest.json │ │ │ └── primarycard_validation.json │ │ └── testng.xml ├── JavaScript │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── perfectoSpec.js │ └── wdio.conf.js ├── README.md └── Ruby_Appium_iOS_Test.rb ├── Cross-Platforms tests ├── .DS_Store ├── Java │ ├── Airbnb │ │ ├── README.md │ │ ├── Register2Airbnb.java │ │ └── objectsXpaths.java │ ├── Amazon │ │ ├── README.md │ │ ├── conf.xml │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── java │ │ │ │ ├── Properties.java │ │ │ │ ├── TestObjects.java │ │ │ │ ├── cloud.java │ │ │ │ ├── desktopTest.java │ │ │ │ └── mobileTest.java │ │ └── target │ │ │ └── classes │ │ │ └── META-INF │ │ │ ├── MANIFEST.MF │ │ │ └── maven │ │ │ └── Amazon │ │ │ └── Amazon │ │ │ ├── pom.properties │ │ │ └── pom.xml │ ├── IMDb-Android-and-Chrome │ │ ├── IMDb-AndroidAndChrome │ │ │ ├── .classpath │ │ │ ├── .project │ │ │ ├── .settings │ │ │ │ ├── org.eclipse.jdt.core.prefs │ │ │ │ └── org.eclipse.m2e.core.prefs │ │ │ ├── pom.xml │ │ │ ├── src │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ ├── AppLocators.java │ │ │ │ │ ├── IMDbTest.java │ │ │ │ │ ├── desktopTest.java │ │ │ │ │ └── driverCreator.java │ │ │ └── testng.xml │ │ └── README.md │ ├── NowCompare │ │ ├── NowCompareTest.java │ │ └── README │ ├── README.md │ └── Swiss-Airlines │ │ ├── README.md │ │ ├── SwissNativeAndWeb.java │ │ └── SwissPageObjects.java ├── Python │ ├── Amazon - CrossPlatform Python │ │ └── src │ │ │ ├── AppObjects.py │ │ │ ├── DesktopTest.py │ │ │ ├── MobileTest.py │ │ │ └── TestParameters.py │ └── README.md └── README.md ├── Methods ├── .DS_Store ├── Drag and drop │ ├── README.md │ ├── TestNG.xml │ ├── pom.xml │ ├── src │ │ └── test │ │ │ └── java │ │ │ └── DragAndDropSample.java │ └── target │ │ ├── classes │ │ └── META-INF │ │ │ ├── MANIFEST.MF │ │ │ └── maven │ │ │ └── DragAndDropSample │ │ │ └── DragAndDropSample │ │ │ ├── pom.properties │ │ │ └── pom.xml │ │ └── test-classes │ │ └── DragAndDropSample.class ├── ExecuteScript │ ├── ExecuteScript.java │ ├── ExecuteScript_CSharp.cs │ ├── Execute_script.py │ ├── Execute_script.rb │ └── README.md ├── README.md └── ScriptOnce │ ├── .classpath │ ├── .project │ ├── README.md │ ├── src │ ├── Pages │ │ ├── CreateAccountPage.java │ │ ├── EmailEntry.java │ │ ├── OpenPage.java │ │ ├── UserDetailsPage.java │ │ ├── WeightGoalPage.java │ │ └── noomPage.java │ └── Test │ │ ├── NoomTest.java │ │ ├── PopUps.java │ │ └── wlProfile.java │ └── testng.xml ├── README.md ├── Reporting ├── .gitignore └── README.md ├── Selenium ├── .DS_Store ├── C# │ ├── GeicoCarInsuranceCSharp │ │ ├── .project │ │ ├── GeicoCarInsuranceCSharp.sln │ │ └── GeicoCarInsuranceCSharp │ │ │ ├── GeicoCarInsurance.cs │ │ │ ├── GeicoCarInsuranceCSharp.csproj │ │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ │ └── packages.config │ ├── README.md │ ├── geicoWeb │ │ ├── GeicoCsharp.sln │ │ ├── GeicoCsharp │ │ │ ├── GeicoCsharp.csproj │ │ │ ├── Properties │ │ │ │ ├── AssemblyInfo.cs │ │ │ │ ├── Settings.Designer.cs │ │ │ │ └── Settings.settings │ │ │ ├── RemoteWebDriverTest.cs │ │ │ ├── locators.cs │ │ │ └── packages.config │ │ └── README.md │ └── searchAndFillForm │ │ ├── README.md │ │ └── RemoteWebDriverTest.cs ├── Java │ ├── CommunityDynamicXpath │ │ ├── .classpath │ │ ├── .project │ │ ├── codebeautify.csv │ │ ├── codebeautify.xls │ │ ├── codebeautify.xlsx │ │ ├── src │ │ │ ├── DynamicXpathAndValues.java │ │ │ └── ReadExcel.java │ │ ├── table.txt │ │ └── test-output │ │ │ ├── Default suite │ │ │ ├── Default test.html │ │ │ ├── Default test.xml │ │ │ └── testng-failed.xml │ │ │ ├── bullet_point.png │ │ │ ├── collapseall.gif │ │ │ ├── emailable-report.html │ │ │ ├── failed.png │ │ │ ├── index.html │ │ │ ├── jquery-1.7.1.min.js │ │ │ ├── junitreports │ │ │ └── TEST-RemoteWebDriverTest.xml │ │ │ ├── navigator-bullet.png │ │ │ ├── old │ │ │ ├── Default suite │ │ │ │ ├── Default test.properties │ │ │ │ ├── classes.html │ │ │ │ ├── groups.html │ │ │ │ ├── index.html │ │ │ │ ├── main.html │ │ │ │ ├── methods-alphabetical.html │ │ │ │ ├── methods-not-run.html │ │ │ │ ├── methods.html │ │ │ │ ├── reporter-output.html │ │ │ │ ├── testng.xml.html │ │ │ │ └── toc.html │ │ │ └── index.html │ │ │ ├── passed.png │ │ │ ├── skipped.png │ │ │ ├── testng-failed.xml │ │ │ ├── testng-reports.css │ │ │ ├── testng-reports.js │ │ │ ├── testng-results.xml │ │ │ └── testng.css │ ├── ESPN_Test │ │ ├── .classpath │ │ ├── .gitignore │ │ ├── .project │ │ ├── .settings │ │ │ ├── org.eclipse.jdt.core.prefs │ │ │ └── org.eclipse.m2e.core.prefs │ │ ├── README.md │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── java │ │ │ │ ├── PageObjects.java │ │ │ │ └── Test_Main.java │ │ └── testng.xml │ ├── GeicoInsurance │ │ ├── .classpath │ │ ├── .gitignore │ │ ├── .project │ │ └── src │ │ │ └── com │ │ │ └── perfecto │ │ │ └── testing │ │ │ └── selenium │ │ │ └── GeicoCarInsuranceJavaMain.java │ ├── README.md │ ├── Selenium Chrome Performance Logs │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── RemoteWebDriverTest.java │ └── searchAndFillForm │ │ ├── GoogleSearchTest.java │ │ └── README.md ├── JavaScript │ ├── Protractor-Web │ │ ├── .gitignore │ │ ├── Dzone.js │ │ ├── README.md │ │ ├── conf.js │ │ ├── package.json │ │ └── spec.js │ ├── Protractor │ │ ├── ReadMe.md │ │ ├── conf.js │ │ └── spec.js │ ├── README.md │ └── WebDriverIO │ │ ├── README.md │ │ └── webdriverio.js ├── Python │ ├── GeicoWeb │ │ ├── GeicoTest.py │ │ └── README.md │ ├── README.md │ ├── Robot-framework │ │ ├── README.md │ │ ├── perfecto_Web_Desktop.robot │ │ ├── perfecto_Web_Mobile.robot │ │ └── sample.py │ └── searchAndFillForm │ │ ├── README.md │ │ └── RemoteWebDriverTest.py ├── README.md └── Ruby │ ├── GeicoWeb │ ├── Locators.rb │ ├── README.md │ └── geico_test.rb │ ├── README.md │ └── searchAndFillForm │ ├── GoogleSearchRuby.rb │ └── README.md ├── Visual-Analysis ├── .DS_Store ├── Readme.md ├── maps-web │ ├── README.md │ ├── WebMapsTest.java │ ├── mobileSessionMaps.java │ └── test images │ │ ├── maps - directions icon.png │ │ ├── maps - directions page indicator.png │ │ └── maps - driving directions icon.png └── perfecto-form │ ├── .classpath │ ├── .project │ ├── README.md │ ├── VisualAnalysis Pics │ ├── CheckPoint1(Free Mobile Testing).png │ ├── Company.png │ ├── Email.png │ ├── FullName.png │ ├── LastName.png │ └── Phone.png │ ├── pom.xml │ ├── src │ └── test │ │ └── java │ │ ├── Perfecto_VisualAnalysis.java │ │ └── driverCreator.java │ └── testng.xml ├── Windows10 ├── .DS_Store ├── C# │ ├── Calculator │ │ ├── Calculator.sln │ │ ├── Calculator │ │ │ ├── Calculator.csproj │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ ├── RemoteWebDriverTest.cs │ │ │ └── packages.config │ │ └── README.md │ └── README.md ├── Java │ └── Win10CalculatorSample │ │ ├── README.md │ │ ├── Win10CalculatorSample.iml │ │ ├── src │ │ └── Win10CalculatorTest.java │ │ └── testng.xml └── README.md └── gradlew.bat /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/.DS_Store -------------------------------------------------------------------------------- /Appium/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/AppiumTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/AppiumTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | KeepReport 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/AppiumTest/src/Pages/KeepPage.java: -------------------------------------------------------------------------------- 1 | package Pages; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import io.appium.java_client.MobileElement; 6 | import io.appium.java_client.android.AndroidDriver; 7 | 8 | public abstract class KeepPage { 9 | AndroidDriver driver; 10 | private By getStarted = By.xpath("//android.widget.TextView[@text='GET STARTED']"); 11 | 12 | public KeepPage(AndroidDriver d) { 13 | this.driver = d; 14 | } 15 | 16 | protected void dismissPopup() { 17 | try { 18 | driver.findElement(getStarted).click(); 19 | System.out.println("Pressed the Get Started button to get into the application"); 20 | } catch (Exception n) { 21 | System.out.println("No Welcome screen - just plow ahead"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/AppiumTest/src/Pages/RemindWin.java: -------------------------------------------------------------------------------- 1 | package Pages; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import org.openqa.selenium.By; 6 | import org.openqa.selenium.NoSuchElementException; 7 | import org.openqa.selenium.WebDriver; 8 | import org.openqa.selenium.support.ui.ExpectedConditions; 9 | import org.openqa.selenium.support.ui.FluentWait; 10 | 11 | import io.appium.java_client.MobileElement; 12 | import io.appium.java_client.android.AndroidDriver; 13 | 14 | public class RemindWin extends KeepPage { 15 | private By header = By.xpath("//*[@resource-id='com.google.android.keep:id/dialog_title']"); 16 | private By dateHd = By.xpath("//*[@resource-id='com.google.android.keep:id/date_spinner']"); 17 | private By today = By.xpath("//*[@resource-id='com.google.android.keep:id/reminder_date_today']"); 18 | private By tmrrw = By.xpath("//*[@resource-id='com.google.android.keep:id/reminder_date_tomorrow']"); 19 | private By nxtwk = By.xpath("//*[@resource-id='com.google.android.keep:id/reminder_date_same_weekday']"); 20 | private By svBtn = By.xpath("//*[@resource-id='com.google.android.keep:id/save']"); 21 | private By cncl = By.xpath("//*[@resource-id='com.google.android.keep:id/cancel']"); 22 | 23 | public RemindWin(AndroidDriver d) { 24 | super(d); 25 | 26 | FluentWait wait = new FluentWait(d) 27 | .withTimeout(10, TimeUnit.SECONDS) 28 | .pollingEvery(2, TimeUnit.SECONDS) 29 | .ignoring(NoSuchElementException.class); 30 | try { 31 | wait.until(ExpectedConditions.visibilityOfElementLocated(header)); 32 | } catch (Exception t) { 33 | System.out.println("Failed to identify the SetReminder page"); 34 | } 35 | } 36 | 37 | public void pickDate() { 38 | driver.findElement(dateHd).click(); 39 | } 40 | 41 | public void remToday() { 42 | driver.findElement(today).click(); 43 | } 44 | 45 | public void remTmrrw() { 46 | driver.findElement(tmrrw).click(); 47 | } 48 | 49 | public void remWk() { 50 | driver.findElement(nxtwk).click(); 51 | } 52 | 53 | public NoteEditor save() { 54 | driver.findElement(svBtn).click(); 55 | return new NoteEditor(driver); 56 | } 57 | 58 | public NoteEditor cancel() { 59 | driver.findElement(cncl).click(); 60 | return new NoteEditor(driver); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/AppiumTest/src/Pages/StickyBoard.java: -------------------------------------------------------------------------------- 1 | package Pages; 2 | 3 | import java.util.*; 4 | import java.util.concurrent.TimeUnit; 5 | import java.util.function.Function; 6 | 7 | import org.openqa.selenium.By; 8 | import org.openqa.selenium.NoSuchElementException; 9 | import org.openqa.selenium.WebDriver; 10 | import org.openqa.selenium.WebElement; 11 | import org.openqa.selenium.support.ui.ExpectedConditions; 12 | import org.openqa.selenium.support.ui.FluentWait; 13 | 14 | import io.appium.java_client.MobileElement; 15 | import io.appium.java_client.android.AndroidDriver; 16 | 17 | public class StickyBoard extends KeepPage { 18 | private By newList = By.xpath("//*[@resource-id='com.google.android.keep:id/new_list_button']"); 19 | private String expNote = "//android.widget.FrameLayout[contains(@content-desc, '%s')]"; 20 | private By header = By.xpath("//*[@text='Notes']"); 21 | 22 | public StickyBoard(AndroidDriver d) { 23 | super(d); 24 | 25 | // should use this in Wait function! 26 | FluentWait wait = new FluentWait(d) 27 | .withTimeout(10, TimeUnit.SECONDS) 28 | .pollingEvery(2, TimeUnit.SECONDS) 29 | .ignoring(NoSuchElementException.class); 30 | try { 31 | wait.until(ExpectedConditions.visibilityOfElementLocated(header)); 32 | } catch (Exception t) { 33 | System.out.println("Failed to identify the StickyBoard page"); 34 | } 35 | } 36 | 37 | public NoteEditor createNewList() { 38 | driver.findElement(newList).click(); 39 | return new NoteEditor(driver); 40 | } 41 | 42 | public boolean findNote(String title) { 43 | try { 44 | String xp = String.format(expNote, title); 45 | driver.findElementByXPath(xp); 46 | return true; 47 | } catch (Exception e) { 48 | return false; 49 | } 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/AppiumTest/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/README.md: -------------------------------------------------------------------------------- 1 | # Android Keep Automation 2 | This sample presents two versions of the same automation script. 3 | - _AppiumTest_ includes a sample that employs TestNG to run the automation to create three notes in Keep, two with reminders. Written using POM to encapsulate the functionality of the different app screens. 4 | - _WithReporting_ takes the sample to the next level by incorporating the connection to the new standard Report generating tools from Perfecto. 5 | 6 | # Changes for including Reporting 7 | See the [wiki](https://github.com/PerfectoCode/Samples/wiki/Reporting) to get an overview of how to incorporate the Reporting tool into your code. 8 | Specifically in this sample - the following are the changes that were applied to gain the benefits of the new Reports: 9 | 10 | 1. In the _KeepTest.java_ file, that contains the test program, we added the creation of the ReportiumClient instance after creating the Androiddriver instance. Be careful to create only a single instance for each test run. 11 | 2. In the _KeepTest.java_ file we added the @BeforeMethod and @AfterMethod methods, to start and stop the test, as described in the wiki. 12 | 3. The Page Objects use the ReportiumClient to define steps of the test in the page methods. This makes it easier to identify when the test goes from screen to screen. 13 | 4. We retrieve the URL of the report just before disconnecting from the AndroidDriver and reporting it to the user. The user can use the URL to view the report in his browser. 14 | 15 | -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/WithReporting/.classpath: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/WithReporting/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Keep 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/WithReporting/src/main/java/Reporting/Pages/KeepPage.java: -------------------------------------------------------------------------------- 1 | package Reporting.Pages; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import com.perfecto.reportium.client.ReportiumClient; 6 | 7 | import io.appium.java_client.MobileElement; 8 | import io.appium.java_client.android.AndroidDriver; 9 | 10 | public abstract class KeepPage { 11 | AndroidDriver driver; 12 | ReportiumClient rep; 13 | 14 | private By getStarted = By.xpath("//android.widget.TextView[@text='GET STARTED']"); 15 | 16 | public KeepPage(AndroidDriver d, ReportiumClient r) { 17 | this.driver = d; 18 | this.rep = r; 19 | } 20 | 21 | protected void dismissPopup() { 22 | try { 23 | driver.findElement(getStarted).click(); 24 | System.out.println("Pressed the Get Started button to get into the application"); 25 | } catch (Exception n) { 26 | System.out.println("No Welcome screen - just plow ahead"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/WithReporting/src/main/java/Reporting/Pages/StickyBoard.java: -------------------------------------------------------------------------------- 1 | package Reporting.Pages; 2 | 3 | import java.util.*; 4 | import java.util.concurrent.TimeUnit; 5 | import java.util.function.Function; 6 | 7 | import org.openqa.selenium.By; 8 | import org.openqa.selenium.NoSuchElementException; 9 | import org.openqa.selenium.WebDriver; 10 | import org.openqa.selenium.WebElement; 11 | import org.openqa.selenium.support.ui.ExpectedConditions; 12 | import org.openqa.selenium.support.ui.FluentWait; 13 | 14 | import com.perfecto.reportium.client.ReportiumClient; 15 | 16 | import io.appium.java_client.MobileElement; 17 | import io.appium.java_client.android.AndroidDriver; 18 | 19 | public class StickyBoard extends KeepPage { 20 | private By newList = By.xpath("//*[@resource-id='com.google.android.keep:id/new_list_button']"); 21 | private String expNote = "//android.widget.FrameLayout[contains(@content-desc, '%s')]"; 22 | private By header = By.xpath("//*[@text='Notes']"); 23 | 24 | public StickyBoard(AndroidDriver d, ReportiumClient r) { 25 | super(d, r); 26 | 27 | r.testStep("Showing the Bulletin Board of notes."); 28 | // should use this in Wait function! 29 | FluentWait wait = new FluentWait(d) 30 | .withTimeout(10, TimeUnit.SECONDS) 31 | .pollingEvery(2, TimeUnit.SECONDS) 32 | .ignoring(NoSuchElementException.class); 33 | try { 34 | wait.until(ExpectedConditions.visibilityOfElementLocated(header)); 35 | } catch (Exception t) { 36 | System.out.println("Failed to identify the StickyBoard page"); 37 | } 38 | } 39 | 40 | public NoteEditor createNewList() { 41 | driver.findElement(newList).click(); 42 | return new NoteEditor(driver, rep); 43 | } 44 | 45 | public boolean findNote(String title) { 46 | try { 47 | String xp = String.format(expNote, title); 48 | driver.findElementByXPath(xp); 49 | return true; 50 | } catch (Exception e) { 51 | return false; 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Appium/Java/AndroidKeep/WithReporting/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 | -------------------------------------------------------------------------------- /Appium/Java/IMDB-Appium/.classpath: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Appium/Java/IMDB-Appium/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | IMDB-Appium 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /Appium/Java/IMDB-Appium/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/resources=UTF-8 3 | encoding//src/test/java=UTF-8 4 | encoding//src/test/resources=UTF-8 5 | encoding/=UTF-8 6 | encoding/src=UTF-8 7 | -------------------------------------------------------------------------------- /Appium/Java/IMDB-Appium/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.6 6 | -------------------------------------------------------------------------------- /Appium/Java/IMDB-Appium/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /Appium/Java/IMDB-Appium/README.md: -------------------------------------------------------------------------------- 1 | #IMDb Application code sample. 2 | 3 | :information_source: This test requires the IMDb application, which can be found [here](https://github.com/PerfectoCode/AppsForSamples/tree/master/IMDb). 4 | 5 | **TODO:** 6 | - To use this code sample, make sure that the IMDb application is already installed on the device before running the test. 7 | - Change you device name and platformName at testng.xml file. 8 | - Change User,Pass,Cloud information at the test class : IMDBappium.java . 9 | - Run as testNG from the testng.xml file. 10 | -------------------------------------------------------------------------------- /Appium/Java/IMDB-Appium/src/test/java/AppObjects.java: -------------------------------------------------------------------------------- 1 | package test.java; 2 | 3 | public class AppObjects{ 4 | 5 | public static final String Pop_Up_deny = "//*[text() = 'Deny' or @label='Don?t Allow']"; 6 | public static final String Search = "//*[@resource-id='com.imdb.mobile:id/search' or @label='Search']"; 7 | public static final String Android_search_bar = "//*[@resource-id='com.imdb.mobile:id/search_src_text']"; 8 | public static final String MoviePath = "//*[contains(@name , 'Captain America: Civil War') or @resource-id='com.imdb.mobile:id/label' and @text='Captain America: Civil War?(2016)']"; 9 | public static final String loginIMDB = "//*[@text = 'IMDb']"; 10 | public static final String watchTrailer = "//*[@label='Watch Trailer']"; 11 | public static final String IOSWatchTrailer = "//*[@value='rows 1 to 6 of 6']/UIATableCell[1]/UIAButton[2]"; 12 | } -------------------------------------------------------------------------------- /Appium/Java/IMDB-Appium/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Appium/Java/README.md: -------------------------------------------------------------------------------- 1 | ## Appium - Java Samples 2 | 3 | This samples of Appium driver in Java examine the using of AndroidDriver / IOSDriver to execute Native application tests. 4 | Most of the projects are using [Maven](http://search.maven.org/) or [Gradle](https://gradle.org/) in order to manage the project dependencies, 5 | And [TestNG](http://testng.org/doc/index.html) as a testing framework. 6 | 7 | ###Fast Starting: 8 | 9 | In order to run the project it's recommended to download it and import as Maven/Gradle project on Eclipse or Intellij IDE. 10 | 11 | ### Maven: 12 | Adding a dependency done by editing the project's pom.xml file. 13 | For example adding Appium dependency: 14 | 15 | ```xml 16 | 17 | .... 18 | 19 | io.appium 20 | java-client 21 | 4.1.0 22 | 23 | 24 | 25 | ``` 26 | 27 | ### Gradle: 28 | Adding a dependency done by editing projects gradle.build . 29 | ```xml 30 | compile 'com.comcast.magic-wand:appium:4.0.1' 31 | ``` 32 | ### TestNG: 33 | Test managment framework, in this projects most of the devices capabilities passed by the testng.xml file. 34 | The tests executed via testng.xml file also as TestNG test. 35 | -------------------------------------------------------------------------------- /Appium/Java/Reddit/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Reddit 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /Appium/Java/Reddit/README.md: -------------------------------------------------------------------------------- 1 | ## Reddit - Appium 2 | 3 | This code sample examine executing of Appium test in Java using TestNG + Maven. 4 | The test implements [PageObject](https://community.perfectomobile.com/series/21324-page-object-model-guide) design pattern which recommended in order to make tests easy to maintain. 5 | 6 | **TODO:** 7 | - Import the project as Maven project to Eclipse or Intellij. 8 | - Add your Perfecto Lab user, pass and host to [Utils.java](src/test/java/Utils.java) file. 9 | - Add your Reddit Username and password to the [Reddit.java](src/test/java/Reddit.java) file: 10 | ```Java 11 | static String AppUser = System.getProperty("np.AppUser", "My_user"); 12 | static String AppPass = System.getProperty("np.AppPass", "My_pass"); 13 | ``` 14 | - Upload the Reddit application to your Perfecto Lab repository. 15 | - Run as TestNG test from testng.xml file. 16 | 17 | ### Adding your favorite devices 18 | By editing testng.xml file you could choose your favorite devices, inside the test suite for example: 19 | ```xml 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ``` 32 | 33 | Adding parallel execution: 34 | ```xml 35 | 36 | ``` 37 | -------------------------------------------------------------------------------- /Appium/Java/Reddit/Test App/Reddit The Official App_v1.5.3_apkpure.com.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/Reddit/Test App/Reddit The Official App_v1.5.3_apkpure.com.apk -------------------------------------------------------------------------------- /Appium/Java/Reddit/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.perfecto 8 | appium.reddit 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 13 | org.apache.maven.plugins 14 | maven-compiler-plugin 15 | 16 | 1.7 17 | 1.7 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | jcenter 26 | bintray 27 | http://jcenter.bintray.com 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | io.appium 36 | java-client 37 | 4.1.0 38 | 39 | 40 | 41 | org.testng 42 | testng 43 | 6.9.12 44 | test 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Appium/Java/Reddit/src/test/java/Reddit.java: -------------------------------------------------------------------------------- 1 | import io.appium.java_client.AppiumDriver; 2 | import org.testng.annotations.AfterMethod; 3 | import org.testng.annotations.BeforeMethod; 4 | import org.testng.annotations.Parameters; 5 | import org.testng.annotations.Test; 6 | 7 | import java.net.MalformedURLException; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | public class Reddit { 11 | 12 | AppiumDriver driver; 13 | 14 | @Parameters({"platformName", "platformVersion","model" , "browserName", "browserVersion" , "deviceName"}) 15 | @BeforeMethod 16 | public void beforeTest(String platformName, String platformVersion,String model , String browserName, String browserVersion, String deviceName) throws MalformedURLException { 17 | System.out.println("Run Started"); 18 | 19 | driver = Utils.InitAppiumDriver(platformName, platformVersion,model, browserName, browserVersion, deviceName); 20 | driver.manage().timeouts().implicitlyWait(20 , TimeUnit.SECONDS); 21 | } 22 | 23 | @Test 24 | public void test(){ 25 | System.out.println("Getting app main page"); 26 | mainPage main = new mainPage(driver); 27 | 28 | //Choosing one of the main page buttons 29 | System.out.println("Choosing login button"); 30 | main.Choose(mainPageBTNS.LogIN); 31 | 32 | //TODO: add your Reddit user and password 33 | System.out.println("Login app"); 34 | LogIn login = new LogIn(driver, Utils.AppUser, Utils.AppPass); //Taking care of the login page 35 | 36 | //Navigate to search and searching for a given text 37 | System.out.println("Navigate to search view and searching text"); 38 | postLoginPage postLogin = new postLoginPage(driver); 39 | //TODO: add search value 40 | postLogin.search("Israel"); //Text to search 41 | 42 | System.out.println("Test Ended"); 43 | } 44 | 45 | @AfterMethod 46 | public void tearDown(){ 47 | System.out.println("Run Ended"); 48 | 49 | driver.closeApp(); 50 | driver.resetApp(); 51 | driver.quit(); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Appium/Java/Reddit/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Appium/Java/testing_landscape_portrait/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.perfecto 8 | AppiumExtended 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 13 | org.apache.maven.plugins 14 | maven-compiler-plugin 15 | 16 | 1.8 17 | 1.8 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | io.appium 27 | java-client 28 | 3.1.0 29 | 30 | 31 | 32 | 33 | org.testng 34 | testng 35 | 6.9.12 36 | test 37 | 38 | 39 | io.appium 40 | java-client 41 | 4.0.0 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Appium/Java/testing_landscape_portrait/src/test/java/TestClass.java: -------------------------------------------------------------------------------- 1 | import org.testng.annotations.Test; 2 | 3 | /** 4 | * Test class. 5 | */ 6 | public class TestClass extends PerfectoTestNG { 7 | 8 | @Test 9 | public void testCase1() throws InterruptedException { 10 | 11 | //launch application 12 | driver.launchApp(); 13 | 14 | // Configure ScrollContext for the extended findElement method 15 | 16 | // Optional - Set the scroll context (swipe between scrollable elements), default value = 1 17 | driver.setScrollableContext(1); 18 | // Optional - Times to scroll before throwing exception ElementNotFound, default value = 2 19 | driver.setTimesToScroll(2); 20 | // Optional - Length of each scroll measured by JS scroll command, default value = 1 21 | driver.setScrollLength(1); 22 | 23 | // click registration button using @FindBy annotation 24 | MainPage mainPage = new MainPage(driver); 25 | mainPage.clickRegistrationBTN(); 26 | 27 | // building RegistrationPage instance, insert registration info using builder design pattern 28 | new RegistrationPage(driver) 29 | .withUsername("My_Username") 30 | .withEmail("My_Email@MailService.com") 31 | .withPassword("My_Password") 32 | .withName("My_Name") 33 | .withLanguage(ProgrammingLanguage.Javascript) 34 | .Verify(); 35 | 36 | // Just a busy waiting to watch pages changed 37 | Thread.sleep(2000); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Appium/Java/testing_landscape_portrait/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 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/.classpath: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | testng_sample 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 3 | org.eclipse.jdt.core.compiler.compliance=1.8 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.release=disabled 6 | org.eclipse.jdt.core.compiler.source=1.8 7 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/README.md -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/main/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/main/java/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/main/java/com/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/main/java/com/perfecto/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/main/java/com/perfecto/commons/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/testng/InvalidCommandLineArgumentException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.perfecto.commons.testng; 5 | 6 | /** 7 | * @author prasantsutaria 8 | * 9 | */ 10 | public class InvalidCommandLineArgumentException extends Exception{ 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | public InvalidCommandLineArgumentException(String message) { 15 | super(message); 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return "Aborting Execution : Reason - " + this.getMessage(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/testng/Keyword.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.commons.testng; 2 | 3 | public abstract class Keyword { 4 | 5 | public Keyword(TestCases testCase,String keywordDescription) { 6 | 7 | if(testCase.closeStep()) { 8 | testCase.EndStep(); 9 | } 10 | 11 | testCase.StartStep(keywordDescription); 12 | } 13 | 14 | public abstract void execute(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/testng/Logger.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.commons.testng; 2 | 3 | public class Logger { 4 | 5 | public static enum STATUS{ 6 | 7 | PASS("PASS"), 8 | FAIL("FAIL"), 9 | INFO("INFO"), 10 | FATAL("FATAL"); 11 | 12 | public String status; 13 | 14 | STATUS(String status) { 15 | this.status = status; 16 | } 17 | 18 | public String getStatus() { 19 | return this.status; 20 | } 21 | 22 | } 23 | 24 | public static void log(STATUS status, String message) { 25 | 26 | System.out.println("[" + status.getStatus() + "] :: " + message); 27 | if(status.getStatus().equals("FATAL")) { 28 | System.exit(0); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/testng/TestCaseInputs.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.commons.testng; 2 | 3 | 4 | import org.json.JSONObject; 5 | 6 | import com.perfecto.commons.utils.DevicesToTestOn.Device; 7 | 8 | public class TestCaseInputs { 9 | 10 | private Device deviceInformation; 11 | private JSONObject testData; 12 | private String groupName; 13 | 14 | public TestCaseInputs(String groupName, Device deviceInformation, JSONObject testData) { 15 | this.deviceInformation = deviceInformation; 16 | this.testData = testData; 17 | this.groupName = groupName; 18 | } 19 | 20 | public TestCaseInputs(String groupName, Device deviceInformation) { 21 | this.deviceInformation = deviceInformation; 22 | } 23 | 24 | public TestCaseInputs(String groupName, JSONObject testData) { 25 | this.testData = testData; 26 | } 27 | 28 | public Device getDeviceInformation() { 29 | return this.deviceInformation; 30 | } 31 | 32 | public JSONObject getTestData() { 33 | return this.testData; 34 | } 35 | 36 | public String getGroupName() { 37 | return groupName; 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/testng/TestCases.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.commons.testng; 2 | 3 | import org.testng.xml.XmlTest; 4 | 5 | import com.perfecto.reporting.Reports; 6 | 7 | import io.appium.java_client.AppiumDriver; 8 | import io.appium.java_client.MobileElement; 9 | 10 | public class TestCases extends XmlTest{ 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | private Reports reportium; 15 | private TestCaseInputs inputs; 16 | private boolean deviceAllocated = false; 17 | private AppiumDriver driver; 18 | private boolean closeStep = false; 19 | 20 | 21 | public TestCases(TestCaseInputs inputs) { 22 | this.inputs = inputs; 23 | } 24 | 25 | public TestCaseInputs getTestCaseInputs() { 26 | return this.inputs; 27 | } 28 | 29 | public void setReportiumClient(Reports reportium) { 30 | this.reportium = reportium; 31 | } 32 | 33 | public void StartStep(String stepDescription) { 34 | this.reportium.startStep(stepDescription); 35 | } 36 | 37 | public void EndStep() { 38 | this.reportium.endStep(); 39 | } 40 | 41 | public boolean isDeviceAllocated() { 42 | return deviceAllocated; 43 | } 44 | 45 | public void setDeviceAllocated(boolean deviceAllocated) { 46 | this.deviceAllocated = deviceAllocated; 47 | } 48 | 49 | public AppiumDriver getDriver() { 50 | return driver; 51 | } 52 | 53 | public void setDriver(AppiumDriver driver) { 54 | this.driver = driver; 55 | } 56 | 57 | public Reports getReport() { 58 | return this.reportium; 59 | } 60 | 61 | public boolean closeStep() { 62 | return this.closeStep; 63 | } 64 | 65 | public void setCloseStep(boolean closeStep) { 66 | this.closeStep = closeStep; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/testng/TestNGDataProvider.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.commons.testng; 2 | 3 | import org.testng.ITestContext; 4 | import org.testng.ITestNGMethod; 5 | import org.testng.annotations.DataProvider; 6 | 7 | import com.perfecto.commons.utils.GenerateTestData; 8 | 9 | public class TestNGDataProvider { 10 | 11 | public final static String DATAPROVIDER="DataProvider"; 12 | 13 | @DataProvider(name=DATAPROVIDER,parallel=true) 14 | public static Object[][] getTestData(ITestContext test, ITestNGMethod methos){ 15 | 16 | return GenerateTestData.getData(test.getCurrentXmlTest().getIncludedGroups().get(0),test.getCurrentXmlTest().getAllParameters()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/utils/AndroidAppConstant.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.commons.utils; 2 | 3 | import java.util.Iterator; 4 | import java.util.Map.Entry; 5 | import java.util.Properties; 6 | import java.util.Set; 7 | 8 | import org.openqa.selenium.remote.DesiredCapabilities; 9 | 10 | public class AndroidAppConstant { 11 | 12 | private static AndroidAppConstant androidAppConst; 13 | private Properties appConst; 14 | 15 | private AndroidAppConstant() { 16 | SuiteConstants suiteConst = new SuiteConstants(); 17 | suiteConst.loadPropertiesFile("src/test/resources/android/app.properties"); 18 | appConst = suiteConst.getProperties(); 19 | 20 | } 21 | 22 | public static AndroidAppConstant getAppConstant() { 23 | if(androidAppConst==null) { 24 | androidAppConst = new AndroidAppConstant(); 25 | } 26 | 27 | return androidAppConst; 28 | } 29 | 30 | public String getConstant(String constantName) { 31 | return this.appConst.getProperty(constantName, ""); 32 | } 33 | 34 | 35 | public void setAppConstants(DesiredCapabilities capability) { 36 | Set> entries = this.appConst.entrySet(); 37 | Iterator> entryIterator = entries.iterator(); 38 | Entry currentEntry; 39 | while(entryIterator.hasNext()) { 40 | currentEntry = entryIterator.next(); 41 | capability.setCapability((String)currentEntry.getKey(), (String)currentEntry.getValue()); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/utils/IOSAppConstant.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.commons.utils; 2 | 3 | import java.util.Iterator; 4 | import java.util.Properties; 5 | import java.util.Set; 6 | import java.util.Map.Entry; 7 | 8 | import org.openqa.selenium.remote.DesiredCapabilities; 9 | 10 | public class IOSAppConstant { 11 | 12 | private static IOSAppConstant iOSAppConst; 13 | private Properties appConst; 14 | 15 | private IOSAppConstant() { 16 | SuiteConstants suiteConst = new SuiteConstants(); 17 | suiteConst.loadPropertiesFile("src/test/resources/ios/app.properties"); 18 | appConst = suiteConst.getProperties(); 19 | 20 | } 21 | 22 | public static IOSAppConstant getAppConstant() { 23 | if(iOSAppConst==null) { 24 | iOSAppConst = new IOSAppConstant(); 25 | } 26 | 27 | return iOSAppConst; 28 | } 29 | 30 | public String getConstant(String constantName) { 31 | return this.appConst.getProperty(constantName, ""); 32 | } 33 | 34 | public void setAppConstants(DesiredCapabilities capability) { 35 | Set> entries = this.appConst.entrySet(); 36 | Iterator> entryIterator = entries.iterator(); 37 | Entry currentEntry; 38 | while(entryIterator.hasNext()) { 39 | currentEntry = entryIterator.next(); 40 | capability.setCapability((String)currentEntry.getKey(), (String)currentEntry.getValue()); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/utils/PerfectoCloudInformation.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.commons.utils; 2 | 3 | import java.util.Properties; 4 | 5 | public class PerfectoCloudInformation { 6 | 7 | private static PerfectoCloudInformation perfectoConst; 8 | private Properties cloudProperties; 9 | private String availableDeviceUrl; 10 | private String listDeviceUrl; 11 | private String hubUrl; 12 | 13 | private PerfectoCloudInformation() { 14 | 15 | SuiteConstants suiteConst = new SuiteConstants(); 16 | suiteConst.loadPropertiesFile("src/test/resources/perfecto/cloud.properties"); 17 | cloudProperties = suiteConst.getProperties(); 18 | 19 | this.hubUrl = String.format("https://%s.perfectomobile.com/nexperience/perfectomobile/wd/hub",getConstant("perfecto.cloudname")); 20 | 21 | availableDeviceUrl = String.format( 22 | "https://%s.perfectomobile.com/services/handsets?operation=list&user=%s&password=%s&inUse=false&status=connected", 23 | getConstant("perfecto.cloudname"), getConstant("perfecto.username"), getConstant("perfecto.apikey")); 24 | 25 | listDeviceUrl = String.format( 26 | "https://%s.perfectomobile.com/services/handsets?operation=list&user=%s&password=%s&status=connected", 27 | getConstant("perfecto.cloudname"), getConstant("perfecto.username"), getConstant("perfecto.apikey")); 28 | } 29 | 30 | public String getAvailableDevicesAPIBaseUrl() { 31 | return this.availableDeviceUrl; 32 | } 33 | 34 | public String getDevicesAPIBaseUrl() { 35 | return this.listDeviceUrl; 36 | } 37 | 38 | public static PerfectoCloudInformation loadPerfectoConstants() { 39 | if (perfectoConst == null) { 40 | perfectoConst = new PerfectoCloudInformation(); 41 | } 42 | 43 | return perfectoConst; 44 | } 45 | 46 | public String getConstant(String constantName) { 47 | return this.cloudProperties.getProperty(constantName, ""); 48 | } 49 | 50 | public String getHubUrl() { 51 | return hubUrl; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/utils/ReportiumConstant.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.commons.utils; 2 | 3 | import java.util.Properties; 4 | 5 | public class ReportiumConstant { 6 | 7 | private static ReportiumConstant reportiumConst; 8 | private Properties reportiumProp 9 | ; 10 | 11 | private ReportiumConstant() { 12 | SuiteConstants suiteConst = new SuiteConstants(); 13 | suiteConst.loadPropertiesFile("src/test/resources/perfecto/reportium.properties"); 14 | reportiumProp = suiteConst.getProperties(); 15 | 16 | } 17 | 18 | public static ReportiumConstant getReportiumConstant() { 19 | if(reportiumConst==null) { 20 | reportiumConst = new ReportiumConstant(); 21 | } 22 | 23 | return reportiumConst; 24 | } 25 | 26 | public String getConstant(String constantName) { 27 | return this.reportiumProp.getProperty(constantName, ""); 28 | } 29 | 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/commons/utils/SuiteConstants.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.commons.utils; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.FileReader; 6 | import java.io.IOException; 7 | import java.util.Properties; 8 | 9 | import com.perfecto.commons.testng.Logger; 10 | import com.perfecto.commons.testng.Logger.STATUS; 11 | 12 | public class SuiteConstants { 13 | 14 | private Properties properties; 15 | 16 | public void loadPropertiesFile(String filePath) { 17 | File file = new File(filePath); 18 | try(FileReader fileReader = new FileReader(file)){ 19 | this.properties = new Properties(); 20 | this.properties.load(fileReader); 21 | } catch (FileNotFoundException e) { 22 | Logger.log(STATUS.FAIL, e.getMessage()); 23 | } catch (IOException e) { 24 | Logger.log(STATUS.FAIL, e.getMessage()); 25 | } 26 | } 27 | 28 | public Properties getProperties() { 29 | return properties; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/mobile/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/main/java/com/perfecto/mobile/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/mobile/android/CustomAndroidDriver.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.mobile.android; 2 | 3 | import java.net.URL; 4 | 5 | import org.openqa.selenium.Capabilities; 6 | 7 | import io.appium.java_client.MobileElement; 8 | import io.appium.java_client.android.AndroidDriver; 9 | 10 | @SuppressWarnings("unchecked") 11 | public class CustomAndroidDriver extends AndroidDriver{ 12 | 13 | public CustomAndroidDriver(URL remoteAddress, Capabilities desiredCapabilities) { 14 | super(remoteAddress, desiredCapabilities); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/mobile/android/PerfectoDesiredCapability.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.mobile.android; 2 | 3 | public class PerfectoDesiredCapability { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/mobile/android/PerfectoDriver.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.mobile.android; 2 | 3 | public class PerfectoDriver { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/mobile/ios/CustomIOSDriver.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.mobile.ios; 2 | 3 | import java.net.URL; 4 | 5 | import org.openqa.selenium.Capabilities; 6 | 7 | import io.appium.java_client.MobileElement; 8 | import io.appium.java_client.ios.IOSDriver; 9 | 10 | @SuppressWarnings("unchecked") 11 | public class CustomIOSDriver extends IOSDriver{ 12 | 13 | public CustomIOSDriver(URL remoteAddress, Capabilities desiredCapabilities) { 14 | super(remoteAddress, desiredCapabilities); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/mobile/ios/PerfectoDesiredCapability.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.mobile.ios; 2 | 3 | public class PerfectoDesiredCapability { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/mobile/ios/PerfectoDriver.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.mobile.ios; 2 | 3 | public class PerfectoDriver { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/mobile/utils/MobileScreen.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.mobile.utils; 2 | 3 | public interface MobileScreen { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/main/java/com/perfecto/reporting/Reports.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.reporting; 2 | 3 | import com.perfecto.commons.utils.ReportiumConstant; 4 | import com.perfecto.reportium.client.ReportiumClient; 5 | import com.perfecto.reportium.client.ReportiumClientFactory; 6 | import com.perfecto.reportium.model.Job; 7 | import com.perfecto.reportium.model.PerfectoExecutionContext; 8 | import com.perfecto.reportium.model.Project; 9 | import com.perfecto.reportium.test.TestContext; 10 | import com.perfecto.reportium.test.result.TestResultFactory; 11 | 12 | import io.appium.java_client.AppiumDriver; 13 | import io.appium.java_client.MobileElement; 14 | 15 | public class Reports { 16 | 17 | private PerfectoExecutionContext execContext; 18 | private ReportiumClient reportiumClient; 19 | 20 | public Reports(AppiumDriver driver) { 21 | ReportiumConstant reportConstants = ReportiumConstant.getReportiumConstant(); 22 | 23 | Project project = new Project(reportConstants.getConstant("projectname"),reportConstants.getConstant("projectversion")); 24 | Job job = new Job(reportConstants.getConstant("jobname"),Integer.parseInt(reportConstants.getConstant("jobversion"))); 25 | 26 | this.execContext = new PerfectoExecutionContext.PerfectoExecutionContextBuilder() 27 | .withProject(project) 28 | .withJob(job) 29 | .withWebDriver(driver) 30 | .build(); 31 | 32 | this.reportiumClient = new ReportiumClientFactory().createPerfectoReportiumClient(execContext); 33 | } 34 | 35 | public void startTest(String testName) { 36 | TestContext testContext = new TestContext.Builder().build(); 37 | this.reportiumClient.testStart(testName, testContext); 38 | } 39 | 40 | public void endTest(boolean isPass,String... errorMessage) { 41 | 42 | if(isPass) { 43 | this.reportiumClient.testStop(TestResultFactory.createSuccess()); 44 | }else { 45 | if(errorMessage.length>0) { 46 | this.reportiumClient.testStop(TestResultFactory.createFailure(errorMessage[0])); 47 | }else { 48 | this.reportiumClient.testStop(TestResultFactory.createFailure("No Failure Reason provided")); 49 | } 50 | } 51 | } 52 | 53 | public void startStep(String stepDescription) { 54 | this.reportiumClient.stepStart(stepDescription); 55 | } 56 | 57 | public void endStep() { 58 | this.reportiumClient.stepEnd(); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/test/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/java/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/test/java/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/java/com/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/test/java/com/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/java/com/perfecto/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/test/java/com/perfecto/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/java/com/perfecto/keywords/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/test/java/com/perfecto/keywords/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/java/com/perfecto/keywords/percentage/ValidatePrimaryCard.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.keywords.percentage; 2 | 3 | import com.perfecto.commons.testng.Keyword; 4 | import com.perfecto.commons.testng.TestCases; 5 | import com.perfecto.pom.PrimaryCardScreen; 6 | 7 | /* 8 | * Extend Keyword Class to Qualify this class as Keyword. 9 | * Implement execute method to define steps. 10 | * 11 | */ 12 | 13 | public class ValidatePrimaryCard extends Keyword { 14 | 15 | private TestCases currentTestCase; 16 | 17 | /* 18 | * Keyword Constructor 19 | * Arguments: 20 | * TestCases testCase - Represents the calling test case. 21 | */ 22 | 23 | public ValidatePrimaryCard(TestCases testCase) { 24 | 25 | // Call Keyword class constructor with the test case object and 26 | // Step name - is used by digital zoom reporting to define step name. 27 | 28 | super(testCase, "Validate Primary Card"); 29 | this.currentTestCase = testCase; 30 | } 31 | 32 | @Override 33 | public void execute() { 34 | 35 | PrimaryCardScreen primaryCardScreen = new PrimaryCardScreen(currentTestCase.getDriver()); 36 | 37 | // Assert Enter Percentage Text Box is Displayed. 38 | primaryCardScreen.assertEnterPercentageTextBoxIsDisplayed(); 39 | 40 | // Assert Enter Percentage Text Box is Enabled. 41 | primaryCardScreen.assertEnterPercentageTextBoxIsEnabled(); 42 | 43 | // Assert Enter Percentage Text Box is Displayed. 44 | primaryCardScreen.assertEnterNumberTextBoxIsDisplayed(); 45 | 46 | // Assert Enter Number Text Box is Enabled. 47 | primaryCardScreen.assertEnterNumberTextBoxIsEnabled(); 48 | 49 | // Assert Result Label is Displayed. 50 | primaryCardScreen.assertResultLabelIsDisplayed(); 51 | 52 | // Assert Result Label is Disabled. 53 | primaryCardScreen.assertResultLabelIsDisabled(); 54 | 55 | primaryCardScreen.hideKeyboard(); 56 | 57 | // Assert Calc Button is Displayed 58 | primaryCardScreen.assertCalcButtonIsDisplayed(); 59 | 60 | // Assert Calc Button is Enabled 61 | primaryCardScreen.assertCalcButtonIsEnabled(); 62 | 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/java/com/perfecto/pom/LaunchScreen.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.pom; 2 | 3 | import org.openqa.selenium.Point; 4 | import org.openqa.selenium.ScreenOrientation; 5 | import org.openqa.selenium.support.PageFactory; 6 | 7 | import com.perfecto.mobile.utils.MobileScreen; 8 | 9 | import io.appium.java_client.AppiumDriver; 10 | import io.appium.java_client.MobileElement; 11 | import io.appium.java_client.TouchAction; 12 | import io.appium.java_client.pagefactory.AppiumFieldDecorator; 13 | import io.appium.java_client.pagefactory.iOSFindBy; 14 | 15 | /* 16 | * Implement MobileScreen Interface to qualify the class as a Mobile Screen class 17 | */ 18 | 19 | public class LaunchScreen implements MobileScreen{ 20 | 21 | AppiumDriver driver; 22 | 23 | // ================================================================================================================================= 24 | 25 | public LaunchScreen(AppiumDriver driver) { 26 | this.driver = driver; 27 | PageFactory.initElements(new AppiumFieldDecorator(driver), this); 28 | } 29 | 30 | // ================================================================================================================================= 31 | 32 | @iOSFindBy(xpath="//*[@label=\"Env\"]") 33 | MobileElement envButton; 34 | 35 | public Point getEnvLocation() { 36 | return envButton.getLocation(); 37 | } 38 | 39 | public void clickEnv() { 40 | envButton.click(); 41 | } 42 | 43 | public void clickEnvByCoordinate(Point location) { 44 | 45 | TouchAction touchAction = new TouchAction(driver); 46 | touchAction.tap(location.getX() + 10, location.getY() + 10).perform(); 47 | } 48 | 49 | public boolean isEnvSelected() { 50 | String isSelected = envButton.getAttribute("value"); 51 | return isSelected !=null && isSelected.equals("1"); 52 | } 53 | 54 | // ================================================================================================================================= 55 | 56 | @iOSFindBy(xpath="//*[@label=\"Arg\"]") 57 | MobileElement argButton; 58 | 59 | 60 | public void clickArg() { 61 | argButton.click(); 62 | } 63 | 64 | public void rotateScreen() { 65 | driver.rotate(ScreenOrientation.PORTRAIT); 66 | 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/java/com/perfecto/tests/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/test/java/com/perfecto/tests/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/java/com/perfecto/tests/calc/PercentageCalculationTest.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.tests.calc; 2 | 3 | import org.testng.annotations.AfterMethod; 4 | import org.testng.annotations.BeforeMethod; 5 | import org.testng.annotations.Factory; 6 | import org.testng.annotations.Test; 7 | 8 | import com.perfecto.commons.testng.TestCaseInputs; 9 | import com.perfecto.commons.testng.TestCases; 10 | import com.perfecto.commons.testng.TestNGDataProvider; 11 | import com.perfecto.keywords.percentage.ValidatePrimaryCard; 12 | 13 | /* 14 | * Extend TestCases class to qualify class as Test 15 | */ 16 | 17 | 18 | public class PercentageCalculationTest extends TestCases{ 19 | 20 | // Constructor for PercentageCalculationTest test. Required else test will not be picked. 21 | @Factory(dataProviderClass = TestNGDataProvider.class, dataProvider = TestNGDataProvider.DATAPROVIDER) 22 | public PercentageCalculationTest(TestCaseInputs inputs) { 23 | super(inputs); 24 | } 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | /* 29 | * Set up for Test Case. 30 | * Required for TestNG Listener calls 31 | */ 32 | 33 | @BeforeMethod(groups = { "primarycard_validation" }) 34 | public void setUpMyTest() { 35 | // Any Setup steps to be performed. 36 | } 37 | 38 | /* 39 | * Test Case Steps 40 | */ 41 | 42 | @Test(groups = { 43 | "primarycard_validation" }, description = "Verify Primary Card Elements") 44 | public void myTest() { 45 | 46 | ValidatePrimaryCard validatePrimaryCardKeyword = new ValidatePrimaryCard(this); 47 | validatePrimaryCardKeyword.execute(); 48 | 49 | } 50 | 51 | /* 52 | * Tear down for Test Case. 53 | * Required for TestNG Listener calls 54 | */ 55 | 56 | @AfterMethod(groups = { "primarycard_validation" }, alwaysRun = true) 57 | public void cleanUpMyTest() { 58 | // Any Tear down steps to be performed. 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/java/com/perfecto/tests/calc/RotateScreenTest.java: -------------------------------------------------------------------------------- 1 | package com.perfecto.tests.calc; 2 | 3 | import org.openqa.selenium.Point; 4 | import org.testng.annotations.AfterMethod; 5 | import org.testng.annotations.BeforeMethod; 6 | import org.testng.annotations.Factory; 7 | import org.testng.annotations.Test; 8 | 9 | import com.perfecto.commons.testng.TestCaseInputs; 10 | import com.perfecto.commons.testng.TestCases; 11 | import com.perfecto.commons.testng.TestNGDataProvider; 12 | import com.perfecto.pom.LaunchScreen; 13 | 14 | /* 15 | * Extend TestCases class to qualify class as Test 16 | */ 17 | 18 | public class RotateScreenTest extends TestCases{ 19 | 20 | 21 | // Constructor for Rotatescreen test. Required else test will not be picked. 22 | @Factory(dataProviderClass = TestNGDataProvider.class, dataProvider = TestNGDataProvider.DATAPROVIDER) 23 | public RotateScreenTest(TestCaseInputs inputs) { 24 | super(inputs); 25 | } 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | /* 30 | * Set up for Test Case. 31 | * Required for TestNG Listener calls 32 | */ 33 | 34 | @BeforeMethod(groups = { "rotate_screen" }) 35 | public void setUpMyTest() { 36 | // Any Setup steps to be performed. 37 | } 38 | 39 | /* 40 | * Test Case Steps 41 | */ 42 | 43 | @Test(groups = { 44 | "rotate_screen" }, description = "Rotate Screen") 45 | public void myTest() { 46 | 47 | // Initialize Screen Object 48 | LaunchScreen launchScreen =new LaunchScreen(getDriver()); 49 | 50 | 51 | // Get Env Element location 52 | Point location = launchScreen.getEnvLocation(); 53 | 54 | // Click on Arg Button 55 | launchScreen.clickArg(); 56 | 57 | System.out.println("----- Before Rotation -------"); 58 | 59 | // Rotate Device 60 | launchScreen.rotateScreen(); 61 | 62 | // Get Env Element location 63 | location = launchScreen.getEnvLocation(); 64 | 65 | System.out.println("----- After Rotation -------"); 66 | 67 | // Click Env Element based on Coordinate 68 | launchScreen.clickEnvByCoordinate(location); 69 | 70 | } 71 | 72 | /* 73 | * Tear down for Test Case. 74 | * Required for TestNG Listener calls 75 | */ 76 | 77 | @AfterMethod(groups = { "rotate_screen" }, alwaysRun = true) 78 | public void cleanUpMyTest() { 79 | // Any Tear down steps to be performed. 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/resources/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Appium/Java/testng_sample/src/test/resources/.DS_Store -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/resources/android/app.properties: -------------------------------------------------------------------------------- 1 | #=========== Provide App Package Name ============== 2 | appPackage=com.perfectomobile.calc 3 | #appActivity= 4 | #=========== Provide App path ============== 5 | app= -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/resources/ios/app.properties: -------------------------------------------------------------------------------- 1 | #============ Provide App Name ============ 2 | bundleId=com.igor.SimpleIosAppForTesting 3 | #============ Provide App Path ============ 4 | app= -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/resources/perfecto/cloud.properties: -------------------------------------------------------------------------------- 1 | #========= Provide Cloud name like demo ============== 2 | perfecto.cloudname= 3 | #========= Provide Cloud API Key (Recommended) ============== 4 | perfecto.apikey= 5 | #========= Provide User Name (Optional) ============== 6 | #perfecto.username=prasants@perfectomobile.com 7 | #========= If User Name provided then provide password ============== 8 | #perfecto.password= -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/resources/perfecto/reportium.properties: -------------------------------------------------------------------------------- 1 | #============== Provide CI Project Name =============== 2 | projectname=TestNG POC 3 | #============== Provide CI Project Version =============== 4 | projectversion=1.0 5 | #============== Provide CI Job Name =============== 6 | jobname=Plain Java Test Suite 7 | #============== Provide CI Job Version =============== 8 | jobversion=1 -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/resources/testdata/anothertest.json: -------------------------------------------------------------------------------- 1 | [{"UserID":"James Bond","Password":"SuperSecretPassword"}] -------------------------------------------------------------------------------- /Appium/Java/testng_sample/src/test/resources/testdata/primarycard_validation.json: -------------------------------------------------------------------------------- 1 | [{"UserID":"Steves Job","Password":"Password1"}] -------------------------------------------------------------------------------- /Appium/Java/testng_sample/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 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 | -------------------------------------------------------------------------------- /Appium/JavaScript/.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules -------------------------------------------------------------------------------- /Appium/JavaScript/README.md: -------------------------------------------------------------------------------- 1 | ## WebDriverIO - JavaScript Sample for Native Automation 2 | 3 | The following sample shows how to Install an application and use WebDriverIO to automate and test it. 4 | It uses selendroid test application which can be downloaded from [here](https://github.com/PerfectoCode/AppsForSamples/tree/master/selendroid-test-app-0.17.0). 5 | 6 | The sample uses [WebDriverIO](http://webdriver.io/) and [Jasmine](jasmine.github.io) testing framework. 7 | 8 | ## Getting Started: 9 | - use `npm install` command within the sample's directory to download the project's dependencies. 10 | - Set your Perfecto Lab User, Password and Host (cloud) within the file [wdio.conf.js](wdio.conf.js): 11 | ```JavaScript 12 | //Set your Perfecto lab user, pass and host here. 13 | const host = 'MY_HOST.perfectomobile.com'; 14 | const user = 'MY_USER@perfectomobile.com'; 15 | const pass = 'MY_PASS'; 16 | ``` 17 | - Set your capabilities within the sample file: 18 | ```JavaScript 19 | capabilities: [{ 20 | // maxInstances can get overwritten per capability. 21 | platformName: 'Android', 22 | browserName: 'mobileOS', 23 | // deviceName: 'DEVICE_ID', // Optional 24 | user: user, 25 | password: pass, 26 | app: 'PRIVATE:selendroid-test-app-0.17.0.apk', // Sample app to install 27 | appPackage: 'io.selendroid.testapp', // app's package 28 | }], 29 | ``` 30 | - Run the test using `npm test` command. 31 | 32 | ## Writing your test: 33 | - Write your test within "describe" and "it" functions: 34 | ```JavaScript 35 | describe('Perfecto Native NodeJS - Selendroid app', function () { 36 | 37 | it('Test Native and Webview', function () { 38 | 39 | // Your test should go here 40 | 41 | }); 42 | }); 43 | ``` 44 | 45 | - Using assertions: 46 | ```JavaScript 47 | expect(Value1).toContain(Value2); 48 | ``` 49 | 50 | For the complite WebDriverIO API click [here](http://webdriver.io/api.html). 51 | -------------------------------------------------------------------------------- /Appium/JavaScript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "perfecto_appium_sample", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "perfectoSpec.js", 6 | "scripts": { 7 | "test": "node_modules/webdriverio/bin/wdio wdio.conf.js" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "wdio": "^0.3.3", 13 | "wdio-jasmine-framework": "^0.2.19", 14 | "wdio-mocha-framework": "^0.5.8" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Appium/JavaScript/perfectoSpec.js: -------------------------------------------------------------------------------- 1 | 2 | describe('Perfecto Native NodeJS - Selendroid app', function () { 3 | 4 | it('Test Native and Webview', function () { 5 | // Native 6 | browser 7 | .clearElement('//*[@resource-id="io.selendroid.testapp:id/my_text_field"]') 8 | .setValue('//*[@resource-id="io.selendroid.testapp:id/my_text_field"]', 'Guardians Of The Galaxy') 9 | .click('//*[@resource-id="io.selendroid.testapp:id/visibleButtonTest"]'); 10 | 11 | // Assert seeing floating text 12 | let text = browser.getText('//*[@resource-id="io.selendroid.testapp:id/visibleTextView"]'); 13 | expect(text).toContain('sometimes'); 14 | 15 | // Play with WebView 16 | browser 17 | .click('//*[@resource-id="io.selendroid.testapp:id/buttonStartWebview"]') 18 | .clearElement('//*[@resource-id="name_input"]') 19 | .setValue('//*[@resource-id="name_input"]' , 'Groot') 20 | .click('//*[@content-desc="Volvo"]') 21 | .click('//*[@text="Mercedes"]') 22 | .click('//*[@content-desc="Send me your name!"]'); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /Appium/README.md: -------------------------------------------------------------------------------- 1 | ##Appium Driver For Native App Automation 2 | 3 | This section contains Appium Driver code samples for Native application automation using different programming languages such as Java, C#, Python and Ruby. 4 | It's recommended to follow the tests stracture and use test frameworks in order to keep the test stability. 5 | 6 | **Prerequisites:** 7 | - Download and install Appium Driver from [here](http://appium.io/downloads.html). 8 | - It's recommended to use Perfecto plugin for Visual Studio / Eclipse / Intellij , Download from [here](https://www.perfectomobile.com/download-integrations). 9 | -------------------------------------------------------------------------------- /Appium/Ruby_Appium_iOS_Test.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'test/unit' 3 | require 'appium_lib' 4 | 5 | class AppiumIOSTest < Test::Unit::TestCase 6 | 7 | def setup 8 | desired_caps = { 9 | caps: { 10 | platformName: 'iOS', 11 | deviceName: '', # enter here your device Id 12 | bundleId: 'com.apple.mobileslideshow', 13 | user: 'user@company.com', # enter here your Perfecto user name 14 | password: 'password', # enter here your Perfecto password 15 | takesScreenshot: false, 16 | }, 17 | appium_lib: { 18 | server_url: 'https://%s/nexperience/perfectomobile/wd/hub' % 'your_host', # enter here your Perfecto host name 19 | } 20 | } 21 | @driver = Appium::Driver.new(desired_caps) 22 | @driver.start_driver.manage.timeouts.implicit_wait = 10 23 | end 24 | 25 | def teardown 26 | @driver.driver_quit 27 | end 28 | 29 | def test_gestures 30 | @driver.find_element(:name, 'Moments') 31 | img_elements = @driver.find_elements(:class_name, 'UIACollectionCell') 32 | img_elements[0].click 33 | 34 | size = @driver.window_size 35 | start_x = size.width * 0.8 36 | end_x = size.width * 0.2 37 | y = size.height / 2 38 | 39 | params_zoom = { 40 | 'start' => '50%,35%', 41 | 'end' => '50%,40%', 42 | 'duration' => '1', 43 | 'operation' => 'zoom', 44 | } 45 | params_pinch = { 46 | 'start' => '50%,65%', 47 | 'end' => '50%,60%', 48 | 'duration' => '1', 49 | 'operation' => 'pinch', 50 | } 51 | 52 | img_elements.each do 53 | sleep 0.5 54 | @driver.execute_script 'mobile:touch:gesture', params_zoom 55 | @driver.execute_script 'mobile:touch:gesture', params_pinch 56 | @driver.swipe start_x: start_x, start_y: y, end_x: end_x, end_y: y, duration: 500 57 | end 58 | 59 | @driver.find_element(:name, 'Back').click 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /Cross-Platforms tests/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Cross-Platforms tests/.DS_Store -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/Airbnb/README.md: -------------------------------------------------------------------------------- 1 | # Airbnb cross platform sample. 2 | 3 | This test performs double step authentication, where a mobile number is entered into an Airbnb account, 4 | the Web app sends an SMS to the mobile, and the code in the SMS is entered into the Web app to complete authentication. 5 | 6 | Two drivers are created in a single test - RemoteWebDriver and IOSDriver, the later using NATIVE_APP context. 7 | 8 | **To do before running this test**: 9 | - Define your lab, username, and password. 10 | - Determine phone number of the mobile to use for this test. Insert mobile ID and number in script right before mobileDrive creation. 11 | - Create an account in Airbnb with your email and a password, and enter these in the script at point of login to Airbnb. 12 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/Airbnb/objectsXpaths.java: -------------------------------------------------------------------------------- 1 | //package com.perfectomobile.pm.testng.selenium; 2 | import java.io.*; 3 | import java.net.*; 4 | import java.util.*; 5 | import java.util.concurrent.TimeUnit; 6 | 7 | import org.openqa.selenium.*; 8 | import org.openqa.selenium.html5.*; 9 | import org.openqa.selenium.logging.*; 10 | import org.openqa.selenium.remote.*; 11 | 12 | public class objectsXpaths { 13 | //desktop web app XPaths and IDs 14 | public static By loginLink = By.xpath("//a[ancestor::*[@id='new-header'] and contains(text(),'Log In')]"); 15 | public static By loginWin = By.xpath("//*[parent::*[@id='login-modal-content'] and contains(@class,'signup-login-form')]"); 16 | public static By emailId = By.id("signin_email"); 17 | public static By pswdId = By.id("signin_password"); 18 | public static By loginBtnId = By.id("user-login-btn"); 19 | public static By userIcon = By.xpath("//span[ancestor::*[@id='new-header'] and text()='Dorit' and contains(@class,'margin-right--tiny hide-md')]"); 20 | public static By editProfile = By.xpath("//div[text()='Edit Profile']"); 21 | public static By addCellNo = By.xpath("//span[ancestor::*[@id='update_form'] and contains(text(),'Add a phone number')]"); 22 | public static By CellCountryId = By.id("phone_country"); 23 | public static By cellNoId = By.id("phone_number"); 24 | public static By verifyViaSMSBtn = By.xpath("//*[@id='update_form']/div[2]/div[2]/div[6]/div/div[1]/div/div[2]/div[1]/div[2]/a[1]"); 25 | public static By codeViaSMS = By.xpath("//*[preceding-sibling::*[contains(text(),'We sent a verification code to')] and @id='phone_number_verification']"); 26 | public static By verifyBtn = By.xpath("//*[@id='update_form']/div[2]/div[2]/div[6]/div/div[1]/div/div[2]/div[2]/div/a[1]"); 27 | public static By saveBtn = By.xpath("//*[@id='update_form']/button"); 28 | 29 | //mobile XPaths and IDs 30 | public static By msgMainTitle = By.xpath("//*[contains(@label,'Messages')]"); 31 | public static By msgBackButton = By.xpath("//*[contains(@label,'Back')"); 32 | public static By lastAirbnbMsg = By.xpath("//UIAStaticText[contains(@label,'Airbnb security code:')]"); 33 | //public static By lastAirbnbMsg = By.xpath("//UIAStaticText[@label='732-873, Unread, 7:25 AM, Airbnb security code: 3280. Use this to finish verification.']"); 34 | } 35 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/Amazon/README.md: -------------------------------------------------------------------------------- 1 | #Amazon Cross-Platform test Java 2 | 3 | **To do**: 4 | - Import the project as Maven project. 5 | - Replace devices capabilities at conf.xml file. 6 | - Replace My_User with your could user at Properties.java. 7 | - Replace My_Pass with your cloud password at Properties.java. 8 | - Replace other tests parameters at Properties.java. 9 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/Amazon/conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/Amazon/src/test/java/Properties.java: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @author Daniel 4 | * Test properties. 5 | * Here you set your personal information and App information. 6 | */ 7 | public class Properties{ 8 | 9 | //perfecto properties. 10 | //public static final String user = "My_User"; 11 | //public static final String pass = "My_Password"; 12 | public static final String Token = "API_TOKEN"; 13 | public static final String mobileHost = "My_Host.perfectomobile.com"; 14 | public static final String webHost = "My_Host.perfectomobile.com"; 15 | //Application properties. 16 | public static final String AppNameiOS = "Amazon"; 17 | public static final String AppNameAndroid = "Amazon"; 18 | public static final String Website = "https://www.amazon.co.uk"; 19 | public static final String AppUser = "AppUserName"; 20 | public static final String AppPass = "AppPassword"; 21 | //Other stuff and Site values. 22 | public static final String SearchValue = "Pink Floyd"; 23 | public static final String FullName = "MyFullName"; 24 | public static final String NameOnly = "My_Name"; 25 | public static final String AddressLine1 = "AddressLine1"; 26 | public static final String Town = "MyTown"; 27 | public static final String Country = "MyCountry"; 28 | public static final String PostCode = "123456"; 29 | public static final String Phone = "972123456789"; 30 | 31 | } -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/Amazon/src/test/java/cloud.java: -------------------------------------------------------------------------------- 1 | import java.net.MalformedURLException; 2 | import java.net.URL; 3 | 4 | /** 5 | * @author Daniel. 6 | * Configure the cloud URL . 7 | */ 8 | public class cloud{ 9 | 10 | private URL webURL; 11 | private URL mobileURL; 12 | public cloud() throws MalformedURLException{ 13 | mobileURL = new URL("https://" + Properties.mobileHost + "/nexperience/perfectomobile/wd/hub"); 14 | webURL = new URL("https://" + Properties.webHost + "/nexperience/perfectomobile/wd/hub"); 15 | } 16 | 17 | public URL getwebURL(){ 18 | return this.webURL; 19 | } 20 | public URL getmobileURL(){ 21 | return this.mobileURL; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/Amazon/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: daniela 3 | Build-Jdk: 1.8.0_77 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/Amazon/target/classes/META-INF/maven/Amazon/Amazon/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sun May 01 11:09:16 IDT 2016 3 | version=0.0.1-SNAPSHOT 4 | groupId=Amazon 5 | m2e.projectName=Amazon 6 | m2e.projectLocation=C\:\\Users\\daniela\\workspace\\Amazon 7 | artifactId=Amazon 8 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/IMDb-Android-and-Chrome/IMDb-AndroidAndChrome/.classpath: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/IMDb-Android-and-Chrome/IMDb-AndroidAndChrome/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | IMDb-ChromeAndAndroid 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/IMDb-Android-and-Chrome/IMDb-AndroidAndChrome/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.7 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 12 | org.eclipse.jdt.core.compiler.source=1.7 13 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/IMDb-Android-and-Chrome/IMDb-AndroidAndChrome/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/IMDb-Android-and-Chrome/IMDb-AndroidAndChrome/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | Ebay-CrossPlatform 4 | Ebay-CrossPlatform 5 | 0.0.1-SNAPSHOT 6 | 7 | 8 | 9 | org.testng 10 | testng 11 | 6.9.9 12 | 13 | 14 | junit 15 | junit 16 | 3.8.1 17 | test 18 | 19 | 20 | org.seleniumhq.selenium 21 | selenium-api 22 | 2.48.0 23 | 24 | 25 | io.appium 26 | java-client 27 | 3.1.0 28 | 29 | 30 | com.github.genium-framework 31 | Appium-Support 32 | 1.0.4 33 | 34 | 35 | org.apache.poi 36 | poi 37 | 3.13 38 | 39 | 40 | org.apache.poi 41 | poi-ooxml 42 | 3.13 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/IMDb-Android-and-Chrome/IMDb-AndroidAndChrome/src/test/java/AppLocators.java: -------------------------------------------------------------------------------- 1 | 2 | public class AppLocators{ 3 | /** 4 | * Application locators. 5 | */ 6 | 7 | //Pre test pop-up allow. 8 | final static String AllowLocation = "//*[@text = 'Allow']"; 9 | 10 | //Login app locators. 11 | final static String moreOptionsButton = "//*[@content-desc='More options']"; 12 | final static String SignInMenuButton = "//*[@text='Sign In']"; 13 | final static String SignInIMDbAccount = "//*[@text = 'IMDb']"; 14 | final static String AppEmail = "//*[@resource-id='ap_email']"; 15 | final static String AppPassword = "//*[@resource-id='ap_password']"; 16 | final static String SignInButton = "//*[@resource-id='signInSubmit-input']"; 17 | 18 | //Search and result locators 19 | final static String Search = "//*[@resource-id='com.imdb.mobile:id/search']"; 20 | final static String SearchBox = "//*[@resource-id='com.imdb.mobile:id/search_src_text']"; 21 | final static String firstSearchResult = "//*[@resource-id='com.imdb.mobile:id/main_scroller']/android.widget.LinearLayout[1]"; 22 | 23 | //Movie page locators 24 | final static String RateThisButton = "//*[@text = 'Rate this']"; 25 | final static String StartsButton = "//*[@resource-id='com.imdb.mobile:id/stars']"; 26 | final static String SaveRating = "//*[@resource-id='com.imdb.mobile:id/save_button']"; 27 | 28 | /** 29 | * Web locators. 30 | */ 31 | //Login web. 32 | final static String webLogIn = "//*[@id = 'nblogin']"; 33 | final static String WebIMDbLogIn = "//*[@class = 'auth-sprite imdb-logo retina']"; 34 | final static String webEmail = "//*[@id = 'ap_email']"; 35 | final static String webPass = "//*[@id = 'ap_password']"; 36 | final static String webSubmitButton = "//*[@id = 'signInSubmit']"; 37 | 38 | //Search and results on web. 39 | final static String SearchBarweb = "//*[@name= 'q']"; 40 | final static String SearchButtonWeb = "//*[@class = 'magnifyingglass navbarSprite']"; 41 | final static String FirstWebResult = "//*[@class = 'findResult odd' ]/td[2]/a[1]"; 42 | final static String webYourRating = "//*[@class ='star-rating-star rating']"; 43 | final static String webDeleteRating = "//*[@class = 'star-rating-delete']"; 44 | } -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/IMDb-Android-and-Chrome/IMDb-AndroidAndChrome/src/test/java/IMDbTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Cross-Platforms tests/Java/IMDb-Android-and-Chrome/IMDb-AndroidAndChrome/src/test/java/IMDbTest.java -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/IMDb-Android-and-Chrome/IMDb-AndroidAndChrome/src/test/java/desktopTest.java: -------------------------------------------------------------------------------- 1 | import java.net.MalformedURLException; 2 | import java.util.concurrent.TimeUnit; 3 | 4 | import org.openqa.selenium.By; 5 | import org.openqa.selenium.chrome.ChromeDriver; 6 | import org.openqa.selenium.remote.RemoteWebDriver; 7 | import org.openqa.selenium.support.ui.ExpectedCondition; 8 | import org.openqa.selenium.support.ui.ExpectedConditions; 9 | import org.openqa.selenium.support.ui.WebDriverWait; 10 | 11 | public class desktopTest{ 12 | 13 | RemoteWebDriver driver; 14 | WebDriverWait wait; 15 | 16 | public desktopTest() throws MalformedURLException{ 17 | try{ 18 | driver = driverCreator.desktopDriver(); 19 | driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS); 20 | driver.manage().window().maximize(); 21 | driver.get("http://www.imdb.com/"); 22 | wait = new WebDriverWait(driver, 25); 23 | }catch(Exception e){ 24 | e.printStackTrace(); 25 | } 26 | } 27 | 28 | public void logIn(){ 29 | try{ 30 | driver.findElement(By.xpath(AppLocators.webLogIn)).click(); 31 | driver.findElement(By.xpath(AppLocators.WebIMDbLogIn)).click(); 32 | driver.findElement(By.xpath(AppLocators.webEmail)).sendKeys(IMDbTest.AppEmail);; 33 | driver.findElement(By.xpath(AppLocators.webPass)).sendKeys(IMDbTest.AppPassword); 34 | driver.findElement(By.xpath(AppLocators.webSubmitButton)).click(); 35 | 36 | }catch(Exception e){ 37 | e.printStackTrace(); 38 | } 39 | } 40 | 41 | public void search(){ 42 | try{ 43 | driver.findElement(By.xpath(AppLocators.SearchBarweb)).sendKeys(IMDbTest.MovieName); 44 | driver.findElement(By.xpath(AppLocators.SearchButtonWeb)).click(); 45 | driver.findElement(By.xpath(AppLocators.FirstWebResult)).click(); 46 | 47 | }catch(Exception e){ 48 | e.printStackTrace(); 49 | } 50 | } 51 | 52 | public void deleteRating(){ 53 | try{ 54 | driver.navigate().refresh(); 55 | wait.until(ExpectedConditions.elementToBeClickable(By.xpath(AppLocators.webYourRating))).click(); 56 | wait.until(ExpectedConditions.elementToBeClickable(By.xpath(AppLocators.webDeleteRating))).click(); 57 | }catch(Exception e){ 58 | e.printStackTrace(); 59 | } 60 | } 61 | 62 | public void finishDesktopSession(){ 63 | driver.close(); 64 | driver.quit(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/IMDb-Android-and-Chrome/IMDb-AndroidAndChrome/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/IMDb-Android-and-Chrome/README.md: -------------------------------------------------------------------------------- 1 | # Android and Chrome cross platform code sample. 2 | 3 | :information_source: This test requires the IMDb application, which can be found [here](https://github.com/PerfectoCode/AppsForSamples/tree/master/IMDb). 4 | 5 | This code sample shows how to create a cross platform test. 6 | The scenario includes: Application installation, login, locating elements , 7 | Working with desktop driver in order to complite the scenario. 8 | 9 | 10 | 11 | **To do**: 12 | - Test application required , download it (Attached to this folder) and add to your cloud's repository. 13 | - Import the project as a Maven Project / Exist Java project into the workspace. 14 | - Specify your Android devices IDs in the testng.xml file . 15 | - Specify your cloud , user and password at driverCreator.java file . 16 | - Complite your IMDb login information at IMDbTest.java. 17 | - Excute using the testng.xml file (Right click and run as testng test). 18 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/NowCompare/README: -------------------------------------------------------------------------------- 1 | The Web app tested by the script behaves the same, and uses the same objects across both desktop and mobile browsers, 2 | with a single difference - the top menu in the desktop browser (on the green band) is "squeezed" into a hamburger menu 3 | in the mobile browser (top-right), thus requiring an additional step to select the +HEALTH menu item. 4 | 5 | TO DO - Set values for: 6 | * your lab 7 | * your username 8 | * your password 9 | * device name 10 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/README.md: -------------------------------------------------------------------------------- 1 | #Cross-Platforms Tests in java. 2 | 3 | Maven projects , testNG test framework and more code samples in java. 4 | 5 | Also: 6 | See example [here](https://github.com/PerfectoCode/Samples/tree/master/Visual-Analysis/maps-web) for another cross platform testing sample using Perfecto's Visual Analysis. 7 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Java/Swiss-Airlines/README.md: -------------------------------------------------------------------------------- 1 | # SWISS Airlines cross platform sample. 2 | 3 | This test accesses SWISS Airlines' database, both via a Web app on a desktop and a hybrid app via a mobile. 4 | 5 | It begins the process of ordering Economy flight tickets from Zurich to London on June 20th, and back on June 30th. 6 | 7 | Two drivers are created in a single test - RemoteWebDriver and AndroidDriver, the later using both NATIVE_APP and WEBVIEW contexts. 8 | 9 | **To do before running this test**: 10 | - Define your lab, username, and password. 11 | - Define phone number of mobile to use for this test. In this mobile install an instrumented version of SWISS Airlines app. 12 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Python/Amazon - CrossPlatform Python/src/AppObjects.py: -------------------------------------------------------------------------------- 1 | 2 | class Locators(object): 3 | 4 | #Login locators 5 | Sign_in = "//*[@label = 'Sign in' or @resource-id = 'gw-mobile-greeting-bar']" 6 | hello_sign_in = "//*[@label= 'Hello. Sign In']" 7 | userName = "//*[@value = 'E-mail (phone for mobile accounts)' or @resource-id='ap_email']" 8 | password = "//*[@value = 'Amazon password' or @resource-id='ap_password']" 9 | login_btn_ios = "//*[@name = 'Sign in'][2]" 10 | login_button_Android = "//*[@resource-id = 'signInSubmit']" 11 | 12 | #LogOut locators 13 | AppMenu = "//*[@name = 'Show Navigation Menu' or @resource-id='com.amazon.mShop.android:id/action_bar_burger_icon']" 14 | Sign_out_popup_ios = "//*[@name = 'Sign Out'][2]" 15 | 16 | #Search session locators 17 | search_box = "//*[@value = 'What are you looking for?' or @text = 'Amazon.co.uk']" 18 | search_result = "//*[@name = 'in CDs & Vinyl' or @text='in CDs & Vinyl']" 19 | darkSideAlbum = "//*[@name = 'The Dark Side Of The Moon' or @text='The Dark Side Of The Moon']" 20 | AddtoBasket = "//*[@name = 'Add to Basket']" 21 | 22 | #Website locators Sign in 23 | desktop_login_id = 'nav-link-yourAccount' 24 | desktop_username_id = "ap_email" 25 | desktop_password_id = "ap_password" 26 | desktop_loginBTN_id = "signInSubmit" 27 | 28 | #Web locators cart 29 | desktop_cart_id = "nav-cart-count" 30 | desktop_checkout_xpath = "//*[@type = 'submit' and @name = 'proceedToCheckout']" 31 | 32 | #desktop checkout information 33 | desktop_full_name_id = "enterAddressFullName" 34 | desktop_address_line1_id = "enterAddressAddressLine1" 35 | dekstop_city_id = "enterAddressCity" 36 | desktop_country1_id = "enterAddressStateOrRegion" 37 | desktop_post_code_id = "enterAddressPostalCode" 38 | desktop_phone_id = "enterAddressPhoneNumber" 39 | desktop_address_type_id = "AddressType" 40 | desktop_CountrySelect_id = "enterAddressCountryCode" 41 | desktop_Continue_xpath = "//*[@name = 'shipToThisAddress']" 42 | 43 | desktop_deleteItem_xpath = "//*[@type = 'submit' and @value = 'Delete']" 44 | 45 | -------------------------------------------------------------------------------- /Cross-Platforms tests/Python/Amazon - CrossPlatform Python/src/TestParameters.py: -------------------------------------------------------------------------------- 1 | """ 2 | Here goes the test parameters . 3 | TODO: Replace hardcoded with sys.args 4 | """ 5 | 6 | #Host information: 7 | host = 'My_Host.perfectomobile.com' 8 | token = 'My_Token' 9 | 10 | #Application information: 11 | AppUser = 'My_AppUser' 12 | AppPass = 'My_AppPass' 13 | YourName = 'My_Name' 14 | searchValue = 'Pink Floyd' 15 | 16 | #devices information: 17 | iPhone_6 = { 18 | 'token': token, 19 | 'deviceName': 'My Device Name' 20 | } 21 | 22 | desktop_chome = { 23 | 'token': token, 24 | 'platformName': 'Windows', 25 | 'platformVersion': '7', 26 | 'browserName': 'Chrome', 27 | 'browserVersion': '49' 28 | } -------------------------------------------------------------------------------- /Cross-Platforms tests/Python/README.md: -------------------------------------------------------------------------------- 1 | #Amazon Cross-Platform test Python 2 | 3 | **To do**: 4 | - Download the .py files. 5 | - Replace My_User with your could user at TestParameters.py. 6 | - Replace My_Pass with your cloud password at TestParameters.py. 7 | - Replace other tests parameters at TestParameters.py. -------------------------------------------------------------------------------- /Cross-Platforms tests/README.md: -------------------------------------------------------------------------------- 1 | #Cross-Platform tests 2 | 3 | In this section you can find tests which include Multiple Platforms (mobile & desktop) sessions. 4 | The tests include two or more devices in the same scenario and intagrated with different languages test frameworks. 5 | 6 | **Prerequisite:** 7 | - [Selenium](www.seleniumhq.org/download/) and [Appium](http://appium.io/downloads.html) installed in your favorite programming language. 8 | - Using Perfecto plugins for Eclipse / Intellij / Visual Studio is recommended !!! and can download from [here](https://www.perfectomobile.com/download-integrations). 9 | 10 | Follow our [community](community.perfectomobile.com) to find more code samples and ask questions. 11 | -------------------------------------------------------------------------------- /Methods/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Methods/.DS_Store -------------------------------------------------------------------------------- /Methods/Drag and drop/README.md: -------------------------------------------------------------------------------- 1 | # Drag and drop sample 2 | This code sample shows how to implement a drag and drop action on desktop. 3 | 4 | **To do**: 5 | - Import the project as a Maven Project 6 | - Specify your target Web machines IDs or Capabilities in the testng.xml file 7 | - Specify your cloud , user and password at src/test/java/DragAndDropSample.java 8 | - Execute the test by right clicking the testng.xml file and selecting Run As/TestNG Suite. 9 | -------------------------------------------------------------------------------- /Methods/Drag and drop/TestNG.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Methods/Drag and drop/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | DragAndDropSample 4 | DragAndDropSample 5 | 0.0.1-SNAPSHOT 6 | 7 | 8 | org.testng 9 | testng 10 | 6.9.9 11 | 12 | 13 | junit 14 | junit 15 | 3.8.1 16 | test 17 | 18 | 19 | org.seleniumhq.selenium 20 | selenium-api 21 | 2.48.0 22 | 23 | 24 | io.appium 25 | java-client 26 | 3.1.0 27 | 28 | 29 | com.github.genium-framework 30 | Appium-Support 31 | 1.0.4 32 | 33 | 34 | org.apache.poi 35 | poi 36 | 3.13 37 | 38 | 39 | org.apache.poi 40 | poi-ooxml 41 | 3.13 42 | 43 | 44 | -------------------------------------------------------------------------------- /Methods/Drag and drop/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: daniela 3 | Build-Jdk: 1.8.0_77 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /Methods/Drag and drop/target/classes/META-INF/maven/DragAndDropSample/DragAndDropSample/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sun May 08 10:10:45 IDT 2016 3 | version=0.0.1-SNAPSHOT 4 | groupId=DragAndDropSample 5 | m2e.projectName=DragAndDropSample-Mobile 6 | m2e.projectLocation=C\:\\Users\\daniela\\workspace\\DragAndDropSample-Mobile 7 | artifactId=DragAndDropSample 8 | -------------------------------------------------------------------------------- /Methods/Drag and drop/target/classes/META-INF/maven/DragAndDropSample/DragAndDropSample/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | DragAndDropSample 4 | DragAndDropSample 5 | 0.0.1-SNAPSHOT 6 | 7 | 8 | org.testng 9 | testng 10 | 6.9.9 11 | 12 | 13 | junit 14 | junit 15 | 3.8.1 16 | test 17 | 18 | 19 | org.seleniumhq.selenium 20 | selenium-api 21 | 2.48.0 22 | 23 | 24 | io.appium 25 | java-client 26 | 3.1.0 27 | 28 | 29 | com.github.genium-framework 30 | Appium-Support 31 | 1.0.4 32 | 33 | 34 | org.apache.poi 35 | poi 36 | 3.13 37 | 38 | 39 | org.apache.poi 40 | poi-ooxml 41 | 3.13 42 | 43 | 44 | -------------------------------------------------------------------------------- /Methods/Drag and drop/target/test-classes/DragAndDropSample.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Methods/Drag and drop/target/test-classes/DragAndDropSample.class -------------------------------------------------------------------------------- /Methods/ExecuteScript/Execute_script.rb: -------------------------------------------------------------------------------- 1 | require 'selenium-webdriver' 2 | require 'uri' 3 | 4 | host = 'MY_HOST.perfectomobile.com' 5 | token = 'MY_TOKEN' 6 | # user = 'MY_USER' 7 | # pass = 'MY_PASS' 8 | 9 | url = 'http://" + host + "/nexperience/perfectomobile/wd/hub' 10 | 11 | capabilities = { 12 | #:user => user, 13 | #:password => pass, 14 | :securityToken => token, 15 | :platformName => 'Windows', 16 | :platformVersion => '8.1', 17 | :browserName => 'Chrome', 18 | :browserVersion => '50', 19 | } 20 | 21 | driver = Selenium::WebDriver.for(:remote, :url => url, :desired_capabilities => capabilities) 22 | driver.manage.timeouts.implicit_wait = 25 23 | 24 | #Begin test 25 | begin 26 | puts 'Run started' 27 | 28 | #Navigation 29 | driver.execute_script('window.location.href = "https://www.amazon.com/";') 30 | 31 | #Fill form using execute script method - Vanilla JS 32 | driver.execute_script('document.getElementById("nav-link-yourAccount").click();') 33 | driver.execute_script('document.getElementById("createAccountSubmit").click();') 34 | driver.execute_script('document.getElementById("ap_customer_name").value = "Testing name";') 35 | driver.execute_script('document.getElementById("ap_email").value = "Testing_mail@mailservice.com";') 36 | driver.execute_script('document.getElementById("ap_password").value = "passTest123";') 37 | driver.execute_script('document.getElementById("ap_password_check").value = "passTest123";') 38 | driver.execute_script('document.getElementById("continue").click()') 39 | 40 | rescue Exception => e 41 | puts e 42 | ensure 43 | puts 'Run ended' 44 | driver.close 45 | driver.quit 46 | end 47 | 48 | -------------------------------------------------------------------------------- /Methods/ExecuteScript/README.md: -------------------------------------------------------------------------------- 1 | ##Executing JavaScript From RemoteWebDriver 2 | 3 | This code samples shows how to use Selenium WebDriver in order to execute JavaScript code in your test. 4 | 5 | **TODO:** 6 | - Choose a code sample in prefered language **Java** / **C#** / **Python** / **Ruby** . 7 | - Set your Perfecto lab User, Password and Host. 8 | - Set the device capabilities by your choice. 9 | -------------------------------------------------------------------------------- /Methods/README.md: -------------------------------------------------------------------------------- 1 | ## Methods code samples 2 | 3 | This sub-project contains different methods implementations using Selenium and Appium drivers in different languages. 4 | 5 | Find more samples and ask questions at our [community](https://community.perfectomobile.com/). 6 | -------------------------------------------------------------------------------- /Methods/ScriptOnce/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Methods/ScriptOnce/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | healthApp 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /Methods/ScriptOnce/README.md: -------------------------------------------------------------------------------- 1 | :information_source: This test requires the Noom Weight application, which can be found [here](https://github.com/PerfectoCode/AppsForSamples/tree/master/Noom%20Weight). 2 | -------------------------------------------------------------------------------- /Methods/ScriptOnce/src/Pages/CreateAccountPage.java: -------------------------------------------------------------------------------- 1 | package Pages; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import io.appium.java_client.AppiumDriver; 6 | import io.appium.java_client.MobileElement; 7 | 8 | public class CreateAccountPage extends noomPage { 9 | 10 | private By emailLogin = By.xpath("//*[starts-with(@text, 'Sign up with Email, Facebook') or @label='Sign up with Email or Facebook']"); 11 | public CreateAccountPage(AppiumDriver d, String os){ 12 | super(d, os); 13 | // verify that we are starting the application 14 | // look for Get started button 15 | try { 16 | driver.findElement(emailLogin); 17 | } catch (Exception e) { 18 | System.out.println("Failed to display "); 19 | } 20 | } 21 | 22 | public noomPage startAcct() { 23 | driver.findElement(emailLogin).click(); 24 | 25 | switch (opS) { 26 | case Android: 27 | default: 28 | return new UserDetailsPage(driver, "Android"); 29 | case iOS: 30 | return new WeightGoalPage(driver, "iOS"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Methods/ScriptOnce/src/Pages/EmailEntry.java: -------------------------------------------------------------------------------- 1 | package Pages; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import io.appium.java_client.AppiumDriver; 6 | import io.appium.java_client.MobileElement; 7 | 8 | public class EmailEntry extends noomPage { 9 | private By header = By.xpath("//*[@text='My Noom account' or @label='My Noom account']"); 10 | private By emailAdr = By.xpath("//*[@resource-id='com.wsl.noom:id/sign_up_email_button' or @name='log_in_with_email']"); 11 | private By faceBook = By.xpath("//*[@resource-id='com.wsl.noom:id/sign_up_facebook_button' or @name='log_in_with_facebook']"); 12 | // Google+ only available from Android!! 13 | private By googleP = By.xpath("//*[@resource-id='com.wsl.noom:id/google_plus_log_in_button']"); 14 | 15 | public EmailEntry(AppiumDriver d, String os) { 16 | super(d, os); 17 | 18 | try { 19 | d.findElement(header); 20 | } catch (Exception e) { 21 | throw e; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Methods/ScriptOnce/src/Pages/OpenPage.java: -------------------------------------------------------------------------------- 1 | package Pages; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import io.appium.java_client.AppiumDriver; 6 | import io.appium.java_client.MobileElement; 7 | 8 | public class OpenPage extends noomPage { 9 | 10 | private By getStart = By.xpath("//*[@label='Get started' or @text='Get started']"); 11 | private By welcomeImage = By.xpath("/*[@name='coach_welcome_image']"); 12 | public OpenPage(AppiumDriver d, String os){ 13 | super(d, os); 14 | // verify that we are starting the application 15 | // look for Get started button 16 | try { 17 | driver.findElement(getStart); 18 | } catch (Exception e) { 19 | System.out.println("Failed to start the application from beginning"); 20 | } 21 | } 22 | 23 | public CreateAccountPage getStarted() { 24 | driver.findElement(getStart).click(); 25 | 26 | return new CreateAccountPage(driver, opS.toString()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Methods/ScriptOnce/src/Pages/WeightGoalPage.java: -------------------------------------------------------------------------------- 1 | package Pages; 2 | 3 | import org.openqa.selenium.By; 4 | import org.openqa.selenium.NoSuchElementException; 5 | 6 | import io.appium.java_client.AppiumDriver; 7 | import io.appium.java_client.MobileElement; 8 | 9 | public class WeightGoalPage extends noomPage { 10 | private By kg = By.xpath("//*[@name='kilograms']"); 11 | private By lb = By.xpath("//*[@name='pounds']"); 12 | private By five = By.xpath("//UIAStaticText[@name='5']"); 13 | private By ten = By.xpath("//UIAStaticText[@name='10']"); 14 | private By fifteen = By.xpath("//UIAStaticText[@name='15']"); 15 | private By twenty = By.xpath("//UIAStaticText[@name='20']"); 16 | private By goalBtn = By.xpath("//*[@name='weight_button']"); 17 | 18 | public WeightGoalPage(AppiumDriver d, String os) { 19 | super(d, os); 20 | 21 | switch (opS) { 22 | case Android: 23 | throw new NoSuchElementException("Android does not present the weight goal page!"); 24 | case iOS: 25 | driver.findElement(goalBtn); 26 | } 27 | } 28 | 29 | public void selectGoal(int goal) { 30 | if (goal < 7) { 31 | driver.findElement(five).click(); 32 | } else if (goal < 12) { 33 | driver.findElement(ten).click(); 34 | } else if (goal < 17) { 35 | driver.findElement(fifteen).click(); 36 | } else { 37 | driver.findElement(twenty).click(); 38 | } 39 | } 40 | 41 | public void pickUnits(String unit) { 42 | if (unit.equalsIgnoreCase("kg")) { 43 | driver.findElement(kg).click(); 44 | } else { 45 | driver.findElement(lb).click(); 46 | } 47 | } 48 | 49 | public UserDetailsPage setGoal() { 50 | driver.findElement(goalBtn).click(); 51 | 52 | return new UserDetailsPage(driver, opS.toString()); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Methods/ScriptOnce/src/Pages/noomPage.java: -------------------------------------------------------------------------------- 1 | package Pages; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import org.openqa.selenium.By; 7 | import org.openqa.selenium.WebElement; 8 | 9 | import io.appium.java_client.AppiumDriver; 10 | import io.appium.java_client.MobileElement; 11 | 12 | enum OpSystem { 13 | Android, iOS 14 | } 15 | 16 | public abstract class noomPage { 17 | 18 | protected AppiumDriver driver; 19 | protected OpSystem opS; 20 | 21 | public noomPage(AppiumDriver d, String os) { 22 | this.driver = d; 23 | if (os.equalsIgnoreCase("android")) opS = OpSystem.Android; 24 | if (os.equalsIgnoreCase("ios")) opS = OpSystem.iOS; 25 | } 26 | 27 | protected void selectSlider(Integer dispVal, Integer target, Integer ofs, WebElement tbl, String chXpath, Integer range, Integer interval) { 28 | Integer diff = target - dispVal; 29 | String htTab; 30 | Integer extreme = 0; 31 | while (diff > range || diff < (range * -1)) { 32 | if (diff > range) { 33 | // need to move the slide rule by pressing on the extreme right 34 | dispVal += range; 35 | extreme = ((dispVal / interval) - 1) * interval; 36 | } else if (diff < (range * -1)) { 37 | // or move by pressing on extreme left 38 | dispVal -= range; 39 | extreme = ((dispVal / interval) + 1) * interval; 40 | } 41 | // move the slide ruler in direction of the target 42 | htTab = String.format(chXpath, extreme.toString()); 43 | tbl.findElement(By.xpath(htTab)).click(); 44 | 45 | diff = target - dispVal; 46 | } 47 | 48 | // click on the age ruler 49 | String hsTop = tbl.getAttribute("y"); 50 | String hsHt = tbl.getAttribute("height"); 51 | Map params2 = new HashMap<>(); 52 | params2.put("content", target.toString()); 53 | params2.put("screen.top", hsTop); 54 | params2.put("screen.height", hsHt); 55 | params2.put("shift", "left"); 56 | params2.put("offset", ofs.toString()); 57 | driver.executeScript("mobile:text:select", params2); 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Methods/ScriptOnce/src/Test/PopUps.java: -------------------------------------------------------------------------------- 1 | package Test; 2 | 3 | import org.openqa.selenium.By; 4 | import org.openqa.selenium.NoSuchElementException; 5 | import org.openqa.selenium.WebElement; 6 | 7 | import io.appium.java_client.AppiumDriver; 8 | import io.appium.java_client.MobileElement; 9 | 10 | public class PopUps { 11 | 12 | public static void checkLogin(AppiumDriver driver) { 13 | WebElement alert; 14 | try { 15 | alert = driver.findElementByXPath("//UIAAlert[contains(@name, 'Sign In')]"); 16 | alert.findElement(By.className("UIATextField")).sendKeys("perfectoyw@gmail.com"); 17 | alert.findElement(By.className("UIASecureTextField")).sendKeys("Appium#8"); 18 | alert.findElement(By.name("OK")).click(); 19 | } catch (NoSuchElementException n1) { 20 | System.out.println("No username alert, just plow ahead!"); 21 | } 22 | } 23 | 24 | public static void checkNotif(AppiumDriver driver) { 25 | WebElement alert; 26 | try { 27 | alert = driver.findElementByXPath("//UIAAlert[contains(@name, 'Send You Notifications')]"); 28 | alert.findElement(By.xpath("//*[starts-with(@name, 'Don')]")).click(); 29 | } catch (NoSuchElementException n1) { 30 | System.out.println("No notifications popup, just plow ahead!"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Methods/ScriptOnce/src/Test/wlProfile.java: -------------------------------------------------------------------------------- 1 | package Test; 2 | 3 | public class wlProfile { 4 | private String fname; 5 | private String gender; 6 | private Integer age; 7 | private Integer ht; 8 | private Integer wt; 9 | private Integer lossG; 10 | 11 | public wlProfile(String name, String sex, Integer age, Integer h, Integer w, Integer lose) { 12 | fname = name; 13 | gender = sex; 14 | ht = h; 15 | wt = w; 16 | lossG = lose; 17 | this.age = age; 18 | } 19 | 20 | public String getFname() { 21 | return fname; 22 | } 23 | 24 | public String getGender() { 25 | return gender; 26 | } 27 | 28 | public Integer getHeight() { 29 | return ht; 30 | } 31 | 32 | public Integer getWeight() { 33 | return wt; 34 | } 35 | 36 | public Integer getGoal() { 37 | return lossG; 38 | } 39 | 40 | public Integer getAge() { 41 | return age; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Methods/ScriptOnce/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |  2 | 3 | # Product Samples 4 | This repository contains official product and code samples for consuming Perfecto services from different supported languages and frameworks. 5 | 6 | The following examples are included: 7 | 8 | | Sample | Description | Perfecto Documentation | 9 | |----------------|------------------|---------------------| 10 | |Appium |Appium Driver code samples for native applications |[Appium at Perfecto Documentation](http://developers.perfectomobile.com/display/PD/Appium) | 11 | |Cross-Platform |How to test Native applications and Web using Selenium and Appium drivers |[Cross-Platform at Perfecto Documentation](http://developers.perfectomobile.com/display/PD/Cross+Platform+Testing) | 12 | |Methods |Commonly used methods of Selenium and Appium drivers|[Sample method Drag and Drop at our community ](https://community.perfectomobile.com/posts/1160587-drag-and-drop-on-a-desktop-browser) | 13 | |Reporting | Perfecto Reporting - a multiple execution digital report |[Perfecto Reporting](http://developers.perfectomobile.com/display/PD/Reporting) | 14 | |Selenium | Selenium WebDriver code samples for Desktop and Mobile |[Selenium series](http://developers.perfectomobile.com/display/PD/Selenium) | 15 | |Visual-Analysis | Perfecto Visual Analysis - a unique Perfecto functionality for Desktop and Mobile |[Visual Analysis for Desktop at Perfecto Documentation](http://developers.perfectomobile.com/display/PD/Visual+Analysis+for+desktop+Web+testing) | 16 | |Wind Tunnel | Perfecto Wind Tunnel - brings real end-users to the CQ Lab by simulating real end-user scenarios. |[Perfecto Documentation series about Wind Tunnel](http://developers.perfectomobile.com/display/PD/Wind+Tunnel) | 17 | |Windows10 | Perfecto support Microsoft WinAppDriver | [Testing Windows 10 with Perfecto](http://developers.perfectomobile.com/display/PD/Windows+10) 18 | 19 | 20 | 21 | Go to the [PerfectoCode Documentation Portal](http://developers.perfectomobile.com/display/PD/Documentation) for a complete overview of available functionalities. 22 | 23 | Visit the [Perfecto Community](https://community.perfectomobile.com/) for an interactive place where you can ask questions, get training materials and more. 24 | -------------------------------------------------------------------------------- /Reporting/.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | # Maven target folders 15 | target/ 16 | 17 | # IntelliJ folders and files 18 | .idea/ 19 | *.iml 20 | 21 | # Eclipse folders and files 22 | *.classpath 23 | *.prefs 24 | *.project 25 | 26 | #Node modules 27 | node_modules/ -------------------------------------------------------------------------------- /Reporting/README.md: -------------------------------------------------------------------------------- 1 | ## DigitalZoom Reporting Samples 2 | 3 | This repository moved to: [https://github.com/PerfectoCode/Reporting-Samples](https://github.com/PerfectoCode/Reporting-Samples) 4 | -------------------------------------------------------------------------------- /Selenium/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Selenium/.DS_Store -------------------------------------------------------------------------------- /Selenium/C#/GeicoCarInsuranceCSharp/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | GeicoCarInsuranceCSharp 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Selenium/C#/GeicoCarInsuranceCSharp/GeicoCarInsuranceCSharp.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeicoCarInsuranceCSharp", "GeicoCarInsuranceCSharp\GeicoCarInsuranceCSharp.csproj", "{FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Selenium/C#/GeicoCarInsuranceCSharp/GeicoCarInsuranceCSharp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("PerfectoLabTemplateProject")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("PerfectoLabTemplateProject")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("fd81d7a4-bdb5-4183-83bd-1b233ef57fdd")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Selenium/C#/GeicoCarInsuranceCSharp/GeicoCarInsuranceCSharp/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Selenium/C#/README.md: -------------------------------------------------------------------------------- 1 | ## Selenium webdriver samples using C# 2 | 3 | These code samples show how to use Selenium webdriver using C# and Nunit testing framework. 4 | Perfecto has a rich support for Selenium API in C# and Visual Studio IDE. 5 | 6 | **Downloads:** 7 | - Official selenium [download](http://www.seleniumhq.org/download/) - Choose C# . 8 | - Download Perfecto plugin for Visual Studio and .Net develpoing environment [here](https://www.perfectomobile.com/download-integrations). 9 | 10 | ### Starting steps: 11 | It's recommended to use Perfecto Project for Selenium test! 12 | 13 | Using Selenium in your C# test: 14 | ```C# 15 | using OpenQA.Selenium; 16 | using OpenQA.Selenium.Firefox; //For local use . 17 | using OpenQA.Selenium.Support.UI; 18 | ``` 19 | 20 | Creating RemoteWebDriver: 21 | ```C# 22 | //Add your Perfecto cloud URL 23 | public static String PERFECTO_HOST = "MY_HOST.perfectomobile.com"; 24 | 25 | //Set your DesiredCapabilities 26 | DesiredCapabilities capabilities = new DesiredCapabilities(); 27 | capabilities.SetCapability("user", USER_NAME); 28 | capabilities.SetCapability("password", PASSWORD); 29 | 30 | //Create a webdriver 31 | var url = new Uri(string.Format("http://{0}/nexperience/perfectomobile/wd/hub", PERFECTO_HOST)); 32 | driver = new RemoteWebDriver(url, capabilities); 33 | ``` 34 | -------------------------------------------------------------------------------- /Selenium/C#/geicoWeb/GeicoCsharp.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeicoCsharp", "GeicoCsharp\GeicoCsharp.csproj", "{FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Selenium/C#/geicoWeb/GeicoCsharp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("PerfectoLabTemplateProject")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("PerfectoLabTemplateProject")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("fd81d7a4-bdb5-4183-83bd-1b233ef57fdd")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Selenium/C#/geicoWeb/GeicoCsharp/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GeicoCsharp.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Selenium/C#/geicoWeb/GeicoCsharp/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Selenium/C#/geicoWeb/GeicoCsharp/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Selenium/C#/geicoWeb/README.md: -------------------------------------------------------------------------------- 1 | #Selenium c# Automation 2 | 3 | **To do**: 4 | - Downlaod and import the projecto to visual studio. 5 | - Replace My_Host at RemoteWebDriverTest.cs with your cloud's host name. 6 | - Replace My_User at RemoteWebDriverTest.cs with your cloud user. 7 | - Replace My_Pass at RemoteWebDriverTest.cs with your cloud password. 8 | -------------------------------------------------------------------------------- /Selenium/C#/searchAndFillForm/README.md: -------------------------------------------------------------------------------- 1 | # C# Sample 2 | 3 | **TO DO:** 4 | - Create a C# project on visual studio (Test project or use [Perfecto plugin](https://www.perfectomobile.com/download-integrations) to create a Perfecto's project). 5 | - Copy this test to the main test unit. 6 | - Change Hostname , user and password. 7 | - Run this as a test (Right click and Run Tests or Ctrl+R) . 8 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | CommunityDynamicXpath 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/codebeautify.csv: -------------------------------------------------------------------------------- 1 | col,row,Number 2 | 0,0,5 3 | 1,0,8 4 | 2,0,30 5 | 3,0,49 6 | 4,0,12 7 | 5,0,9 8 | 0,1,1 9 | 1,1,2 10 | 2,1,3 11 | 3,1,4 12 | 4,1,5 13 | 5,1,6 14 | 0,2,7 15 | 1,2,10 16 | 2,2,11 17 | 3,2,13 18 | 4,2,14 19 | 5,2,15 20 | 0,3,21 21 | 1,3,47 22 | 2,3,33 23 | 3,3,32 24 | 4,3,18 25 | 5,3,41 26 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/codebeautify.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Selenium/Java/CommunityDynamicXpath/codebeautify.xls -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/codebeautify.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Selenium/Java/CommunityDynamicXpath/codebeautify.xlsx -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/src/ReadExcel.java: -------------------------------------------------------------------------------- 1 | import java.io.File; 2 | import java.io.IOException; 3 | 4 | import jxl.Cell; 5 | import jxl.Sheet; 6 | import jxl.Workbook; 7 | import jxl.read.biff.BiffException; 8 | 9 | /** 10 | * 11 | */ 12 | 13 | /** 14 | * @author Lee Shoham 15 | * @date Jul 26, 2016 16 | */ 17 | public class ReadExcel { 18 | 19 | private String inputFile; 20 | 21 | public ReadExcel(String input) { 22 | this.inputFile = input; 23 | } 24 | 25 | public Sheet getSheet(int sheetNum) throws Exception { 26 | File inputWorkbook = new File(inputFile); 27 | Workbook w; 28 | try { 29 | w = Workbook.getWorkbook(inputWorkbook); 30 | // Get the first sheet 31 | Sheet sheet = w.getSheet(sheetNum); 32 | 33 | return sheet; 34 | 35 | } catch (BiffException | IOException e) { 36 | e.printStackTrace(); 37 | throw e; 38 | } 39 | } 40 | // this is a way of reading a .txt file 41 | // BufferedReader reader = new BufferedReader(new 42 | // FileReader("table.txt")); 43 | // String line = reader.readLine(); 44 | // String[] lineStrArr; 45 | // while ((line = reader.readLine()) != null) { 46 | // 47 | // // splitting String line into string array without whitespaces 48 | // lineStrArr = line.split("\\s+"); 49 | // 50 | // String xpath = "(//input[@id='lotto_playslip_line_" + 51 | // lineStrArr[1] + "_pool_0_col_" + lineStrArr[0] 52 | // + "'])[1]"; 53 | // driver.findElement(By.xpath(xpath)).sendKeys(lineStrArr[2]); 54 | // } 55 | // reader.close(); 56 | 57 | // this is a way of reading an .xls file 58 | // ReadExcel readExcel = new ReadExcel("codebeautify.xls"); 59 | // Sheet sheet = readExcel.getSheet(0); 60 | // System.out.println("Num of rows is: " + sheet.getRows()); 61 | // System.out.println("Num of cols is: " + sheet.getColumns()); 62 | 63 | // for (int i = 1; i < sheet.getRows(); i++) { 64 | // String xpath = "(//input[@id='lotto_playslip_line_" + sheet.getCell(1, i).getContents() + "_pool_0_col_" 65 | // + sheet.getCell(0, i).getContents() + "'])[1]"; 66 | // driver.findElement(By.xpath(xpath)).sendKeys(sheet.getCell(2, i).getContents()); 67 | // } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/table.txt: -------------------------------------------------------------------------------- 1 | col row Number 2 | 0 0 5 3 | 1 0 8 4 | 2 0 30 5 | 3 0 49 6 | 4 0 12 7 | 5 0 9 8 | 0 1 1 9 | 1 1 2 10 | 2 1 3 11 | 3 1 4 12 | 4 1 5 13 | 5 1 6 14 | 0 2 7 15 | 1 2 10 16 | 2 2 11 17 | 3 2 13 18 | 4 2 14 19 | 5 2 15 20 | 0 3 21 21 | 1 3 47 22 | 2 3 33 23 | 3 3 32 24 | 4 3 18 25 | 5 3 41 -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/Default suite/Default test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/Default suite/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/bullet_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Selenium/Java/CommunityDynamicXpath/test-output/bullet_point.png -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/collapseall.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Selenium/Java/CommunityDynamicXpath/test-output/collapseall.gif -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Selenium/Java/CommunityDynamicXpath/test-output/failed.png -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/junitreports/TEST-RemoteWebDriverTest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/navigator-bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Selenium/Java/CommunityDynamicXpath/test-output/navigator-bullet.png -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/old/Default suite/Default test.properties: -------------------------------------------------------------------------------- 1 | [SuiteResult context=Default test] -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/old/Default suite/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Class name 4 | Method name 5 | Groups 6 | 7 | RemoteWebDriverTest 8 | 9 | 10 | @Test 11 | 12 | 13 | 14 | test 15 | 16 | 17 | @BeforeClass 18 | 19 | 20 | 21 | beforeClass 22 | 23 | 24 | @BeforeMethod 25 | 26 | 27 | @AfterMethod 28 | 29 | 30 | @AfterClass 31 | 32 | 33 | 34 | afterClass 35 | 36 | 37 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/old/Default suite/groups.html: -------------------------------------------------------------------------------- 1 | Groups used for this test run -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/old/Default suite/index.html: -------------------------------------------------------------------------------- 1 | Results for Default suite 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/old/Default suite/main.html: -------------------------------------------------------------------------------- 1 | Results for Default suite 2 | Select a result on the left-hand pane. 3 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/old/Default suite/methods-not-run.html: -------------------------------------------------------------------------------- 1 | Methods that were not run 2 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/old/Default suite/reporter-output.html: -------------------------------------------------------------------------------- 1 | Reporter output -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/old/Default suite/testng.xml.html: -------------------------------------------------------------------------------- 1 | testng.xml for Default suite<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite guice-stage="DEVELOPMENT" name="Default suite"> <test verbose="2" name="Default test"> <classes> <class name="RemoteWebDriverTest"/> </classes> </test> <!-- Default test --> </suite> <!-- Default suite --> -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/old/Default suite/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Results for Default suite 4 | 5 | 6 | 7 | 8 | Results forDefault suite 9 | 10 | 11 | 1 test 12 | 1 class 13 | 1 method: 14 | chronological 15 | alphabetical 16 | not run (0) 17 | 18 | 19 | 0 group 20 | reporter output 21 | testng.xml 22 | 23 | 24 | 25 | Default test (6/0/0) 26 | Results 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/old/index.html: -------------------------------------------------------------------------------- 1 | 2 | Test results 3 | 4 | 5 | Test results 6 | SuitePassedFailedSkippedtestng.xml 7 | Total600 8 | Default suite 9 | 600Link 10 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/passed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Selenium/Java/CommunityDynamicXpath/test-output/passed.png -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/skipped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Selenium/Java/CommunityDynamicXpath/test-output/skipped.png -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Selenium/Java/CommunityDynamicXpath/test-output/testng.css: -------------------------------------------------------------------------------- 1 | .invocation-failed, .test-failed { background-color: #DD0000; } 2 | .invocation-percent, .test-percent { background-color: #006600; } 3 | .invocation-passed, .test-passed { background-color: #00AA00; } 4 | .invocation-skipped, .test-skipped { background-color: #CCCC00; } 5 | 6 | .main-page { 7 | font-size: x-large; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Selenium/Java/ESPN_Test/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /Selenium/Java/ESPN_Test/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ESPN_Test 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /Selenium/Java/ESPN_Test/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 3 | org.eclipse.jdt.core.compiler.compliance=1.5 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.5 6 | -------------------------------------------------------------------------------- /Selenium/Java/ESPN_Test/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /Selenium/Java/ESPN_Test/README.md: -------------------------------------------------------------------------------- 1 | ## Selenium code sample using ESPN website 2 | 3 | This code sample shows how to create a multiple test execution, running on multiple devices in parallel. 4 | It includes testNG testing framework, Maven and Reportium. 5 | 6 | **TODO:** 7 | - Import the project to Eclipse or IntelliJ as a Maven project. 8 | - Set your Perfecto lab credentials and lab name in the [Test_Main.java file](https://github.com/PerfectoCode/Samples/blob/master/Selenium/ESPN_Test/src/test/java/Test_Main.java). 9 | - Set your device capabilities in the [testng.xml file](https://github.com/PerfectoCode/Samples/blob/master/Selenium/ESPN_Test/testng.xml). 10 | DO NOT CHANGE THE DEVICE LOCATION (The scenario is designed only for the ESPN global website:exclamation:). 11 | - Set your ESPN email and password (Register at www.espn.go.com). 12 | - Execute from [testng.xml file](https://github.com/PerfectoCode/Samples/blob/master/Selenium/ESPN_Test/testng.xml) as TestNG test. 13 | 14 | :information_source: To change the number of times the test will run, update the test anotation parameter `invocationCount` in [Test_Main.java](https://github.com/PerfectoCode/Samples/blob/master/Selenium/ESPN_Test/src/test/java/Test_Main.java). 15 | 16 | ```java 17 | 18 | @Test(invocationCount = 1) 19 | public void testGroup(){ 20 | test(); 21 | test2(); 22 | } 23 | ``` 24 | -------------------------------------------------------------------------------- /Selenium/Java/ESPN_Test/src/test/java/PageObjects.java: -------------------------------------------------------------------------------- 1 | public class PageObjects { 2 | 3 | //Galaxy S7 - First Test Xpaths 4 | final static String mainPageMenu = "//*[@id = 'global-nav-mobile-trigger']"; 5 | final static String menuNBA = "//*[@class = 'link-text' and text() = 'NBA']"; 6 | final static String NBATeams = "//*[@class = 'link-text' and text() = 'Teams']"; 7 | final static String SelectLakers = "//*[text() = 'Los Angeles Lakers']"; 8 | 9 | //Galaxy S7 - Second Test Xpaths 10 | final static String LoginButton = "//*[text() = 'Log In']"; 11 | final static String Email = "//input[@type='email']"; 12 | final static String password = "//input[@type='password']"; 13 | final static String submit = "//button[@type='submit']"; 14 | final static String userPlace = "//*[@id = 'global-user-trigger']"; 15 | final static String logOut = "/html[1]/body[1]/div[6]/div[3]/ul[1]/li[7]/a[1]"; // <- Ugly path because there's 2 logout elements with the same id and class . 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Selenium/Java/ESPN_Test/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 | -------------------------------------------------------------------------------- /Selenium/Java/GeicoInsurance/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Selenium/Java/GeicoInsurance/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /Selenium/Java/GeicoInsurance/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | GeicoInsurance 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /Selenium/Java/README.md: -------------------------------------------------------------------------------- 1 | ## Selenium WebDriver Code Samples Using Java 2 | 3 | These samples show how to build tests with Selenium using Java. 4 | The samples use testing frameworks such as TestNG and Unit Test and dependencies managers such as Maven and Gradle. 5 | Perfecto supplies wide support for Intellij and Eclipse Java IDEs. 6 | 7 | **Downloads:** 8 | - Selenium Jar files can be found [here](http://www.seleniumhq.org/download/) . 9 | - Perfecto integration with IDE [download](https://www.perfectomobile.com/download-integrations) . 10 | 11 | ### Selenium integration with Maven: 12 | Add the following dependency to the pom.xml file in your's project. 13 | ```xml 14 | 15 | org.seleniumhq.selenium 16 | selenium-java 17 | 2.53.0 18 | 19 | ``` 20 | 21 | ### Selenium integration with gradle: 22 | Add the following dependency to your gradle build file. 23 | ```xml 24 | compile 'org.seleniumhq.selenium:selenium-java:2.53.0' 25 | ``` 26 | -------------------------------------------------------------------------------- /Selenium/Java/Selenium Chrome Performance Logs/README.md: -------------------------------------------------------------------------------- 1 | # ChromiumPerformanceTest 2 | 3 | Perfecto Selenium Java Template with Chrome Performance log: http://chromedriver.chromium.org/logging/performance-log 4 | 5 | Perfecto Lab and device setup 6 | 7 | Ready for writing your tests 8 | 9 | -------------------------------------------------------------------------------- /Selenium/Java/Selenium Chrome Performance Logs/build.gradle: -------------------------------------------------------------------------------- 1 | group 'org.test' 2 | version '1.0-SNAPSHOT' 3 | 4 | apply plugin: 'java' 5 | 6 | sourceCompatibility = 1.8 7 | 8 | repositories { 9 | mavenCentral() 10 | maven { 11 | url 'https://repo1.perfectomobile.com/public/repositories/maven/' 12 | } 13 | } 14 | 15 | dependencies { 16 | compile 'com.perfectomobile:http-client:18.6.0.0' 17 | compile 'com.perfectomobile:pm-webdriver:18.6.0.0' 18 | compile 'com.perfectomobile:intellij-connector:18.6.0.0' 19 | 20 | compile ('com.perfecto.reporting-sdk:reportium-java:1.2.3') { 21 | exclude group: "org.seleniumhq.selenium", module: "selenium-remote-driver" 22 | exclude group: "org.seleniumhq.selenium", module: "selenium-java" 23 | exclude group: "org.seleniumhq.selenium", module: "selenium-api" 24 | } 25 | 26 | compile 'commons-codec:commons-codec:1.10' 27 | compile 'commons-io:commons-io:2.5' 28 | compile 'org.apache.commons:commons-lang3:3.6' 29 | compile 'dom4j:dom4j:1.6.1' 30 | compile 'com.google.code.gson:gson:2.8.2' 31 | compile 'com.google.guava:guava:19.0' 32 | compile 'org.apache.httpcomponents:httpclient:4.5.3' 33 | compile 'org.apache.httpcomponents:httpcore:4.4.4' 34 | compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.0' 35 | compile 'com.fasterxml.jackson.core:jackson-core:2.7.0' 36 | compile 'com.fasterxml.jackson.core:jackson-databind:2.7.0' 37 | compile 'io.appium:java-client:5.0.4' 38 | compile 'jaxen:jaxen:1.1.6' 39 | compile 'org.slf4j:jcl-over-slf4j:1.7.16' 40 | compile 'org.json:json:20151123' 41 | compile 'ch.qos.logback:logback-classic:1.1.8' 42 | compile 'ch.qos.logback:logback-core:1.1.8' 43 | compile 'org.seleniumhq.selenium:selenium-api:3.6.0' 44 | compile 'org.seleniumhq.selenium:selenium-remote-driver:3.6.0' 45 | compile 'org.seleniumhq.selenium:selenium-support:3.6.0' 46 | compile 'org.slf4j:slf4j-api:1.7.16' 47 | } 48 | -------------------------------------------------------------------------------- /Selenium/Java/searchAndFillForm/README.md: -------------------------------------------------------------------------------- 1 | # Java Sample 2 | 3 | **TO DO:** 4 | - Create a new Java project (use [Perfecto plugin](https://www.perfectomobile.com/download-integrations) to create a perfecto project). 5 | - Copy this test to the main test unit or src folder. 6 | - Change Hostname , user and password. 7 | - Run this test as a regular java application. 8 | -------------------------------------------------------------------------------- /Selenium/JavaScript/Protractor-Web/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /Selenium/JavaScript/Protractor-Web/Dzone.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const domain = 'dzone.com'; 4 | var logger = console; 5 | 6 | var DZoneSite = exports.DZoneSite = function(browser){ 7 | 8 | this.browser = browser; 9 | 10 | this.init = ()=>{ 11 | browser.driver.manage().window().maximize(); 12 | browser.get('http://' + domain + '/'); 13 | } 14 | 15 | this.login = ()=>{ 16 | browser.findElement(by.xpath('//*[text()=\'Sign In / Join\']')).click(); 17 | 18 | // Replace dzone credentials with your dzone login credentials 19 | browser.findElement(by.name('username')).sendKeys('MyDzoneUser'); 20 | browser.findElement(by.name('password')).sendKeys('MyDzonePassword'); 21 | 22 | browser.findElement(by.xpath('//*[@value=\'SIGN IN\' or @class=\'btn btn-success ng-click-active\']')).click(); 23 | } 24 | 25 | this.getZonesPortal = ()=> { 26 | browser.findElement(by.xpath('//*[@href=\'/portals\' or @id=\'header-portals\']')).click(); 27 | browser.findElement(by.xpath('//*[text()=\'Agile\']')).click(); 28 | } 29 | 30 | this.getPortal = (portal) =>{ 31 | browser.findElement(by.xpath('//*[text()=\'' + portal + '\']')).click(); 32 | } 33 | 34 | this.getPortalDate = ()=>{ 35 | let date = browser.findElement(by.xpath('//*[@class =\'date ng-binding\']')).getText(); 36 | return date; 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /Selenium/JavaScript/Protractor-Web/README.md: -------------------------------------------------------------------------------- 1 | # Protractor + Jasmine Angular Web Sample 2 | The project demonstrates using [Protractor](http://www.protractortest.org/#/) and [Jasmine](http://jasmine.github.io/) in Perfecto Lab. 3 | 4 | :information_source: Click [here](https://community.perfectomobile.com/series/27942) for a guide to get started with Protractor. 5 | 6 | ## Getting started 7 | Install NodeJS dependencies with this command: 8 | 9 | > npm install 10 | 11 | :information_source: The test requires a user for Dzone portal. 12 | Create one and update the credentials n [spec.js](Dzone.js) : 13 | ```JavaScript 14 | browser.findElement(by.name('username')).sendKeys('MyDzoneUser'); 15 | browser.findElement(by.name('password')).sendKeys('MyDzonePass'); 16 | ``` 17 | 18 | ## Running the test 19 | - Update your Perfecto credentials in [conf.js](conf.js). 20 | - Update the date assertion in [spec.js](spec.js) to the curret day (Keep the same date's format). 21 | 22 | You can run [spec.js](spec.js) with this command: 23 | 24 | > npm test 25 | 26 | ## Reporting 27 | A [custom Jasmine reporter](http://jasmine.github.io/2.4/custom_reporter.html) in configured in conf.js. 28 | 29 | This reporter automatically reports the start and end of test executions, 30 | to provide seamless integration and remove boilerplate code from your test scripts. 31 | 32 | Test scripts can then be enriched with reporting of functional test steps by using 33 | > browser.reportingClient.testStep('Step description comes here'); 34 | 35 | -------------------------------------------------------------------------------- /Selenium/JavaScript/Protractor-Web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "perfecto_sample_protactor_jasmine", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "conf.js", 6 | "dependencies": { 7 | "perfecto-reporting": "^1.0.0", 8 | "protractor": "^4.0.0", 9 | "selenium-webdriver": "^2.53.3" 10 | }, 11 | "devDependencies": {}, 12 | "scripts": { 13 | "test": "node node_modules/protractor/bin/protractor conf.js" 14 | }, 15 | "keywords": [ 16 | "perfecto", 17 | "mobile", 18 | "protactor" 19 | ], 20 | "author": "", 21 | "license": "ISC" 22 | } 23 | -------------------------------------------------------------------------------- /Selenium/JavaScript/Protractor-Web/spec.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var DZoneSite = require('./Dzone.js').DZoneSite; 4 | 5 | //Test1 6 | fdescribe('Protractor Perfecto Demo', function () { 7 | 8 | beforeAll(function() { 9 | // setup a new optimizer site page object 10 | browser.DZoneSite = new DZoneSite(browser); 11 | }); 12 | 13 | it('Test Angular Site optimizer', function () { 14 | browser.reportingClient.testStep('Step 1: navigate DZone site'); 15 | browser.DZoneSite.init(); 16 | 17 | browser.reportingClient.testStep('Step 2: login'); 18 | browser.DZoneSite.login(); 19 | 20 | browser.reportingClient.testStep('Step 3: navigate to portals'); 21 | browser.DZoneSite.getZonesPortal(); 22 | 23 | browser.reportingClient.testStep('Step 4: navigate to agile portal and assert header'); 24 | browser.DZoneSite.getPortal('Agile'); 25 | let title_path = '//*[@class =\'col-md-12 pageHeadline3 pageHeadline oUhb_VWOdbfWVcC ng-scope\']/h1' 26 | let actual_header = browser.findElement(by.xpath(title_path)).getText(); 27 | expect(actual_header).toEqual('Agile methodology news, tutorials & tools'); 28 | 29 | browser.reportingClient.testStep('Step 5: validate the date'); 30 | let actual_date = browser.DZoneSite.getPortalDate(); 31 | expect(actual_date).toEqual('Tuesday, January 24'); // Change this to the expected date value 32 | }); 33 | 34 | }); 35 | -------------------------------------------------------------------------------- /Selenium/JavaScript/Protractor/ReadMe.md: -------------------------------------------------------------------------------- 1 | ##Protractor Sample 2 | 3 | This code sample shows how to use Protractor and Jasmine framework in order to execute JavaScript test. 4 | 5 | **TODO:** 6 | - Download the test files: conf.js and spec.js. 7 | - Make sure you have installed [Protractor](http://www.protractortest.org/#/) and [Jasmine](http://jasmine.github.io/) framework. 8 | - Set your Perfecto lab Host, User and Password in the conf.js file. 9 | - Execute the test via command line with: protractor spec.js. 10 | 11 | Read more about Protractor in our [community](https://community.perfectomobile.com/posts/1209188) 12 | -------------------------------------------------------------------------------- /Selenium/JavaScript/Protractor/conf.js: -------------------------------------------------------------------------------- 1 | // An example configuration file. 2 | 3 | exports.config = { 4 | //Remote address 5 | seleniumAddress: 'https://MY_HOST.perfectomobile.com/nexperience/perfectomobile/wd/hub', 6 | 7 | //Capabilities to be passed to the webdriver instance. 8 | capabilities: { 9 | browserName: 'chrome', 10 | securityToken: 'MY_TOKEN', 11 | //user: 'MY_USER', 12 | //password: 'MY_PASS', 13 | platformName: 'Android', 14 | //deviceName: '123456', 15 | }, 16 | 17 | //Framework to use. Jasmine is recommended. 18 | framework: 'jasmine', 19 | 20 | // Spec patterns are relative to the current working directly when 21 | // protractor is called. 22 | specs: ['spec.js'], 23 | 24 | // Options to be passed to Jasmine. 25 | jasmineNodeOpts: { 26 | showColors: true, // Use colors in the command line report. 27 | defaultTimeoutInterval: 120000 // Time to wait in ms before a test fails. Default value = 30000 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Selenium/JavaScript/Protractor/spec.js: -------------------------------------------------------------------------------- 1 | //Test1 2 | describe('Protractor Perfecto Demo', function() { 3 | it('should have a title', function(done) { 4 | browser.driver.get('https://www.google.com'); //Navigate to google.com 5 | //Locate the search box element and insert text 6 | //Click on search button 7 | browser.driver.findElement(by.name('q')).sendKeys('PerfectoCode GitHub'); 8 | browser.driver.findElement(by.css('#tsbb > div')).click(); 9 | //Click the first search result 10 | browser.driver.findElement(by.css('#rso > div > div:nth-child(1) > div > div > div._OXf > h3 > a')).click(); 11 | //Assert that page title quals to expected title 12 | expect(browser.driver.getTitle()).toEqual('GitHub - PerfectoCode/Samples: Product Samples'); 13 | done(); 14 | }); 15 | }); 16 | 17 | //Test2 18 | describe('Protractor Perfecto Demo Test2' , function () { 19 | it('should submit a form' , function (done) { 20 | browser.driver.get('https://www.perfectomobile.com');//Navigate to Perfecto.com 21 | 22 | browser.driver.findElement(by.css('body > header > div > div > ul > li > a')).click(); 23 | //Wait for page load up 24 | browser.driver.sleep(5000); 25 | 26 | browser.driver.findElement(by.id('FirstName')).sendKeys('First Name'); 27 | browser.driver.findElement(by.id('LastName')).sendKeys('Last Name'); 28 | browser.driver.findElement(by.id('Company')).sendKeys('My Company'); 29 | //Select option testing 30 | browser.driver.findElement(by.id('Mobile_Testing_Role__c')).click(); 31 | browser.driver.findElement(by.css('#Mobile_Testing_Role__c > option:nth-child(3)')).click(); 32 | 33 | browser.driver.findElement(by.id('Email')).sendKeys('MyEmail@perfectomobile.com'); 34 | browser.driver.findElement(by.id('Phone')).sendKeys('+972123456789'); 35 | //Select option israel 36 | browser.driver.findElement(by.id('Country')).click(); 37 | browser.driver.findElement(by.css('#Country > option:nth-child(108)')).click(); 38 | //Submit 39 | browser.driver.findElement(by.css('#mktoForm_1632 > div.mktoButtonRow > span > button')).click(); 40 | done(); 41 | }) 42 | }); -------------------------------------------------------------------------------- /Selenium/JavaScript/README.md: -------------------------------------------------------------------------------- 1 | ## Selenium code samples using JavaScript 2 | 3 | These code sampels show how to build a test using Javascript and test frameworks such as Mocha and Jasmine. 4 | 5 | **Downloads:** 6 | - Download Selenium WebDriver for Java script [here](http://www.seleniumhq.org/download/) . 7 | -------------------------------------------------------------------------------- /Selenium/JavaScript/WebDriverIO/README.md: -------------------------------------------------------------------------------- 1 | ##WebDriverIO Searching in google 2 | 3 | This code sample shows how to use WebDriverIO in order to locate and click elements. 4 | 5 | **TODO** 6 | - Download the script. 7 | - Set your Perfecto lab User,Pass and Host. 8 | - Run using NodeJS on the command line: node filename.js -------------------------------------------------------------------------------- /Selenium/JavaScript/WebDriverIO/webdriverio.js: -------------------------------------------------------------------------------- 1 | //Create webdriver 2 | var webdriverio = require('webdriverio'); 3 | var options = { 4 | //Perfecto lab user and device capabilities 5 | desiredCapabilities: { 6 | platformName: 'ANDROID', 7 | browserName: 'mobileOS', 8 | //deviceName: 'yourDeviceID', 9 | // Old School credentials, we recommend using Security Token instead. 10 | //user: 'MY_USER@perfectomobile.com', 11 | //password:'MY_PASS', 12 | securityToken: 'MY_TOKEN', 13 | }, 14 | host: 'demo.perfectomobile.com', 15 | path: '/nexperience/perfectomobile/wd/hub', 16 | port:80 17 | }; 18 | 19 | //Init driver, gets url and navigate 20 | webdriverio 21 | .remote(options) 22 | .init() 23 | .url('http://www.google.com') 24 | .setValue('#lst-ib' , 'PerfectoCode GitHub') 25 | .click('#tsbb') 26 | .click('#rso > div > div:nth-child(1) > div > div > div._OXf > h3 > a') 27 | .getTitle().then(function(title) { //Title 28 | console.log('Title was: ' + title); 29 | }) 30 | .end(); 31 | -------------------------------------------------------------------------------- /Selenium/Python/GeicoWeb/GeicoTest.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.common.by import By 3 | from selenium.webdriver.support.ui import Select 4 | from sys import argv 5 | 6 | class GeicoTest: 7 | 8 | def __init__(self): 9 | self.capabilities = { 10 | #'user' : argv[1], 11 | #'password' : argv[2], 12 | 'securityToken' : argv[1], 13 | 'browserName' : 'mobileOS' 14 | } 15 | 16 | HOST = argv[2] #use argv[3] if username and password credentials are used. 17 | self.driver = webdriver.Remote('https://' + HOST + '/nexperience/perfectomobile/wd/hub' , self.capabilities) 18 | #self.driver = webdriver.Chrome() 19 | self.driver.implicitly_wait(20) 20 | 21 | def test(self): 22 | #Navigate Geico 23 | self.driver.get('https://Geico.com') 24 | 25 | #Choose insurance type and ZIP 26 | selection = Select(self.driver.find_element(By.ID, 'insurancetype')) 27 | selection.select_by_value('motorcycle') 28 | self.driver.find_element(By.ID, 'zip').send_keys('50840') 29 | self.driver.find_element(By.ID, 'submitButton').click() 30 | 31 | #Fill form 32 | self.driver.find_element(By.XPATH, '//*[@class ="radio"][2]').click() 33 | self.driver.find_element(By.ID, "firstName").send_keys('FirstName') 34 | self.driver.find_element(By.ID, "lastName").send_keys('LastName') 35 | self.driver.find_element(By.ID, "street").send_keys('Street Address') 36 | self.driver.find_element(By.ID, "apt").send_keys('1234') 37 | self.driver.find_element(By.ID, "zip").clear() 38 | self.driver.find_element(By.ID, "zip").send_keys('50840') 39 | self.driver.find_element(By.ID, "date-monthdob").send_keys('01') 40 | self.driver.find_element(By.ID, "date-daydob").send_keys('25') 41 | self.driver.find_element(By.ID, "date-yeardob").send_keys('1999') 42 | selection = Select(self.driver.find_element(By.ID, "hasCycle")) 43 | selection.select_by_value('N') 44 | 45 | #Submit 46 | self.driver.find_element(By.ID , 'btnSubmit').submit() 47 | 48 | self.driver.close() 49 | self.driver.quit() 50 | 51 | if __name__ == '__main__': 52 | GeicoTest().test() -------------------------------------------------------------------------------- /Selenium/Python/GeicoWeb/README.md: -------------------------------------------------------------------------------- 1 | #Selenium Python Automation 2 | 3 | **To do**: 4 | - Downlaod the .py file . 5 | - Run from command line (or using Jenkins arguments) with : Python GeicoTest.py My_User My_Pass My_Host 6 | -------------------------------------------------------------------------------- /Selenium/Python/README.md: -------------------------------------------------------------------------------- 1 | ## Selenium Code Samples Using Python 2 | 3 | These code samples show how to use Python and Unittest testing frameworks in order to write tests. 4 | Python is easy to learn, has a readable syntax, and is recommended for writing your tests. 5 | 6 | **Downloads:** 7 | - Download selenium using pip install or easy_install: 8 | 9 | ```python 10 | pip install selenium 11 | ``` 12 | 13 | ```python 14 | easy_install install selenium 15 | ``` 16 | 17 | - Using Eclipse IDE is recommended, Python plugins can be found at the [marketplace](https://marketplace.eclipse.org). 18 | - Perfecto integration with eclipse plugin can be downloaded from [here](https://www.perfectomobile.com/download-integrations) . 19 | 20 | ###Easy starting: 21 | 22 | Setting up a WebDriver: 23 | ```python 24 | from selenium import webdriver 25 | 26 | #Your Perfecto Lab host name. 27 | host = 'MY_HOST.perfectomobile.com' 28 | 29 | #Set your desired capabilities : 30 | capabilities = { 31 | 'platformName' : 'My_platformName', 32 | 'platformVersion' : 'My_platformVersion', 33 | 'browserName' : 'My_browserName', 34 | 'browserVersion' : 'My_browserVersion', 35 | 'user' : "MY_USER", 36 | 'password' : "MY_PASSWORD" 37 | } 38 | 39 | driver = webdriver.Remote('https://' + host + '/nexperience/perfectomobile/wd/hub' , capabilities) 40 | ``` 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Selenium/Python/Robot-framework/README.md: -------------------------------------------------------------------------------- 1 | ## Robot Framework 2 | 3 | The following sample demonstrate using [Robot](http://robotframework.org/) framework for executing test on Perfecto Lab. 4 | 5 | ### Getting Started: 6 | - Make sure Python 2.7 is installed (use python --version) and configured in Env path. 7 | - Download robotframework & selenium2library: 8 | Use `pip install robotframework` and `pip install robotframework-selenium2library`. 9 | Download Perfecto repot with 'pip install perfecto' 10 | 11 | Follow more information in - https://developers.perfectomobile.com/display/PD/Download+SDK#DownloadSDK-Python 12 | 13 | - Set your credentials within the [perfecto.robot](perfecto.robot) file: 14 | ```robot 15 | *** Variables *** 16 | | @{_tmp} 17 | | ... | platformName:Android, 18 | | ... | browserName:chrome, 19 | | ... | deviceName:, 20 | | ... | user:UserName, 21 | | ... | password:Password 22 | ``` 23 | 24 | - Execute the test using `robot .` or separate files 'robot perfecto_Web_Desktop.robot' and 'robot perfecto_Web_Mobile.robot', which will run test in Mobile and Desktop web browsers 25 | -------------------------------------------------------------------------------- /Selenium/Python/Robot-framework/perfecto_Web_Desktop.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Suite Setup Open Browser ${URL} remote_url=${REMOTE_URL} desired_capabilities=${CAPABILITIES} 3 | Suite Teardown Close all browsers 4 | Library Selenium2Library 5 | Library sample.py 6 | 7 | *** Variables *** 8 | @{_tmp} platformName:Windows, platformVersion:10, browserName:Chrome, browserVersion:71, resolution:1280x1024, location:US East, user:, 9 | ... password: 10 | ${CAPABILITIES} ${EMPTY.join(${_tmp})} 11 | ${REMOTE_URL} https:///nexperience/perfectomobile/wd/hub 12 | ${URL} https://google.com/ 13 | ${TEXT_SHOULD_CONTAIN_1} Product Samples 14 | ${ELEMENT_LOAD_TIME} 20 15 | 16 | *** Test Cases *** 17 | Example using robot with Perfecto 18 | [Tags] Tag1 Tag2 Tag3 mytest 19 | ${tags}= Create List test1 test2 20 | ${reporting_client}= get_reporting_client 21 | log ${reporting_client} 22 | reportium_start ${reporting_client} WebRobotTestPass ${tags} 23 | Page should contain element class=gLFyf ${ELEMENT_LOAD_TIME} 24 | Input text class=gLFyf PerfectoCode GitHub 25 | Click button class=Tg7LZd 26 | Click Element xpath=//li[@class='sbct sbhl']//span 27 | Page should contain ${TEXT_SHOULD_CONTAIN_1} 28 | [Teardown] reportium_stop ${reporting_client} ${TEST STATUS} ${TEST MESSAGE} 29 | 30 | Example using robot with Perfecto Fail 31 | [Tags] Tag1 Tag2 Tag3 mytest 32 | ${tags}= Create List test1 test2 33 | ${reporting_client}= get_reporting_client 34 | log ${reporting_client} 35 | reportium_start ${reporting_client} WebRobotTestFail ${tags} 36 | Page should contain element class=gLFyf ${ELEMENT_LOAD_TIME} 37 | Input text class=gLFyf PerfectoCode GitHub 38 | Click button class=Tg7LZd 39 | Click Element xpath=//li[@class='sbct sbhl']//span 40 | Page should contain ${TEXT_SHOULD_CONTAIN_1} 41 | [Teardown] reportium_stop ${reporting_client} ${TEST STATUS} ${TEST MESSAGE} 42 | 43 | test 44 | Sample 45 | -------------------------------------------------------------------------------- /Selenium/Python/Robot-framework/perfecto_Web_Mobile.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Suite Setup Open Browser ${URL} remote_url=${REMOTE_URL} desired_capabilities=${CAPABILITIES} 3 | Suite Teardown Close all browsers 4 | Library Selenium2Library 5 | Library sample.py 6 | 7 | *** Variables *** 8 | @{_tmp} platformName:iOS, browserName:mobileOS, user:, password: 9 | ${CAPABILITIES} ${EMPTY.join(${_tmp})} 10 | ${REMOTE_URL} https:///nexperience/perfectomobile/wd/hub 11 | ${URL} https://google.com/ 12 | ${TEXT_SHOULD_CONTAIN_1} Product Samples 13 | ${ELEMENT_LOAD_TIME} 20 14 | 15 | *** Test Cases *** 16 | Example using robot with Perfecto 17 | [Tags] Tag1 Tag2 Tag3 mytest 18 | ${tags}= Create List test1 test2 19 | ${reporting_client}= get_reporting_client 20 | log ${reporting_client} 21 | reportium_start ${reporting_client} MobileRobotTestPass ${tags} 22 | Page should contain element class=gLFyf ${ELEMENT_LOAD_TIME} 23 | Input text class=gLFyf PerfectoCode GitHub 24 | Click button class=Tg7LZd 25 | Click Element xpath=(//*[contains(text(), 'PerfectoCode')])[1] 26 | Page should contain ${TEXT_SHOULD_CONTAIN_1} 27 | [Teardown] reportium_stop ${reporting_client} ${TEST STATUS} ${TEST MESSAGE} 28 | 29 | Example using robot with Perfecto Fail 30 | [Tags] Tag1 Tag2 Tag3 mytest 31 | ${tags}= Create List test1 test2 32 | ${reporting_client}= get_reporting_client 33 | log ${reporting_client} 34 | reportium_start ${reporting_client} MobileRobotTestFail ${tags} 35 | Page should contain element class=gLFyf ${ELEMENT_LOAD_TIME} 36 | Input text class=gLFyf1 PerfectoCode GitHub 37 | Click button class=Tg7LZd 38 | Click Element xpath=(//*[contains(text(), 'PerfectoCode')])[1] 39 | Page should contain ${TEXT_SHOULD_CONTAIN_1} 40 | [Teardown] reportium_stop ${reporting_client} ${TEST STATUS} ${TEST MESSAGE} 41 | 42 | test 43 | Sample 44 | -------------------------------------------------------------------------------- /Selenium/Python/searchAndFillForm/README.md: -------------------------------------------------------------------------------- 1 | # Python Sample 2 | 3 | **TO DO:** 4 | - Create a Python project using your desired IDE ([Eclipse pydev](http://marketplace.eclipse.org/node/114) + [Perfecto plugin](https://www.perfectomobile.com/download-integrations) project is recommended!). 5 | - Copy this test to the main test unit. 6 | - Change Hostname, user and password. 7 | - Compile and run RemoteWebDriverTest.py (Using: python filename.py or via IDE). 8 | -------------------------------------------------------------------------------- /Selenium/README.md: -------------------------------------------------------------------------------- 1 | #Selenium 2 | The Perfecto Selenium server is an extension of the existing Selenium server, enabling a single test for both mobile browsers and desktop browsers 3 | 4 | You can find different project and code samples related to Selenium in this repository. 5 | 6 | To learn more on Perfecto Selenium, access the [Selenium RemoteWebDriver Guide](https://community.perfectomobile.com/posts/915148-selenium-remotewebdriver) 7 | -------------------------------------------------------------------------------- /Selenium/Ruby/GeicoWeb/README.md: -------------------------------------------------------------------------------- 1 | #Selenium Python Automation 2 | 3 | **To do**: 4 | - Downlaod the .rb files . 5 | - Replace My-Host with your cloud host. 6 | - Replace My_User at capabilities_hash with your cloud user. 7 | - Replace My_Password at capabilities_hash with your cloud password. 8 | - Replace Device name or add another capabilities. 9 | -------------------------------------------------------------------------------- /Selenium/Ruby/GeicoWeb/geico_test.rb: -------------------------------------------------------------------------------- 1 | require 'selenium-webdriver' 2 | require 'uri' 3 | require_relative 'Locators' 4 | 5 | class Geico_test 6 | include Locators 7 | 8 | host = ARGV[0] #'My-Host.perfectomobile.com' 9 | token = ARGV[1] #'My_Security_Token' 10 | #user = ARGV[1] #'My_User' 11 | #pass = ARGV[2] #'My_Password' 12 | url = 'http://' + host + '/nexperience/perfectomobile/wd/hub' 13 | 14 | capabilities = { 15 | :platformName => 'Android', 16 | :securityToken => token 17 | #:user => user, 18 | #:password => pass 19 | #:CapabilitieExample => SomeValue, 20 | } 21 | 22 | driver = Selenium::WebDriver.for(:remote, :url => url, :desired_capabilities => capabilities) 23 | driver.manage.timeouts.implicit_wait = 25 24 | driver.get 'www.geico.com' 25 | 26 | ####test#### PageObject Model 27 | begin 28 | #Main Page 29 | main = MainPage.new(driver) 30 | main.set_insurance_type 31 | main.set_zip('1234') 32 | main.submit 33 | 34 | #Costumer Information Page 35 | costumer_info_page = CostumerInformationPage.new(driver) 36 | costumer_info_page.set_no_old_insurance 37 | costumer_info_page.set_FirstName('MyName') 38 | costumer_info_page.set_LastName('MyLastName') 39 | costumer_info_page.set_StreetAdress('MyStreetAddress') 40 | costumer_info_page.set_APT('1234') 41 | costumer_info_page.set_ZIP('50840') 42 | costumer_info_page.set_BirthDay('11', '1', '1111') 43 | costumer_info_page.set_geico_auto_insurance_no 44 | costumer_info_page.set_motorcycle_insurance_no 45 | costumer_info_page.submit 46 | end 47 | ensure 48 | driver.quit 49 | 50 | end 51 | -------------------------------------------------------------------------------- /Selenium/Ruby/README.md: -------------------------------------------------------------------------------- 1 | ## Selenium WebDriver Samples Using Ruby 2 | 3 | These code samples show how to create Selenium tests using ruby programming language. 4 | 5 | **Download:** 6 | - Selenium download [here](http://www.seleniumhq.org/download/) - Choose Ruby. 7 | - Eclipse IDE is recommended, you can find Plugins for Ruby at the [marketplace](https://marketplace.eclipse.org/) . 8 | - Eclipse integration with perfecto plugin download [here](https://www.perfectomobile.com/download-integrations) . 9 | 10 | ### Easy Starting: 11 | 12 | Setting up the webdriver: 13 | ```Ruby 14 | require 'selenium-webdriver' 15 | require 'uri' 16 | 17 | capabilities = { 18 | :deviceName => 'My_deviceName', 19 | :user => 'My_User', 20 | :password => 'My_Password' 21 | } 22 | 23 | host = 'My_Host.perfectomobile.com' 24 | url = "http://" + host + "/nexperience/perfectomobile/wd/hub" 25 | 26 | #Load webdriver 27 | driver = Selenium::WebDriver.for(:remote, :url => url, :desired_capabilities => capabilities) 28 | ``` 29 | -------------------------------------------------------------------------------- /Selenium/Ruby/searchAndFillForm/GoogleSearchRuby.rb: -------------------------------------------------------------------------------- 1 | require 'selenium-webdriver' 2 | require 'uri' 3 | 4 | #Test class. 5 | class GoogleSearchRuby 6 | 7 | host = 'My_Host.perfectomobile.com' 8 | token = 'My_Security_Token' 9 | #user = 'My_User' 10 | #pass = 'My_Password' 11 | 12 | #Provide your device capabilities here. 13 | @@capabilities = { 14 | :securityToken => token, 15 | #:user => user, 16 | #:password => pass, 17 | :platformName => 'Windows', 18 | :platformVersion => '8.1', 19 | :browserName => 'Chrome', 20 | :browserVersion => '49' 21 | } 22 | 23 | @@url = 'http://' + host + '/nexperience/perfectomobile/wd/hub' 24 | 25 | #### test method #### 26 | def test() 27 | begin 28 | #Creating a driver. 29 | driver = Selenium::WebDriver.for(:remote, :url => @@url, :desired_capabilities => @@capabilities) 30 | driver.manage.timeouts.implicit_wait = 25 31 | driver.manage.window.maximize 32 | 33 | #Search in google. 34 | driver.get 'https://google.com' 35 | driver.find_element(:name , 'q').send_keys('perfecto mobile') 36 | driver.find_element(:xpath , "//*[@id='rso']/div[1]/div[1]/div/h3/a").click() 37 | 38 | #Fill a form in perfecto site. 39 | driver.find_element(:xpath , "//*[text() = 'Start Free']").click(); 40 | driver.find_element(:id , 'FirstName').send_keys('MyFirstName'); 41 | driver.find_element(:id , 'LastName').send_keys('MyLaseName'); 42 | driver.find_element(:id , 'Company').send_keys('MyCompany'); 43 | driver.find_element(:id , 'Mobile_Testing_Role__c').click(); 44 | driver.find_element(:xpath , "//*[@value = 'Development']").click(); 45 | driver.find_element(:id , 'Email').send_keys('MyEmail@Somehost.com'); 46 | driver.find_element(:id , 'Phone').send_keys('123456789'); 47 | driver.find_element(:id , 'Country').click(); 48 | driver.find_element(:xpath , "//*[@value = 'Israel']").click(); 49 | 50 | rescue => e 51 | puts e 52 | ensure 53 | driver.quit 54 | end #end begin 55 | 56 | end #end def 57 | 58 | end #end class. 59 | 60 | 61 | #Building a test class (GoogleSearchRuby) instance and starting the test. 62 | GoogleSearchRuby.new.test() 63 | 64 | -------------------------------------------------------------------------------- /Selenium/Ruby/searchAndFillForm/README.md: -------------------------------------------------------------------------------- 1 | # Ruby Sample 2 | 3 | **TO DO:** 4 | - Download the Ruby test. 5 | - Change Hostname , user and password. 6 | - Run this as a test as a regular ruby script (Ruby filename.rb). 7 | -------------------------------------------------------------------------------- /Visual-Analysis/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Visual-Analysis/.DS_Store -------------------------------------------------------------------------------- /Visual-Analysis/Readme.md: -------------------------------------------------------------------------------- 1 | ##Visual Analysis Samples 2 | 3 | Visual analysis involves the ability to “look” at the current page that is displayed on the device and visually identify either text or graphic images that are displayed. 4 | 5 | It acts as a real user, "seeing" real life bugs like corrupted or cut text, something which you might not find when using objects. 6 | 7 | Visual analysis is an alternative way of interacting with the device. Its source is the screenshot taken from the device, a 100% match of what the user sees. 8 | 9 | Perfecto can analyze the image looking for either text or images, with text being the recommended option. 10 | 11 | **Main uses for visual analysis** 12 | 1. In cases where object analysis does not work 13 | 2. When there’s a need to validate what the user sees on a certain page 14 | 3. In cases where Selenium can't automate system level messages and popups 15 | 16 | **[Perfecto commands](https://community.perfectomobile.com/series/23047)** 17 | • Checkpoint - Validates the needle appears on the screen 18 | • Select - Clicks on the needle 19 | • Find - Finds a needle for visual relations 20 | 21 | :information_source: [Quick how to get started](https://community.perfectomobile.com/posts/961107) 22 | -------------------------------------------------------------------------------- /Visual-Analysis/maps-web/README.md: -------------------------------------------------------------------------------- 1 | ##Maps-Web Code Sample 2 | 3 | This sample utilizes Perfecto's Visual Analysis to test the Google Maps web app on a desktop, AND demonstrates another scenario for cross platform testing. 4 | 5 | In the test, a WEB SESSION ON A DESKTOP is started, launching the Google maps web application. Source & destination addresses are specified, and driving diractions are requested, selecting the first route, for which the duration, distance, and route name are extracted. 6 | 7 | Once signed into a Google account associated with a MOBILE DEVICE, these directions are then sent to the Goggle Maps' native application on that mobile. 8 | 9 | Both text and image checkpoints are used, image buttons are clicked, and field values are set, all using Visual Analysis. 10 | 11 | **TODO:** 12 | - Set your lab, user, and password. 13 | - Upload the three .png files from the "test images" directory into the repository, and change path in test script to match the loaction you used. 14 | - Set Google account credentials and associate them with a mobile device. 15 | - Set that mobile device ID in the mobileSessionMaps.java file. 16 | - Perfecto Utils classes are required for this test and can be found at https://github.com/PerfectoCode/Templates/tree/master/Utils. 17 | -------------------------------------------------------------------------------- /Visual-Analysis/maps-web/mobileSessionMaps.java: -------------------------------------------------------------------------------- 1 | import java.net.MalformedURLException; 2 | import java.net.URL; 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | import java.util.concurrent.TimeUnit; 6 | 7 | import org.openqa.selenium.By; 8 | import org.openqa.selenium.remote.DesiredCapabilities; 9 | import org.openqa.selenium.remote.RemoteWebDriver; 10 | 11 | import io.appium.java_client.AppiumDriver; 12 | import io.appium.java_client.android.AndroidDriver; 13 | 14 | public class mobileSessionMaps{ 15 | 16 | AndroidDriver driver; 17 | 18 | public mobileSessionMaps() throws MalformedURLException{ 19 | DesiredCapabilities capabilities = new DesiredCapabilities(); 20 | capabilities.setCapability("securityToken", WebMapeTest.token); 21 | 22 | //old school credentials 23 | //capabilities.setCapability("user", WebMapsTest.user); 24 | //capabilities.setCapability("password", WebMapsTest.pswd); 25 | 26 | driver = new AndroidDriver<>(new URL("https://" + WebMapsTest.host + "/nexperience/perfectomobile/wd/hub"), capabilities); 27 | } 28 | 29 | public void AcceptMapsDirections(){ 30 | try{ 31 | driver.openNotifications(); 32 | driver.context("NATIVE_APP"); 33 | driver.findElement(By.xpath("//*[@resource-id=\"com.android.systemui:id/notification_stack_scroller\"]/android.widget.FrameLayout[1]")).click(); 34 | 35 | System.out.println("Successfully recived directions to mobile"); 36 | 37 | Thread.sleep(5000); //waits 5 seconds befor end of the mobile session 38 | }catch(Exception ex){ 39 | ex.printStackTrace(); 40 | }finally { 41 | try { 42 | driver.close(); 43 | } catch (Exception e) { 44 | e.printStackTrace(); 45 | } 46 | driver.quit(); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Visual-Analysis/maps-web/test images/maps - directions icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Visual-Analysis/maps-web/test images/maps - directions icon.png -------------------------------------------------------------------------------- /Visual-Analysis/maps-web/test images/maps - directions page indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Visual-Analysis/maps-web/test images/maps - directions page indicator.png -------------------------------------------------------------------------------- /Visual-Analysis/maps-web/test images/maps - driving directions icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Visual-Analysis/maps-web/test images/maps - driving directions icon.png -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/.classpath: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Perfecto_Analysis 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/README.md: -------------------------------------------------------------------------------- 1 | ##Fill Form Using Visual Analysis 2 | This code sample shows how to locate elements and insert text using Perfecto visual analysis. 3 | 4 | Note that this sample using images from Chrome Browser different browser may require a new images! 5 | 6 | **TODO:** 7 | - Import the project to Eclipse or Intellij as Maven Project. 8 | - Set your Perfecto lab User, Password and Cloud's Host at driverCreator.Java file. 9 | - Set your desktop device capabilities at testng.xml. 10 | - Upload the test images (from VisualAnalysis Pics directory) to your repository. 11 | - Update the test images path at Perfecto_VisualAnalysis.java file. 12 | - Run the project as TestNG test via testng.xml file. 13 | 14 | For more info about Maven click [here](https://community.perfectomobile.com/posts/915224-working-with-maven) 15 | 16 | For more info about TestNG click [here](https://community.perfectomobile.com/posts/988612-manage-testng-execution-and-data) 17 | -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/VisualAnalysis Pics/CheckPoint1(Free Mobile Testing).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Visual-Analysis/perfecto-form/VisualAnalysis Pics/CheckPoint1(Free Mobile Testing).png -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/VisualAnalysis Pics/Company.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Visual-Analysis/perfecto-form/VisualAnalysis Pics/Company.png -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/VisualAnalysis Pics/Email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Visual-Analysis/perfecto-form/VisualAnalysis Pics/Email.png -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/VisualAnalysis Pics/FullName.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Visual-Analysis/perfecto-form/VisualAnalysis Pics/FullName.png -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/VisualAnalysis Pics/LastName.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Visual-Analysis/perfecto-form/VisualAnalysis Pics/LastName.png -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/VisualAnalysis Pics/Phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Visual-Analysis/perfecto-form/VisualAnalysis Pics/Phone.png -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.perfecto.tests 4 | Perfecto_Analysis 5 | 0.0.1-SNAPSHOT 6 | 7 | 8 | 9 | org.seleniumhq.selenium 10 | selenium-api 11 | 2.53.0 12 | 13 | 14 | org.seleniumhq.selenium 15 | selenium-remote-driver 16 | 2.53.0 17 | 18 | 19 | org.seleniumhq.selenium 20 | selenium-remote-driver 21 | 2.53.0 22 | 23 | 24 | org.seleniumhq.selenium 25 | selenium-support 26 | 2.53.0 27 | 28 | 29 | org.testng 30 | testng 31 | 6.9.10 32 | 33 | 34 | org.testng 35 | testng 36 | 6.9.10 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/src/test/java/driverCreator.java: -------------------------------------------------------------------------------- 1 | import org.openqa.selenium.remote.DesiredCapabilities; 2 | import org.openqa.selenium.remote.RemoteWebDriver; 3 | 4 | import java.net.MalformedURLException; 5 | import java.net.URL; 6 | 7 | public class driverCreator { 8 | 9 | //TODO: Set your Host and Security Token for Perfecto Lab 10 | static String PERFECTO_HOST = "MY_HOST.perfectomobile.com"; 11 | static String PERFECTO_TOKEN = "MY_SECURITY_TOKEN"; 12 | 13 | //Old school credentials, we recommend using Security Token instead. 14 | //static String PERFECTO_USER = "MY_USER"; 15 | //static String PERFECTO_PASS = "MY_PASS"; 16 | 17 | public static RemoteWebDriver init_driver(String platformName, String platformVersion, String browserName, String browserVersion, String screenResolution) throws MalformedURLException { 18 | 19 | DesiredCapabilities capabilities = new DesiredCapabilities().chrome(); 20 | capabilities.setCapability("securityToken", PERFECTO_TOKEN); 21 | //capabilities.setCapability("user", PERFECTO_USER); 22 | //capabilities.setCapability("password", PERFECTO_PASS); 23 | capabilities.setCapability("platformName", platformName); 24 | capabilities.setCapability("platformVersion", platformVersion); 25 | capabilities.setCapability("browserName", browserName); 26 | capabilities.setCapability("browserVersion", browserVersion); 27 | capabilities.setCapability("resolution", screenResolution); 28 | 29 | return new RemoteWebDriver(new URL("https://" + PERFECTO_HOST + "/nexperience/perfectomobile/wd/hub"), capabilities); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Visual-Analysis/perfecto-form/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Windows10/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectoCode/Samples/8339178c854f62fd39644ef5d95e7037742409e1/Windows10/.DS_Store -------------------------------------------------------------------------------- /Windows10/C#/Calculator/Calculator.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Calculator", "Calculator\Calculator.csproj", "{FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {FD81D7A4-BDB5-4183-83BD-1B233EF57FDD}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Windows10/C#/Calculator/Calculator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("PerfectoLabTemplateProject")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("PerfectoLabTemplateProject")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("fd81d7a4-bdb5-4183-83bd-1b233ef57fdd")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Windows10/C#/Calculator/Calculator/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Windows10/C#/Calculator/README.md: -------------------------------------------------------------------------------- 1 | ## Test windows 10 device using C# NUnit framework . 2 | 3 | This code sample shows how to test Windows 10 device using C# NUnit framework. 4 | 5 | **TODO:** 6 | - Download the project and import into visual studio. 7 | - Make sure Perfecto plugin is installed, it can be found [here](https://www.perfectomobile.com/download-integrations). 8 | - Set your Perfecto lab user,pass and host at the test file. 9 | - Run as NUnit test. 10 | 11 | For more support check out our [community](https://community.perfectomobile.com/) 12 | -------------------------------------------------------------------------------- /Windows10/C#/README.md: -------------------------------------------------------------------------------- 1 | ## Window10 Native Automation Using C # # 2 | 3 | The Perfecto plugin for Visual Studio supports running an automation script for a Windows 10 app directly on a Surface Pro 4 device connected to the Perfecto Lab. 4 | 5 | The following samples shows how to use C# in order to execute automation tests on this devices. 6 | 7 | Read more about this code sample in our [community](https://community.perfectomobile.com/posts/1201497-automating-the-windows-10-calculator?video_markers=surface) . 8 | -------------------------------------------------------------------------------- /Windows10/Java/Win10CalculatorSample/README.md: -------------------------------------------------------------------------------- 1 | ## Windows 10 Automation using Java + TestNG 2 | 3 | **TODO:** 4 | - Download the project files and import to intellij or eclipse . 5 | - Download the project's dependecies (as described at the buttom of the readme). 6 | - Change to your Perfecto lab username, password and host at Win10Calaculator.java file . 7 | - Run using testNG from the testNG.xml file. 8 | 9 | ### Required dependecies: 10 | - Selenium jars and Selenium standalone required and can be downloaded from [here](http://www.seleniumhq.org/download/) . 11 | - TestNG usually already included in intellij and eclipse , yet it can be downloaded from [here](http://testng.org/doc/download.html). 12 | 13 | Read more about windows 10 automation at our [community](https://community.perfectomobile.com/posts/1199190-windows-10-testing-on-surface-pro) . 14 | -------------------------------------------------------------------------------- /Windows10/Java/Win10CalculatorSample/Win10CalculatorSample.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Windows10/Java/Win10CalculatorSample/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Windows10/README.md: -------------------------------------------------------------------------------- 1 | ## Windows10 RemoteWebDriver Tests 2 | 3 | Perfecto provides support for testing of Windows 10 applications developed for the Surface Pro 3 & 4 based on Microsoft WinAppDriver. 4 | 5 | **Using Surface Pro devices connected to the Perfecto Lab you can:** 6 | - Install the application onto the device. 7 | - Create your WinAppDriver test script in any supported Remote WebDriver language using the Perfecto plugin for any of the supported IDE such as Visual Studio, Eclipse or IntelliJ. 8 | 9 | Specify the application to test using the following DesiredCapabilities: 10 | 11 | **app** 12 | ```C# 13 | capabilities.setCapability("app","PUBLIC:/PMTestAppWin10_1.0.7.0_Debug_Test.zip"); 14 | ``` 15 | **winAppId** 16 | ```C# 17 | capabilities.setCapability("winAppId","com.perfecto.pmtestappwin10_r8aakf30rbczp!App"); 18 | ``` 19 | 20 | Read more about Windows 10 native automation in our [community](https://community.perfectomobile.com/posts/1199190-windows-10-testing-on-surface-pro) . 21 | --------------------------------------------------------------------------------
Results forDefault suite
Test results