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
@sauceaaron
sauceaaron / check_sauce_storage.rb
Last active May 23, 2017 15:02
check that file is uploaded to sauce labs
#!/usr/bin/env ruby
require "digest/md5"
require "sauce_whisk"
# specify the file to upload
local_file_path = "/tmp/foo.apk"
# get file name and checksum to use later
file_name = File.basename(local_file_path)
@sauceaaron
sauceaaron / Test_With_Prerun_Executable.java
Last active May 25, 2017 15:07
Running a pre-run executable
package saucelabs.examples;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import java.io.File;
import java.net.URL;
import java.util.*;
@sauceaaron
sauceaaron / download-file-test.js
Last active June 13, 2017 19:18
check the size of a downloaded file in a test using webdriverio and superagent
var should = require("chai").should();
var request = require("superagent");
var page = {
url: "http://saucelabs.github.io/training-test-page/",
title: "I am a page title - Sauce Labs",
logo: { selector: "img:first-of-type", filename: "saucelogo.png", size: 9666 }
};
describe("download file", function() {
Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -name EnableNegotiate -value 0
Get-Item "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.saucelabs.saucerest.SauceREST;
import java.lang.reflect.Type;
import java.util.List;
public class SauceConnectTunnelManager
{
private String SAUCE_USERNAME = System.getenv("SAUCE_USERNAME");
@sauceaaron
sauceaaron / shutdown_sauce_connect_tunnels_with_auth_header.ps1
Last active August 18, 2017 23:18
Use Powershell to call the Sauce REST API to shutdown Sauce Connect tunnels using Basic Authentication header
$username = $(Get-ChildItem Env:SAUCE_USERNAME).value
$accessKey = $(Get-ChildItem Env:SAUCE_ACCESS_KEY).value
$credentials = "$username`:$accessKey"
$encodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($credentials))
$headers = @{ Authorization = "Basic $encodedCredentials" }
$sauceRestUrl = "https://saucelabs.com/rest/v1"
$userEndpoint = "$sauceRestUrl/users/$username"
$tunnelsEndpoint = "$sauceRestUrl/$username/tunnels"
@sauceaaron
sauceaaron / shutdown_sauce_connect_tunnels_with_credentials.ps1
Created August 18, 2017 23:19
Use Powershell to call the Sauce REST API to shutdown Sauce Connect tunnels using Credentials Windows Dialog
$credentials = Get-Credential
$sauceRestUrl = "https://saucelabs.com/rest/v1"
$userEndpoint = "$sauceRestUrl/users/$username"
$tunnelsEndpoint = "$sauceRestUrl/$username/tunnels"
$user = Invoke-WebRequest -Uri $userEndpoint -Credential $credentials | ConvertFrom-Json
$tunnels = Invoke-WebRequest -Uri $tunnelsEndpoint -Credential $credentials | ConvertFrom-Json
ForEach ($tunnelId in $tunnels)
@sauceaaron
sauceaaron / AppSource.xml
Created September 21, 2017 19:42
Appium Inspector Sample Code
<XCUIElementTypeApplication name="TestApp">
<XCUIElementTypeOther>
<XCUIElementTypeWindow>
<XCUIElementTypeOther>
<XCUIElementTypeTextField name="IntegerA">
<XCUIElementTypeTextField name="IntegerB">
<XCUIElementTypeButton name="ComputeSumButton">
<XCUIElementTypeStaticText name="Answer">
<XCUIElementTypeButton name="show alert">
<XCUIElementTypeButton name="contact alert">
@sauceaaron
sauceaaron / AndroidCalculator.java
Last active October 18, 2017 15:22
Cross device test example using interface and factory
public AndroidCalculator implements Calculator { //... }
@sauceaaron
sauceaaron / CrossPlatformCalculatorTests.java
Last active October 18, 2017 15:32
Example cross platform test that can use IOSDriver or AndroidDriver
public interface Calculator {
WebElement getNumberKey();
WebElement getPlusKey();
WebElement getEqualsKey();
void pressNumber(int number);
void pressPlusKey();
void pressEqualsKey();
//...
}