Skip to content

Commit

Permalink
change host to bs-local on ios platform
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitmun committed Mar 6, 2018
1 parent fb11e48 commit dba129b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
16 changes: 11 additions & 5 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,15 @@ function getTestBrowserInfo(browserString, path) {
return info;
}

function buildTestUrl(test_path, worker_key, browser_string) {
var url = 'http://localhost:' + config.test_server_port + '/' + test_path;

function buildTestUrl(test_path, worker_key, browser) {
var host;
if (browser.os.toLowerCase() === 'ios' ){
host = 'bs-local.com';
} else {
host = 'localhost';
}
var url = 'http://'+host+':' + config.test_server_port + '/' + test_path;
var browser_string = utils.browserString(browser);
var querystring = qs.stringify({
_worker_key: worker_key,
_browser_string: browser_string
Expand All @@ -131,7 +137,7 @@ function launchBrowser(browser, path) {
var browserInfo = getTestBrowserInfo(browserString, path);
logger.debug('[%s] Launching', browserInfo);

browser.url = buildTestUrl(path.replace(/\\/g, '/'), key, browserString);
browser.url = buildTestUrl(path.replace(/\\/g, '/'), key, browser);

if (config.project) {
browser.project = config.project;
Expand Down Expand Up @@ -195,7 +201,7 @@ function attachWorkerHelpers(worker) {

worker.buildUrl = function buildUrl(test_path) {
var workerKey = workerKeys[this.id] ? workerKeys[this.id].key : null;
var url = buildTestUrl(test_path || this.test_path, workerKey, this.getTestBrowserInfo());
var url = buildTestUrl(test_path || this.test_path, workerKey, this.config);
logger.trace('[%s] worker.buildUrl: %s', this.id, url);
return url;
};
Expand Down
9 changes: 8 additions & 1 deletion tests/behaviour/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ var getBaseConfig = function() {
browser_version: '52.0',
os: 'Windows',
os_version: '7'
}, {
browser: 'iphone',
browser_version: '',
device: 'iPhone SE',
os: 'ios',
os_version: '11.2',
real_mobile: true
} ]
}
};
Expand Down Expand Up @@ -100,7 +107,7 @@ describe('Pass/Fail reporting', function() {
it('report keys should have browser names', function(done) {
var config = getBaseConfig();
browserstackRunner.run(config, function(err, reports) {
var shouldBePresentBrowsers = [ 'Windows 7, Chrome 52.0', 'Windows 7, Firefox 47.0' ];
var shouldBePresentBrowsers = [ 'Windows 7, Chrome 52.0', 'Windows 7, Firefox 47.0', 'ios 11.2, Iphone '];
assert.equal(err, null);
reports.forEach(function(report) {
var numMatched = 0;
Expand Down

0 comments on commit dba129b

Please sign in to comment.