This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.saucelabs.saucerest.SauceREST; | |
| import java.io.File; | |
| import java.io.IOException; | |
| public class UploadFileToSauceStorage | |
| { | |
| static String SAUCE_USERNAME = System.getenv("SAUCE_USERNAME"); | |
| static String SAUCE_ACCESS_KEY = System.getenv("SAUCE_ACCESS_KEY"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.concurrent.locks.Lock; | |
| import java.util.concurrent.locks.ReadWriteLock; | |
| import java.util.concurrent.locks.ReentrantReadWriteLock; | |
| public class Locking | |
| { | |
| private static final ReadWriteLock locker = new ReentrantReadWriteLock(); | |
| public void lock() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| defaults write com.apple.Safari WarnAboutFraudulentWebsites false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.openqa.selenium.remote.DesiredCapabilities; | |
| import org.openqa.selenium.remote.RemoteWebDriver; | |
| import java.net.URL; | |
| public class DriverFactory | |
| { | |
| URL url; | |
| SessionQueue queue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.util.Properties; | |
| public class BrowserConfig | |
| { | |
| public String getBrowserPath() | |
| { | |
| String browserPath = "/Applications/Firefox.app/Contents/MacOS/firefox"; // default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void testCustomerDeviceAndBaristaTerminalTogether() | |
| { | |
| // Create two sessions in one test -- one on a browser for the barista and one on a mobile device for the customer | |
| browser = new RemoteWebDriver(seleniumServerURL, browserCapabilites); | |
| phone = new AppiumDriver(appiumServerURL, deviceCapabilities); | |
| // Barista logs into terminal app in browser | |
| browser.get(baristaApp.loginPage.url); | |
| browser.findElement(baristaApp.loginPage.usernameField).sendKeys(barista.username); | |
| browser.findElement(baristaApp.loginPage.passwordField).sendKeys(barista.password); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void testCustomerDeviceWithBaristaApi() | |
| { | |
| // Create a session for the customer app | |
| phone = new AppiumDriver(sauceURL, deviceCapabilities); | |
| // Create an API service that interacts with the mobile app | |
| baristaAPI = new BaristaAPI(barristUsername, baristaPassword); | |
| // Customer logs into mobile app on mobile device | |
| phone.findElement(mobileApp.loginScreen.usernameField).sendKeys(customer.username); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.saucelabs.common; | |
| import com.google.gson.Gson; | |
| import com.sun.deploy.util.StringUtils; | |
| import org.openqa.selenium.remote.RemoteWebDriver; | |
| import java.util.Arrays; | |
| import java.util.HashMap; | |
| import java.util.List; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SauceStorageAPI | |
| { | |
| public String uploadAppToSauceStorage(String filename) throws IOException | |
| { | |
| System.out.println("uploading file to sauce storage: " + filename); | |
| SauceREST api = new SauceREST(SAUCE_USERNAME, SAUCE_ACCESS_KEY); | |
| File appLocalFile = new File(filename); | |
| String appName = appLocalFile.getName(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # ghost_session.py | |
| # usage: python ghost_session.py <running_session_id> | |
| from os import environ | |
| from sys import argv | |
| from time import sleep | |
| from selenium import webdriver | |
| # get the session id you want to take over from command line argument |