Skip to content

Commit 9f7f822

Browse files
authored
Merge pull request #197 from mohitmun/fix_ios_timeouts
change host to bs-local on ios platform
2 parents 88af042 + dba129b commit 9f7f822

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

bin/cli.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,15 @@ function getTestBrowserInfo(browserString, path) {
104104
return info;
105105
}
106106

107-
function buildTestUrl(test_path, worker_key, browser_string) {
108-
var url = 'http://localhost:' + config.test_server_port + '/' + test_path;
109-
107+
function buildTestUrl(test_path, worker_key, browser) {
108+
var host;
109+
if (browser.os.toLowerCase() === 'ios' ){
110+
host = 'bs-local.com';
111+
} else {
112+
host = 'localhost';
113+
}
114+
var url = 'http://'+host+':' + config.test_server_port + '/' + test_path;
115+
var browser_string = utils.browserString(browser);
110116
var querystring = qs.stringify({
111117
_worker_key: worker_key,
112118
_browser_string: browser_string
@@ -131,7 +137,7 @@ function launchBrowser(browser, path) {
131137
var browserInfo = getTestBrowserInfo(browserString, path);
132138
logger.debug('[%s] Launching', browserInfo);
133139

134-
browser.url = buildTestUrl(path.replace(/\\/g, '/'), key, browserString);
140+
browser.url = buildTestUrl(path.replace(/\\/g, '/'), key, browser);
135141

136142
if (config.project) {
137143
browser.project = config.project;
@@ -195,7 +201,7 @@ function attachWorkerHelpers(worker) {
195201

196202
worker.buildUrl = function buildUrl(test_path) {
197203
var workerKey = workerKeys[this.id] ? workerKeys[this.id].key : null;
198-
var url = buildTestUrl(test_path || this.test_path, workerKey, this.getTestBrowserInfo());
204+
var url = buildTestUrl(test_path || this.test_path, workerKey, this.config);
199205
logger.trace('[%s] worker.buildUrl: %s', this.id, url);
200206
return url;
201207
};

tests/behaviour/runner.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ var getBaseConfig = function() {
2626
browser_version: '52.0',
2727
os: 'Windows',
2828
os_version: '7'
29+
}, {
30+
browser: 'iphone',
31+
browser_version: '',
32+
device: 'iPhone SE',
33+
os: 'ios',
34+
os_version: '11.2',
35+
real_mobile: true
2936
} ]
3037
}
3138
};
@@ -100,7 +107,7 @@ describe('Pass/Fail reporting', function() {
100107
it('report keys should have browser names', function(done) {
101108
var config = getBaseConfig();
102109
browserstackRunner.run(config, function(err, reports) {
103-
var shouldBePresentBrowsers = [ 'Windows 7, Chrome 52.0', 'Windows 7, Firefox 47.0' ];
110+
var shouldBePresentBrowsers = [ 'Windows 7, Chrome 52.0', 'Windows 7, Firefox 47.0', 'ios 11.2, Iphone '];
104111
assert.equal(err, null);
105112
reports.forEach(function(report) {
106113
var numMatched = 0;

0 commit comments

Comments
 (0)