Skip to content

Instantly share code, notes, and snippets.

@mhodgson
Forked from mjumbewu/browserstack_tunnel_setup.sh
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhodgson/7bfa819b5d9a080b9f92 to your computer and use it in GitHub Desktop.
Save mhodgson/7bfa819b5d9a080b9f92 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Setup and start BrowserStack Tunnel for your TravisCI build
#
# This script was adopted from Santiago Suarez Ordoñez's Sauce Connect
# setup script: https://gist.github.com/santiycr/5139565/
#
# This script requires your .travis.yml to include the following private
# env variable:
#
# * BROWSERSTACK_KEY
#
# You can find the access key for your account at
# http://www.browserstack.com/local-testing
#
# Curl and run this script as part of your .travis.yml before_script section:
#
# before_script:
# - curl https://gist.github.com/mhodgson/7bfa819b5d9a080b9f92/raw/browserstack_tunnel_setup.sh | bash
BROWSERSTACK_TUNNEL_URL="http://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip"
BROWSERSTACK_TUNNEL_DIR="/tmp/browserstack-$RANDOM"
# Download and extract the program
mkdir -p $BROWSERSTACK_TUNNEL_DIR
cd $BROWSERSTACK_TUNNEL_DIR
wget $BROWSERSTACK_TUNNEL_URL
unzip BrowserStackLocal-linux-x64.zip
# Start it
./BrowserStackLocal -v -onlyAutomate -localIdentifier $TRAVIS_JOB_NUMBER $BROWSERSTACK_KEY localhost,8001,0 &
# Wait a few seconds for it to be ready
sleep 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment