Skip to content

Instantly share code, notes, and snippets.

@adamgoucher
Created February 14, 2013 19:06
Show Gist options
  • Save adamgoucher/4955378 to your computer and use it in GitHub Desktop.
Save adamgoucher/4955378 to your computer and use it in GitHub Desktop.
browser arrays
<?php
$sites = array(
"development" => "http://localhost",
"qa" => "http://qa.mycompany.com",
"staging" => "http://stage.mycompany.com",
"production" => "http://fashion.ebay.com"
);
$GLOBALS['settings']['webserver'] = $sites["production"];
$timeout = 45; // seconds
$GLOBALS['timeouts'] = array(
"seconds" => $timeout,
"ms" => $timeout * 1000,
"str_ms" => (string) $timeout * 1000
);
// this comes after the timeouts allowing for overriding
$browsers = array(
"frontend" = array( // just a label, first will always be aliased to current label
"browser" => "firefox", // the browser string
"server" => "localhost", // optional, default is localhost
"port" => "4444" // optional, default is 4444
"saucelabs" => array ( // this whole array is optional, default is no
'ondemand' => true,
'get_video' => false,
'get_log' => false,
'os' => 'Windows 2000',
'browser_version' => 18
),
"timeouts" => array ( // if this/any are not here, global is assumed
"seconds" => $GLOBALS["timeouts"]["seconds"],
"ms" => $GLOBALS["timeouts"]["ms"],
"str_ms" => $GLOBALS["timeouts"]["str_ms"]
),
"webserver" => $GLOBALS["settings"]["webserver"],
"proxy" => array (
"proxy_request" => false,
"host" => "localhost",
"port" => "9090",
"browsermob" => true
)
),
// another browser
);
$GLOBALS['settings']['browsers'] = $browsers;
foreach ($browsers as $browser) {
if (array_key_exists('saucelabs', $browser) && $browser['saucelabs']['ondemand']) {
require_once("saucelabs.inc");
$browser['browser'] = json_encode(array(
"username" => $GLOBALS['saucelabs']['username'],
"access-key" => $GLOBALS['saucelabs']['key'],
"os" => $browser['saucelabs']['os'],
"browser" => $browser['browser'],
"browser-version" => $browser['saucelabs']['browser-version']
));
}
}
// your custome stuff below here
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment