Skip to content

Instantly share code, notes, and snippets.

View batmi02's full-sized avatar

Michael Battat batmi02

  • Applitools
View GitHub Profile
@batmi02
batmi02 / AppiumAndroid.js
Created March 10, 2021 21:26
Appium Instructions for Android Setup
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 900000);
// Session is created using Android Espresso Driver
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ESPRESSO);
capabilities.setCapability(MobileCapabilityType.APP, System.getProperty("user.dir") + "/apps/ApiDemos.apk");
driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.findElementByAccessibilityId("Views").click();
// Switch to Android UIAutomator2 from Espresso
public class ExampleInstrumentedTest {
@rule
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule(MainActivity.class);
@Test
public void simpleTeset() {
//Initialize the eyes SDK and set your private API key.
Eyes eyes = new Eyes();
eyes.setApiKey("YOUR_API_KEY");
@batmi02
batmi02 / main.yaml
Created July 27, 2020 23:16
Satish Gist
name: CI
on:
push:
branches:
- '**'
env:
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }}
APPLITOOLS_BATCH_ID: ${{ github.sha }}
@Test
public void loginTest() {
//Open browser
//This is our first instruction, directing us to the login page. One line of code.
driver.get("http://localhost:8000/loginBefore.html")
//Click on the Login button
//This is our second instruction, directing action by finding the id 'log-in' and clicking. One line of code.
driver.findElement(By.id("log-in")).click();
@Test
public void loginClassicTest() {
//Open browser
//This is our first instruction, directing us to the login page. One line of code.
driver.get("http://localhost:8000/loginBefore.html")
//Click on the Login button
//This is our second instruction, directing action by finding the id 'log-in' and clicking. One line of code.
driver.findElement(By.id("log-in")).click();
List<Transaction> unsortedTransactions = transactionsTable.allData();
List<Line> images = transactionsTable.rowsImages();
transactionsTable.headerUI().select("AMOUNT");
transactionsTable.assertThat()
.rows(hasItems(toArray(unsortedTransactions)))
.sortedBy((prev,next) -> prev.amount.value() < next.amount.value())
.rowsVisualValidation("Description", images);
List<Transaction> unsortedTransactions = transactionsTable.allData();
transactionsTable.headerUI().select("AMOUNT");
transactionsTable.assertThat()
.rows(hasItems(toArray(unsortedTransactions)))
.sortedBy((prev,next) -> prev.amount.value() < next.amount.value());
public class LoginPage extends WebPage {
@UI(".auth-header") Label header;
@UI(".logo-w img") Image circleImage;
@UI(".alert-warning") public Text alert;
@ByText("Username") Label userLabel;
@ByText("Password") Label passwordLabel;
@UI(".os-icon-user-male-circle") Icon userIcon;
@UI(".os-icon-fingerprint") Icon fingerprintIcon;
@UI(".form-check-label") Checkbox rememberMe;
@UI("[src*=twitter]") Icon twitter;
// ------------------------------------------------------------------
// Legacy code based testing
// ------------------------------------------------------------------
@Test
public void productListTest() {
// ----- Check the 1st Item -----
By firstItem = By.id("__item0-container-cart---category--productList-0-titleText-inner");
waitForExistence(firstItem);
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d14613.381974540789!2d133.87137518023806!3d-23.699353203831237!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x2b321944be8f1331%3A0x50217a82a254fd0!2sAlice%20Springs%20NT%200870%2C%20Australia!5e0!3m2!1sen!2sus!4v1574447375313!5m2!1sen!2sus" width="600" height="450" frameborder="0" style="border:0;" allowfullscreen=""></iframe>