Skip to content

Instantly share code, notes, and snippets.

View sauceaaron's full-sized avatar
💭
Cooking ribs

Aaron Evans sauceaaron

💭
Cooking ribs
View GitHub Profile
package com.briovarx.test;
import com.saucelabs.saucerest.SauceREST;
import java.io.File;
import java.io.IOException;
public class SauceStorage
{
public static void main(String[] args) throws IOException
import io.appium.java_client.AppiumDriver;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
package saucelabs;
import com.saucelabs.saucerest.SauceREST;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import io.appium.java_client.AppiumDriver;
import java.util.Set;
public class SwitchToWebView
{
public void switchToWebContext(AppiumDriver driver)
{
String webContext = getWebContext(driver);
@sauceaaron
sauceaaron / SauceTestBase.java
Created April 10, 2018 22:45
Parallel Gradle TestNG SauceLabs
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
public class SauceTestBase
@sauceaaron
sauceaaron / sauce-job-result-wd.js
Last active April 6, 2018 18:55
Update test results in Sauce Labs using Javascript executor from WD
var wd = require("wd");
var username = process.env.SAUCE_USERNAME;
var accessKey = process.env.SAUCE_ACCESS_KEY;
var capabilities = {
platform: "Linux",
browseName: "Chrome",
version: "latest",
name: "Update test results in Sauce Labs using Javascript executor from WD"
@sauceaaron
sauceaaron / install-android-sdk-and-create-emulator.sh
Created February 8, 2018 18:17
Install Android SDK and create an Emulator
#!/bin/bash
### install Android SDK tools
echo "installing Android SDK tools"
### prepare Android SDK install location
ANDROID_HOME=Android/sdk
ANDROID_SDK_ROOT=$ANDROID_HOME/
@sauceaaron
sauceaaron / README.md
Last active November 30, 2017 00:05
Use the TestObject API to check for available private devices

##install dependencies:

npm install request-promise

##set environment variable:

export TESTOBJECT_USERNAME=your_username
export TESTOBJECT_API_KEY=your_api_key

##run:

import com.gargoylesoftware.htmlunit.StringWebResponse;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.HTMLParser;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
import java.io.IOException;
import java.net.URL;
@sauceaaron
sauceaaron / TableTest.java
Last active October 26, 2017 21:18
Demonstrate getting the source of an HTML table using WebDriver and using XPath to parse it locally to reduce the number of network requests.
package com.saucelabs.examples;
import com.saucelabs.examples.util.Xpath;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;