Skip to content

Instantly share code, notes, and snippets.

View batmi02's full-sized avatar

Michael Battat batmi02

  • Applitools
View GitHub Profile
@Test
public void iFrameTest() {
// Navigate to the app
driver.get("http://localhost:8000/iFrameExample.html");
//----------------- FRAME 1 ------------------------------
// Grab the outermost frame
driver.switchTo().defaultContent();
//switch context to outer frameset
<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>
// ------------------------------------------------------------------
// 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);
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;
List<Transaction> unsortedTransactions = transactionsTable.allData();
transactionsTable.headerUI().select("AMOUNT");
transactionsTable.assertThat()
.rows(hasItems(toArray(unsortedTransactions)))
.sortedBy((prev,next) -> prev.amount.value() < next.amount.value());
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);
@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();
@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();
@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 }}
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");