mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
Merge pull request #1499 from tridactyl/add_testsuite
[RFC] This is a test
This commit is contained in:
commit
e722e924ac
5 changed files with 527 additions and 35 deletions
|
@ -28,15 +28,20 @@ jobs:
|
|||
- image: circleci/node:latest
|
||||
steps:
|
||||
- commoncmd
|
||||
- run: bash -c '"$(npm bin)/jest" --silent src'
|
||||
- run: bash -c '"$(npm bin)/jest" src'
|
||||
e2e:
|
||||
docker:
|
||||
- image: circleci/node:latest
|
||||
- image: circleci/node:latest-browsers
|
||||
environment:
|
||||
MOZ_HEADLESS: 1
|
||||
steps:
|
||||
- commoncmd
|
||||
- run: sudo npm i -g get-firefox
|
||||
- run: get-firefox --branch nightly --platform linux --extract --target ~/
|
||||
- run: ~/firefox/firefox -v
|
||||
- run: bash -c '"$(npm bin)/web-ext" build --source-dir ./build --overwrite-dest'
|
||||
- run: mv web-ext-artifacts/*.zip web-ext-artifacts/tridactyl.xpi
|
||||
- run: bash -c '"$(npm bin)/jest" --silent'
|
||||
- run: bash -c 'PATH="$HOME/firefox:$PATH" "$(npm bin)/jest"'
|
||||
workflows:
|
||||
version: 2
|
||||
build_test_lint:
|
||||
|
|
325
package-lock.json
generated
325
package-lock.json
generated
|
@ -1096,6 +1096,15 @@
|
|||
"integrity": "sha512-fERNJX8sOXfel6qCBCMPvZLzENBEhZTzKqg6vrOW5pvoEaQuJhRU4ndTAh6lHOxn1I6jnz2NHra56ZODM751uw==",
|
||||
"dev": true
|
||||
},
|
||||
"agent-base": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz",
|
||||
"integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"es6-promisify": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"ajv": {
|
||||
"version": "6.10.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz",
|
||||
|
@ -3531,6 +3540,15 @@
|
|||
"nan": "^2.10.0"
|
||||
}
|
||||
},
|
||||
"duplexer2": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz",
|
||||
"integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"readable-stream": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"duplexer3": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
|
||||
|
@ -4785,6 +4803,15 @@
|
|||
"universalify": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"fs-minipass": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz",
|
||||
"integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minipass": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"fs-write-stream-atomic": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz",
|
||||
|
@ -4823,8 +4850,7 @@
|
|||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
|
@ -4845,14 +4871,12 @@
|
|||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -4867,20 +4891,17 @@
|
|||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
@ -4997,8 +5018,7 @@
|
|||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
@ -5010,7 +5030,6 @@
|
|||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
|
@ -5025,7 +5044,6 @@
|
|||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
|
@ -5033,14 +5051,12 @@
|
|||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
|
@ -5059,7 +5075,6 @@
|
|||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
|
@ -5140,8 +5155,7 @@
|
|||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
@ -5153,7 +5167,6 @@
|
|||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
@ -5239,8 +5252,7 @@
|
|||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
|
@ -5276,7 +5288,6 @@
|
|||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
@ -5296,7 +5307,6 @@
|
|||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
|
@ -5340,14 +5350,12 @@
|
|||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -5410,6 +5418,78 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"geckodriver": {
|
||||
"version": "1.16.2",
|
||||
"resolved": "https://registry.npmjs.org/geckodriver/-/geckodriver-1.16.2.tgz",
|
||||
"integrity": "sha512-kXZP4QferAv57Ru4Fx2WYuu//ErKJP4hPEkJm4mSETo42jsdYFwdNxwQ4vCGhf14gsCdxU9YrwNupJ8gr1GxPg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"adm-zip": "0.4.11",
|
||||
"bluebird": "3.4.6",
|
||||
"got": "5.6.0",
|
||||
"https-proxy-agent": "2.2.1",
|
||||
"tar": "4.4.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"adm-zip": {
|
||||
"version": "0.4.11",
|
||||
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.11.tgz",
|
||||
"integrity": "sha512-L8vcjDTCOIJk7wFvmlEUN7AsSb8T+2JrdP7KINBjzr24TJ5Mwj590sLu3BC7zNZowvJWa/JtPmD8eJCzdtDWjA==",
|
||||
"dev": true
|
||||
},
|
||||
"bluebird": {
|
||||
"version": "3.4.6",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.6.tgz",
|
||||
"integrity": "sha1-AdqNgh2HgT0ViWfnQ9X+bGLPjA8=",
|
||||
"dev": true
|
||||
},
|
||||
"got": {
|
||||
"version": "5.6.0",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-5.6.0.tgz",
|
||||
"integrity": "sha1-ux1+4WO3gIK7yOuDbz85UATqb78=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"create-error-class": "^3.0.1",
|
||||
"duplexer2": "^0.1.4",
|
||||
"is-plain-obj": "^1.0.0",
|
||||
"is-redirect": "^1.0.0",
|
||||
"is-retry-allowed": "^1.0.0",
|
||||
"is-stream": "^1.0.0",
|
||||
"lowercase-keys": "^1.0.0",
|
||||
"node-status-codes": "^1.0.0",
|
||||
"object-assign": "^4.0.1",
|
||||
"parse-json": "^2.1.0",
|
||||
"pinkie-promise": "^2.0.0",
|
||||
"read-all-stream": "^3.0.0",
|
||||
"readable-stream": "^2.0.5",
|
||||
"timed-out": "^2.0.0",
|
||||
"unzip-response": "^1.0.0",
|
||||
"url-parse-lax": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"parse-json": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
|
||||
"integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"error-ex": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"timed-out": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/timed-out/-/timed-out-2.0.0.tgz",
|
||||
"integrity": "sha1-84sK6B03R9YoAB9B2vxlKs5nHAo=",
|
||||
"dev": true
|
||||
},
|
||||
"unzip-response": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-1.0.2.tgz",
|
||||
"integrity": "sha1-uYTwh3/AqJwsdzzB73tbIytbBv4=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"generate-function": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
|
||||
|
@ -5878,6 +5958,33 @@
|
|||
"integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=",
|
||||
"dev": true
|
||||
},
|
||||
"https-proxy-agent": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz",
|
||||
"integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"agent-base": "^4.1.0",
|
||||
"debug": "^3.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
||||
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
|
@ -5905,6 +6012,12 @@
|
|||
"integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==",
|
||||
"dev": true
|
||||
},
|
||||
"immediate": {
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
|
||||
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=",
|
||||
"dev": true
|
||||
},
|
||||
"immutable": {
|
||||
"version": "3.8.2",
|
||||
"resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.2.tgz",
|
||||
|
@ -6260,6 +6373,12 @@
|
|||
"path-is-inside": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"is-plain-obj": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
|
||||
"integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=",
|
||||
"dev": true
|
||||
},
|
||||
"is-plain-object": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
|
||||
|
@ -7360,6 +7479,15 @@
|
|||
"type-check": "~0.3.2"
|
||||
}
|
||||
},
|
||||
"lie": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
|
||||
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"immediate": "~3.0.5"
|
||||
}
|
||||
},
|
||||
"load-json-file": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
|
||||
|
@ -7799,6 +7927,33 @@
|
|||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"dev": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz",
|
||||
"integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"minizlib": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz",
|
||||
"integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minipass": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"mississippi": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz",
|
||||
|
@ -8197,6 +8352,12 @@
|
|||
"which": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"node-status-codes": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-status-codes/-/node-status-codes-1.0.0.tgz",
|
||||
"integrity": "sha1-WuVUHQJGRdMqWPzdyc7s6nrjrC8=",
|
||||
"dev": true
|
||||
},
|
||||
"nomnom": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz",
|
||||
|
@ -9104,6 +9265,16 @@
|
|||
"integrity": "sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==",
|
||||
"dev": true
|
||||
},
|
||||
"read-all-stream": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/read-all-stream/-/read-all-stream-3.1.0.tgz",
|
||||
"integrity": "sha1-NcPhd/IHjveJ7kv6+kNzB06u9Po=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pinkie-promise": "^2.0.0",
|
||||
"readable-stream": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"read-pkg": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
|
||||
|
@ -9606,6 +9777,71 @@
|
|||
"ajv-keywords": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"selenium-webdriver": {
|
||||
"version": "4.0.0-alpha.1",
|
||||
"resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.0.0-alpha.1.tgz",
|
||||
"integrity": "sha512-z88rdjHAv3jmTZ7KSGUkTvo4rGzcDGMq0oXWHNIDK96Gs31JKVdu9+FMtT4KBrVoibg8dUicJDok6GnqqttO5Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jszip": "^3.1.3",
|
||||
"rimraf": "^2.5.4",
|
||||
"tmp": "0.0.30",
|
||||
"xml2js": "^0.4.17"
|
||||
},
|
||||
"dependencies": {
|
||||
"jszip": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.2.1.tgz",
|
||||
"integrity": "sha512-iCMBbo4eE5rb1VCpm5qXOAaUiRKRUKiItn8ah2YQQx9qymmSAY98eyQfioChEYcVQLh0zxJ3wS4A0mh90AVPvw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lie": "~3.3.0",
|
||||
"pako": "~1.0.2",
|
||||
"readable-stream": "~2.3.6",
|
||||
"set-immediate-shim": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
|
||||
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
|
||||
"dev": true
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"tmp": {
|
||||
"version": "0.0.30",
|
||||
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.30.tgz",
|
||||
"integrity": "sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"os-tmpdir": "~1.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.6.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
|
||||
|
@ -9647,6 +9883,12 @@
|
|||
"to-object-path": "^0.3.0"
|
||||
}
|
||||
},
|
||||
"set-immediate-shim": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz",
|
||||
"integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=",
|
||||
"dev": true
|
||||
},
|
||||
"set-value": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz",
|
||||
|
@ -10459,6 +10701,29 @@
|
|||
"integrity": "sha512-dQRhbNQkRnaqauC7WqSJ21EEksgT0fYZX2lqXzGkpo8JNig9zGZTYoMGvyI2nWmXlE2VSVXVDu7wLVGu/mQEsg==",
|
||||
"dev": true
|
||||
},
|
||||
"tar": {
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.2.tgz",
|
||||
"integrity": "sha512-BfkE9CciGGgDsATqkikUHrQrraBCO+ke/1f6SFAEMnxyyfN9lxC+nW1NFWMpqH865DhHIy9vQi682gk1X7friw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chownr": "^1.0.1",
|
||||
"fs-minipass": "^1.2.5",
|
||||
"minipass": "^2.2.4",
|
||||
"minizlib": "^1.1.0",
|
||||
"mkdirp": "^0.5.0",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"tar-stream": {
|
||||
"version": "1.6.2",
|
||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz",
|
||||
|
|
|
@ -19,10 +19,12 @@
|
|||
"awesome-typescript-loader": "^5.2.1",
|
||||
"cleanslate": "^0.10.1",
|
||||
"copy-webpack-plugin": "^5.0.3",
|
||||
"geckodriver": "^1.16.2",
|
||||
"jest": "^24.8.0",
|
||||
"marked": "^0.6.2",
|
||||
"nearley": "^2.16.0",
|
||||
"prettier": "^1.17.1",
|
||||
"selenium-webdriver": "^4.0.0-alpha.1",
|
||||
"shared-git-hooks": "^1.2.1",
|
||||
"source-map-loader": "^0.2.4",
|
||||
"ts-jest": "^24.0.2",
|
||||
|
@ -45,7 +47,7 @@
|
|||
"run": "web-ext run -s build/ -u 'txti.es'",
|
||||
"watch": "echo 'watch is broken, use build instead'; exit 0;",
|
||||
"clean": "rm -rf build generated",
|
||||
"test": "npm run build && jest --silent",
|
||||
"test": "npm run build && rm -rf web-ext-artifacts/* && web-ext build --source-dir ./build --overwrite-dest && mv web-ext-artifacts/*.zip web-ext-artifacts/tridactyl.xpi && jest --silent",
|
||||
"update-buildsystem": "rm -rf src/node_modules; npm run clean",
|
||||
"lint": "bash hooks/pre-commit",
|
||||
"pretty": "bash scripts/pretty"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Accepts no arguments
|
||||
# Returns git-add'ed files as a list of filenames separated by a newline character
|
||||
cachedTSLintFiles() {
|
||||
git diff --cached --name-only --diff-filter=ACM "*.js" "*.jsx" "*.ts" "*.tsx" ":(exclude)*.d.ts"
|
||||
git diff --cached --name-only --diff-filter=ACM "*.js" "*.jsx" "*.ts" "*.tsx" ":(exclude)*.d.ts" ":(exclude)tests/*"
|
||||
}
|
||||
|
||||
# Accepts no arguments
|
||||
|
|
220
tests/excmds.test.ts
Normal file
220
tests/excmds.test.ts
Normal file
|
@ -0,0 +1,220 @@
|
|||
require("geckodriver")
|
||||
|
||||
const fs = require("fs")
|
||||
const webdriver = require("selenium-webdriver")
|
||||
const Options = require("selenium-webdriver/firefox").Options
|
||||
|
||||
jest.setTimeout(20000)
|
||||
|
||||
// API docs because I waste too much time looking for them every time I go back to this:
|
||||
// https://seleniumhq.github.io/selenium/docs/api/javascript/
|
||||
|
||||
const vimToSelenium = {
|
||||
"Down": webdriver.Key.ARROW_DOWN,
|
||||
"Left": webdriver.Key.ARROW_LEFT,
|
||||
"Right": webdriver.Key.ARROW_RIGHT,
|
||||
"Up": webdriver.Key.ARROW_UP,
|
||||
"BS": webdriver.Key.BACK_SPACE,
|
||||
"Del": webdriver.Key.DELETE,
|
||||
"End": webdriver.Key.END,
|
||||
"CR": webdriver.Key.ENTER,
|
||||
"Esc": webdriver.Key.ESCAPE,
|
||||
"Home": webdriver.Key.HOME,
|
||||
"PageDown": webdriver.Key.PAGE_DOWN,
|
||||
"PageUp": webdriver.Key.PAGE_UP,
|
||||
"Tab": webdriver.Key.TAB,
|
||||
"lt": "<",
|
||||
}
|
||||
|
||||
const modToSelenium = {
|
||||
"A": webdriver.Key.ALT,
|
||||
"C": webdriver.Key.CONTROL,
|
||||
"M": webdriver.Key.META,
|
||||
"S": webdriver.Key.SHIFT,
|
||||
}
|
||||
|
||||
function translateKeys(string) {
|
||||
return string.replace(/<([^>-]+)-?([^>]*)>/g, (wholematch, modifier, key, pos, str) => {
|
||||
// There only is a modifier if 'key' isn't empty (<Up> = no modifier)
|
||||
if (key.length > 0) {
|
||||
return webdriver.Key.chord(
|
||||
...(modifier.split("").map(m => modToSelenium[m])),
|
||||
(vimToSelenium[key] || key),
|
||||
webdriver.Key.NULL,
|
||||
)
|
||||
}
|
||||
return vimToSelenium[modifier] || modifier
|
||||
})
|
||||
}
|
||||
|
||||
function sendKeys (driver, keys) {
|
||||
return translateKeys(keys).split("")
|
||||
.reduce((prom, key) => {
|
||||
return prom.then(_ => driver.wait(driver.switchTo().activeElement()))
|
||||
.then(elem => elem.sendKeys(key))
|
||||
.then(_ => driver.sleep(10))
|
||||
}, Promise.resolve())
|
||||
}
|
||||
|
||||
describe("webdriver", () => {
|
||||
async function getDriver() {
|
||||
const dir = "web-ext-artifacts"
|
||||
const extensionName = "tridactyl.xpi"
|
||||
const extensionPath = dir + "/" + extensionName
|
||||
const driver = new webdriver.Builder()
|
||||
.forBrowser("firefox")
|
||||
.setFirefoxOptions((new Options())
|
||||
.setPreference("xpinstall.signatures.required", false)
|
||||
.addExtensions(extensionPath))
|
||||
.build()
|
||||
// Wait until addon is loaded and :tutor is displayed
|
||||
await driver.wait(webdriver.until.elementLocated(webdriver.By.id("cmdline_iframe")))
|
||||
// And wait a bit more otherwise Tridactyl won't be happy
|
||||
await driver.sleep(500)
|
||||
return driver
|
||||
}
|
||||
|
||||
async function killDriver(driver) {
|
||||
try {
|
||||
await driver.close()
|
||||
} catch(e) {}
|
||||
try {
|
||||
await driver.quit()
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
async function untilTabUrlMatches(driver, tabId, pattern) {
|
||||
let match
|
||||
do {
|
||||
match = (await driver.executeScript(`return tri.browserBg.tabs.get(${tabId})`))
|
||||
.url
|
||||
.match(pattern)
|
||||
} while (!match)
|
||||
return match
|
||||
}
|
||||
|
||||
async function newTabWithoutChangingOldTabs (driver, callback) {
|
||||
const tabsBefore = await driver.executeScript("return tri.browserBg.tabs.query({})")
|
||||
const result = await callback(tabsBefore);
|
||||
const tabsAfter = await driver.wait(async () => {
|
||||
let tabsAfter
|
||||
do {
|
||||
tabsAfter = await driver.executeScript("return tri.browserBg.tabs.query({})")
|
||||
} while (tabsAfter.length == tabsBefore.length)
|
||||
return tabsAfter
|
||||
})
|
||||
// A single new tab has been created
|
||||
expect(tabsAfter.length).toBe(tabsBefore.length + 1)
|
||||
|
||||
// None of the previous tabs changed, except maybe for their index
|
||||
const newtab = tabsAfter.find(tab2 => !tabsBefore.find(tab => tab.id == tab2.id))
|
||||
const notNewTabs = tabsAfter.slice()
|
||||
notNewTabs.splice(tabsAfter.findIndex(tab => tab == newtab), 1)
|
||||
const ignoreValues = {
|
||||
active: false, // the previously-active tab isn't necessarily active anymore
|
||||
highlighted: true, // changing tabs changes highlights
|
||||
index: 0, // indexes might not be the same depending on whether the new tab is
|
||||
lastAccessed: 0, // lastAccessed has also changed for the previously-active tab
|
||||
}
|
||||
for (let i = 0; i < tabsBefore.length; ++i) {
|
||||
let copy1 = Object.assign({}, tabsBefore[i], ignoreValues)
|
||||
let copy2 = Object.assign({}, notNewTabs[i], ignoreValues)
|
||||
expect(copy1).toEqual(copy2)
|
||||
}
|
||||
return [newtab, result]
|
||||
}
|
||||
|
||||
test("`:tabopen<CR>` opens the newtab page.", async () => {
|
||||
const driver = await getDriver()
|
||||
return newTabWithoutChangingOldTabs(driver, async (tabsBefore) => {
|
||||
await sendKeys(driver, ":tabopen<CR>")
|
||||
}).then(async ([newtab, _]) => {
|
||||
// The new tab is active
|
||||
expect(newtab.active).toEqual(true)
|
||||
// Its url is the newtab page's url
|
||||
await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("moz-extension://.*/static/newtab.html")), 10000)
|
||||
}).finally(() => killDriver(driver))
|
||||
})
|
||||
|
||||
test("`:tabopen https://example.org<CR>` opens example.org.", async () => {
|
||||
const driver = await getDriver()
|
||||
return newTabWithoutChangingOldTabs(driver, async () => {
|
||||
await sendKeys(driver, ":tabopen https://example.org<CR>")
|
||||
}).then(async ([newtab, _]) => {
|
||||
expect(newtab.active).toEqual(true)
|
||||
await driver.wait(untilTabUrlMatches(driver, newtab.id, "https://example.org"), 10000)
|
||||
}).finally(() => killDriver(driver))
|
||||
})
|
||||
|
||||
test("`:tabopen qwant https://example.org<CR>` opens qwant.", async () => {
|
||||
const driver = await getDriver()
|
||||
return newTabWithoutChangingOldTabs(driver, async () => {
|
||||
await sendKeys(driver, ":tabopen qwant https://example.org<CR>")
|
||||
}).then(async ([newtab, _]) => {
|
||||
expect(newtab.active).toEqual(true)
|
||||
await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.qwant.com/.*example.org")), 10000)
|
||||
}).finally(() => killDriver(driver))
|
||||
})
|
||||
|
||||
test("`:tabopen test<CR>` opens google.", async () => {
|
||||
const driver = await getDriver()
|
||||
return newTabWithoutChangingOldTabs(driver, async () => {
|
||||
await sendKeys(driver, ":tabopen test<CR>")
|
||||
}).then(async ([newtab, _]) => {
|
||||
expect(newtab.active).toEqual(true)
|
||||
await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.google.com/.*test")), 10000)
|
||||
}).finally(() => killDriver(driver))
|
||||
})
|
||||
|
||||
test("`:tabopen example.org<CR>` opens example.org.", async () => {
|
||||
const driver = await getDriver()
|
||||
return newTabWithoutChangingOldTabs(driver, async () => {
|
||||
await sendKeys(driver, ":tabopen example.org<CR>")
|
||||
}).then(async ([newtab, _]) => {
|
||||
expect(newtab.active).toEqual(true)
|
||||
await driver.wait(untilTabUrlMatches(driver, newtab.id, "example.org"), 10000)
|
||||
}).finally(() => killDriver(driver))
|
||||
})
|
||||
|
||||
test("`:tabopen search duckduckgo<CR>` opens google.", async () => {
|
||||
const driver = await getDriver()
|
||||
return newTabWithoutChangingOldTabs(driver, async () => {
|
||||
await sendKeys(driver, ":tabopen search duckduckgo<CR>")
|
||||
}).then(async ([newtab, _]) => {
|
||||
expect(newtab.active).toEqual(true)
|
||||
await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.google.com/search.*duckduckgo")), 10000)
|
||||
}).finally(() => killDriver(driver))
|
||||
})
|
||||
|
||||
test("`:tabopen -b about:blank<CR>` opens a background tab.", async () => {
|
||||
const driver = await getDriver()
|
||||
return newTabWithoutChangingOldTabs(driver, async () => {
|
||||
await sendKeys(driver, ":tabopen -b about:blank<CR>")
|
||||
}).then(async ([newtab, _]) => {
|
||||
expect(newtab.active).toEqual(false)
|
||||
await driver.wait(untilTabUrlMatches(driver, newtab.id, "about:blank"))
|
||||
}).finally(() => killDriver(driver))
|
||||
})
|
||||
|
||||
test("`:tabopen -c work about:blank<CR>` opens about:blank in a container.", async () => {
|
||||
const driver = await getDriver()
|
||||
return newTabWithoutChangingOldTabs(driver, async () => {
|
||||
await sendKeys(driver, ":tabopen -c work about:blank<CR>")
|
||||
}).then(async ([newtab, _]) => {
|
||||
expect(newtab.active).toEqual(true)
|
||||
expect(newtab.cookieStoreId).toMatch("firefox-container-")
|
||||
await driver.wait(untilTabUrlMatches(driver, newtab.id, "about:blank"))
|
||||
}).finally(() => killDriver(driver))
|
||||
})
|
||||
|
||||
test("`:tabopen -b -c work search qwant<CR>` opens about:blank in a container.", async () => {
|
||||
const driver = await getDriver()
|
||||
return newTabWithoutChangingOldTabs(driver, async () => {
|
||||
await sendKeys(driver, ":tabopen -b -c work search qwant<CR>")
|
||||
}).then(async ([newtab, _]) => {
|
||||
expect(newtab.active).toEqual(false)
|
||||
expect(newtab.cookieStoreId).toMatch("firefox-container-")
|
||||
await driver.wait(untilTabUrlMatches(driver, newtab.id, new RegExp("^https://www.google.com/search.*qwant")))
|
||||
}).finally(() => killDriver(driver))
|
||||
})
|
||||
})
|
Loading…
Add table
Reference in a new issue