Skip to content

Commit

Permalink
map: Ignore browser spec for os=android
Browse files Browse the repository at this point in the history
Generalisation of f246bb8. We'd have to map "Chrome" to "Android Browser"
as well to make it work fully, which is not practical.

Ref jquery/testswarm#306.
  • Loading branch information
Krinkle committed Mar 30, 2017
1 parent 6bf159d commit 90d4f4b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/mapHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
module.exports = {
browserFamily: {
'Yandex Browser': 'yandex',
'Android': 'Android Browser',
// Android 4.4 and higher use Chrome Mobile instead of Android Browser.
// BrowserStack supports both Chrome and Firefox on Android through
// the UI. However, the v4 API only exposes one of them (Chrome)
// but labels it "Android Browser" for back-compat.
'Chrome Mobile': 'Android Browser'
'Android': 'Android Browser'
},
osFamily: {
'Windows': 'Windows',
Expand Down
22 changes: 22 additions & 0 deletions src/testswarm-browserstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,28 @@ self = {
value = mapHelper[ key ][ value ];
}

// Android 4.3 and below have user agents typically referred to as
// "Android Browser" (or "WebView").
// Android 4.4, 5.0 and later use "Chrome Mobile".
// Android in tablet mode (including emulators) use a slightly different UA
// that doesn't mention "Mobile" that causes ua-parser to interpret it as
// regular "Chrome". Instead of hardcoding all this in TestSwarm, let them
// specify whatever for the icon on the home page and project pages.
// BrowserStack v3 and v4 APIs only provides the default browser on Android.
// In addition, the API wrongly identifies all browsers on Android as
// "Android Browser" (even the ones that use "Chrome" or "Chrome Mobile"
// in Android 4.4+). Instead of mapping all this (which would require
// complicating mapHelper to map browserFamily "Chrome" to "Android Browser",
// if and only if osFamily is "Android"), simply ignore browserFamily for
// Android and iOS.
if ( key === 'browserFamily' &&
tsUaSpec.osFamily === 'Android' &&
tsUaSpec.osMajor &&
tsUaSpec.osMinor
) {
return;
}

// Value can either be a string or regular expression (from mapHelper)
// If it doesn't match here, it is a worker for a different browser.
if ( typeof value === 'string' ) {
Expand Down

0 comments on commit 90d4f4b

Please sign in to comment.