1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Setup acceptance tests with list of UAs

This commit is contained in:
Denis Demchenko 2017-08-20 18:21:17 +03:00
parent 99fde0a154
commit 076ee810bd
3 changed files with 115 additions and 98 deletions

View File

@ -26,7 +26,8 @@
"babel-preset-env": "^1.5.2", "babel-preset-env": "^1.5.2",
"babel-register": "^6.24.1", "babel-register": "^6.24.1",
"sinon": "^2.1.0", "sinon": "^2.1.0",
"testem": "^1.16.2" "testem": "^1.16.2",
"yamljs": "^0.3.0"
}, },
"ava": { "ava": {
"require": [ "require": [
@ -42,6 +43,7 @@
}, },
"scripts": { "scripts": {
"test": "testem", "test": "testem",
"watch-tests": "./node_modules/.bin/ava --watch",
"prepublish": "make boosh" "prepublish": "make boosh"
}, },
"license": "MIT" "license": "MIT"

View File

@ -0,0 +1,16 @@
import test from 'ava';
import yaml from 'yamljs';
import path from 'path';
import Bowser from '../../src/new-bowser';
const listOfUA = yaml.load(path.join(__dirname, 'useragentstrings.yml'));
test('Check all the test browsers', t => {
for (const browserName in listOfUA) {
listOfUA[browserName].forEach((browser) => {
const parsed = new Bowser(browser.ua).parse().getResult();
t.deepEqual(parsed, browser.spec, `${browser.ua}`);
t.is(parsed.browser.name, browserName, `${browser.ua}`);
});
}
});

View File

@ -1188,6 +1188,76 @@
engine: engine:
name: "Trident" name: "Trident"
version: "7.0" version: "7.0"
-
ua: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920; Vodafone)"
spec:
browser:
name: "Internet Explorer"
version: "10.0"
os:
name: "Windows Phone"
version: "8.0"
platform:
type: "mobile"
engine:
name: "Trident"
version: "6.0"
-
ua: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)"
spec:
browser:
name: "Internet Explorer"
version: "10.0"
os:
name: "Windows Phone"
version: "8.0"
platform:
type: "mobile"
engine:
name: "Trident"
version: "6.0"
-
ua: "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)"
spec:
browser:
name: "Internet Explorer"
version: "9.0"
os:
name: "Windows Phone"
version: "7.5"
platform:
type: "mobile"
engine:
name: "Trident"
version: "5.0"
-
ua: "Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; Nokia;N70)"
spec:
browser:
name: "Internet Explorer"
version: "7.0"
os:
name: "Windows Phone"
version: "7.0"
platform:
type: "mobile"
engine:
name: "Trident"
version: "3.1"
-
ua: "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; Microsoft; Lumia 640 LTE) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537"
spec:
browser:
name: "Internet Explorer"
version: "11.0"
os:
name: "Windows Phone"
version: "8.1"
platform:
type: "mobile"
engine:
name: "Trident"
version: "7.0"
Microsoft Edge: Microsoft Edge:
- -
ua: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0" ua: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0"
@ -1204,6 +1274,20 @@
engine: engine:
name: "EdgeHTML" name: "EdgeHTML"
version: "12.0" version: "12.0"
-
ua: "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0"
spec:
browser:
name: "Microsoft Edge"
version: "12.0"
os:
name: "Windows Phone"
version: "10.0"
platform:
type: "mobile"
engine:
name: "EdgeHTML"
version: "12.0"
Firefox: Firefox:
- -
ua: "Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0" ua: "Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0"
@ -1652,92 +1736,7 @@
type: "mobile" type: "mobile"
vendor: "BlackBerry" vendor: "BlackBerry"
engine: {} engine: {}
Windows Phone: WebOS Browser:
-
ua: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920; Vodafone)"
spec:
browser:
name: "Internet Explorer"
version: "10.0"
os:
name: "Windows Phone"
version: "8.0"
platform:
type: "mobile"
engine:
name: "Trident"
version: "6.0"
-
ua: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)"
spec:
browser:
name: "Internet Explorer"
version: "10.0"
os:
name: "Windows Phone"
version: "8.0"
platform:
type: "mobile"
engine:
name: "Trident"
version: "6.0"
-
ua: "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)"
spec:
browser:
name: "Internet Explorer"
version: "9.0"
os:
name: "Windows Phone"
version: "7.5"
platform:
type: "mobile"
engine:
name: "Trident"
version: "5.0"
-
ua: "Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; Nokia;N70)"
spec:
browser:
name: "Internet Explorer"
version: "7.0"
os:
name: "Windows Phone"
version: "7.0"
platform:
type: "mobile"
engine:
name: "Trident"
version: "3.1"
-
ua: "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0"
spec:
browser:
name: "Microsoft Edge"
version: "12.0"
os:
name: "Windows Phone"
version: "10.0"
platform:
type: "mobile"
engine:
name: "EdgeHTML"
version: "12.0"
-
ua: "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; Microsoft; Lumia 640 LTE) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537"
spec:
browser:
name: "Internet Explorer"
version: "11.0"
os:
name: "Windows Phone"
version: "8.1"
platform:
type: "mobile"
engine:
name: "Trident"
version: "7.0"
WebOS:
- -
ua: "Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.5; U; en-US) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/234.83 Safari/534.6 TouchPad/1.0" ua: "Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.5; U; en-US) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/234.83 Safari/534.6 TouchPad/1.0"
spec: spec:
@ -1819,12 +1818,12 @@
engine: engine:
name: "WebKit" name: "WebKit"
version: "525.27.1" version: "525.27.1"
Android: Android Browser:
- -
ua: "Mozilla/5.0 (Linux; U; Android 4.4.2; de-de; Nexus 7 Build/KOT49H) AppleWebKit/537.16 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.16" ua: "Mozilla/5.0 (Linux; U; Android 4.4.2; de-de; Nexus 7 Build/KOT49H) AppleWebKit/537.16 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.16"
spec: spec:
browser: browser:
name: "Safari" name: "Android Browser"
version: "4.0" version: "4.0"
os: os:
name: "Android" name: "Android"
@ -1839,7 +1838,7 @@
ua: "Mozilla/5.0 (Linux; U; Android 4.3; de-de; Galaxy Nexus Build/JWR66Y) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30" ua: "Mozilla/5.0 (Linux; U; Android 4.3; de-de; Galaxy Nexus Build/JWR66Y) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"
spec: spec:
browser: browser:
name: "Safari" name: "Android Browser"
version: "4.0" version: "4.0"
os: os:
name: "Android" name: "Android"
@ -1854,7 +1853,7 @@
ua: "Mozilla/5.0 (Linux; U; Android 4.2; en-us; Nexus 10 Build/JVP15I) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30" ua: "Mozilla/5.0 (Linux; U; Android 4.2; en-us; Nexus 10 Build/JVP15I) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30"
spec: spec:
browser: browser:
name: "Safari" name: "Android Browser"
version: "4.0" version: "4.0"
os: os:
name: "Android" name: "Android"
@ -1869,7 +1868,7 @@
ua: "Mozilla/5.0 (Linux; U; Android 3.2; de-de; A100 Build/HTJ85B) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13" ua: "Mozilla/5.0 (Linux; U; Android 3.2; de-de; A100 Build/HTJ85B) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13"
spec: spec:
browser: browser:
name: "Safari" name: "Android Browser"
version: "4.0" version: "4.0"
os: os:
name: "Android" name: "Android"
@ -1883,7 +1882,7 @@
ua: "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; T-Mobile G2 Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1" ua: "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; T-Mobile G2 Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
spec: spec:
browser: browser:
name: "Safari" name: "Android Browser"
version: "4.0" version: "4.0"
os: os:
name: "Android" name: "Android"
@ -1897,7 +1896,7 @@
ua: "Mozilla/5.0 (Linux; U; Android 1.6; ar-us; SonyEricssonX10i Build/R2BA026) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1" ua: "Mozilla/5.0 (Linux; U; Android 1.6; ar-us; SonyEricssonX10i Build/R2BA026) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1"
spec: spec:
browser: browser:
name: "Safari" name: "Android Browser"
version: "3.1.2" version: "3.1.2"
os: os:
name: "Android" name: "Android"
@ -2026,8 +2025,8 @@
ua: "Mozilla/5.0 (Maemo; Linux; U; Jolla; Sailfish; Mobile; rv:26.0) Gecko/26.0 Firefox/26.0 SailfishBrowser/1.0 like Safari/538.1" ua: "Mozilla/5.0 (Maemo; Linux; U; Jolla; Sailfish; Mobile; rv:26.0) Gecko/26.0 Firefox/26.0 SailfishBrowser/1.0 like Safari/538.1"
spec: spec:
browser: browser:
name: "Firefox" name: "Sailfish"
version: "26.0" version: "1.0"
os: os:
name: "Linux" name: "Linux"
platform: platform:
@ -2039,8 +2038,8 @@
ua: "Mozilla/5.0 (Linux; U; Jolla; Sailfish; Mobile; rv:20.0) Gecko/20.0 Firefox/20.0 Sailfish Browser/1.0 like Safari/535.19" ua: "Mozilla/5.0 (Linux; U; Jolla; Sailfish; Mobile; rv:20.0) Gecko/20.0 Firefox/20.0 Sailfish Browser/1.0 like Safari/535.19"
spec: spec:
browser: browser:
name: "Firefox" name: "Sailfish"
version: "20.0" version: "1.0"
os: os:
name: "Linux" name: "Linux"
platform: platform: