aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.eslintrc.js2
-rw-r--r--.github/workflows/browserstack.yml34
-rw-r--r--jest.config.js2
-rw-r--r--package-lock.json432
-rw-r--r--package.json6
-rw-r--r--test/selenium.test.ts149
6 files changed, 558 insertions, 67 deletions
diff --git a/.eslintrc.js b/.eslintrc.js
index 64b64a12..b6264a34 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -3,6 +3,8 @@ module.exports = {
browser: true,
es2021: true,
node: true,
+ jest: true,
+ jasmine: true,
},
extends: [
"eslint:recommended",
diff --git a/.github/workflows/browserstack.yml b/.github/workflows/browserstack.yml
new file mode 100644
index 00000000..9a9abee4
--- /dev/null
+++ b/.github/workflows/browserstack.yml
@@ -0,0 +1,34 @@
+name: 'BrowserStack Test'
+on: [push, pull_request]
+jobs:
+ ubuntu-job:
+ name: 'BrowserStack Test on Ubuntu'
+ runs-on: ubuntu-latest # Can be self-hosted runner also
+ steps:
+ - name: 'BrowserStack Env Setup' # Invokes the setup-env action
+ uses: browserstack/github-actions/setup-env@master
+ with:
+ username: ${{ secrets.BROWSERSTACK_USERNAME }}
+ access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
+ - name: 'BrowserStack Local Tunnel Setup' # Invokes the setup-local action
+ uses: browserstack/github-actions/setup-local@master
+ with:
+ local-testing: start
+ local-identifier: random
+ # The next 3 steps are for building the web application to be tested and starting the web server on the runner environment
+ - name: 'Checkout the repository'
+ uses: actions/checkout@v2
+
+ - name: Copy configuration
+ run: cp config.json.example config.json
+
+ - name: 'Building web application to be tested'
+ run: npm install
+ # - name: 'Running application under test'
+ # run: npm test
+ - name: 'Running test on BrowserStack'
+ run: npm test
+ - name: 'BrowserStackLocal Stop' # Terminating the BrowserStackLocal tunnel connection
+ uses: browserstack/github-actions/setup-local@master
+ with:
+ local-testing: stop \ No newline at end of file
diff --git a/jest.config.js b/jest.config.js
index 641bafac..a1ba3f09 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,6 +1,6 @@
module.exports = {
"roots": [
- "src"
+ "test"
],
"transform": {
"^.+\\.ts$": "ts-jest"
diff --git a/package-lock.json b/package-lock.json
index e578aedf..a508d3e8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,7 @@
"dependencies": {
"@types/react": "^16.9.22",
"@types/react-dom": "^16.9.5",
+ "@types/selenium-webdriver": "^4.0.15",
"babel": "^6.23.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.6",
@@ -31,6 +32,7 @@
"@types/jquery": "^3.3.31",
"@typescript-eslint/eslint-plugin": "^4.9.1",
"@typescript-eslint/parser": "^4.9.1",
+ "chromedriver": "^92.0.0",
"copy-webpack-plugin": "^6.0.3",
"eslint": "^7.15.0",
"eslint-plugin-react": "^7.21.5",
@@ -44,6 +46,7 @@
=======
"jest": "^27.0.6",
"rimraf": "^3.0.0",
+ "selenium-webdriver": "^4.0.0-beta.4",
"ts-jest": "^27.0.3",
"ts-loader": "^6.2.1",
"typescript": "~4.3",
@@ -22025,6 +22028,12 @@
"node": ">=6"
}
},
+ "node_modules/@testim/chrome-version": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/@testim/chrome-version/-/chrome-version-1.0.7.tgz",
+ "integrity": "sha512-8UT/J+xqCYfn3fKtOznAibsHpiuDshCb0fwgWxRazTT19Igp9ovoXMPhXyLD6m3CKQGTMHgqoxaFfMWaL40Rnw==",
+ "dev": true
+ },
"node_modules/@tootallnate/once": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
@@ -22235,6 +22244,11 @@
"@types/react": "*"
}
},
+ "node_modules/@types/selenium-webdriver": {
+ "version": "4.0.15",
+ "resolved": "https://registry.npmjs.org/@types/selenium-webdriver/-/selenium-webdriver-4.0.15.tgz",
+ "integrity": "sha512-5760PIZkzhPejy3hsKAdCKe5LJygGdxLKOLxmZL9GEUcFlO5OgzM6G2EbdbvOnaw4xvUSa9Uip6Ipwkih12BPA=="
+ },
"node_modules/@types/sizzle": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz",
@@ -23564,6 +23578,15 @@
"integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==",
"dev": true
},
+ "node_modules/axios": {
+ "version": "0.21.1",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
+ "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
+ "dev": true,
+ "dependencies": {
+ "follow-redirects": "^1.10.0"
+ }
+ },
"node_modules/babel": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel/-/babel-6.23.0.tgz",
@@ -25415,6 +25438,28 @@
"node": ">=6.0"
}
},
+ "node_modules/chromedriver": {
+ "version": "92.0.0",
+ "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-92.0.0.tgz",
+ "integrity": "sha512-IdJ5n5jLL6tCsGQF/fQHF2gDEhVzoYIqktUn6hE/BSsXlCcyDTi45fQbhTEhZlmshM8+BpnRtPuIT5DRbxNqKg==",
+ "dev": true,
+ "hasInstallScript": true,
+ "dependencies": {
+ "@testim/chrome-version": "^1.0.7",
+ "axios": "^0.21.1",
+ "del": "^6.0.0",
+ "extract-zip": "^2.0.1",
+ "https-proxy-agent": "^5.0.0",
+ "proxy-from-env": "^1.1.0",
+ "tcp-port-used": "^1.0.1"
+ },
+ "bin": {
+ "chromedriver": "bin/chromedriver"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/ci-info": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
@@ -26176,21 +26221,6 @@
"node": ">=8"
}
},
- "node_modules/copy-webpack-plugin/node_modules/rimraf": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
- "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
- "dev": true,
- "dependencies": {
- "glob": "^7.1.3"
- },
- "bin": {
- "rimraf": "bin.js"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
"node_modules/copy-webpack-plugin/node_modules/schema-utils": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz",
@@ -26425,12 +26455,19 @@
"dev": true
},
"node_modules/debug": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
- "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
- "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)",
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
+ "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
"dependencies": {
- "ms": "^2.1.1"
+ "ms": "2.1.2"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
}
},
"node_modules/decamelize": {
@@ -26777,6 +26814,37 @@
"node": ">=0.10.0"
}
},
+ "node_modules/del": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/del/-/del-6.0.0.tgz",
+ "integrity": "sha512-1shh9DQ23L16oXSZKB2JxpL7iMy2E0S9d517ptA1P8iw0alkPtQcrKH7ru31rYtKwF499HkTu+DRzq3TCKDFRQ==",
+ "dev": true,
+ "dependencies": {
+ "globby": "^11.0.1",
+ "graceful-fs": "^4.2.4",
+ "is-glob": "^4.0.1",
+ "is-path-cwd": "^2.2.0",
+ "is-path-inside": "^3.0.2",
+ "p-map": "^4.0.0",
+ "rimraf": "^3.0.2",
+ "slash": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/del/node_modules/slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@@ -28330,6 +28398,41 @@
"node": ">=0.10.0"
}
},
+ "node_modules/extract-zip": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
+ "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
+ "dev": true,
+ "dependencies": {
+ "debug": "^4.1.1",
+ "get-stream": "^5.1.0",
+ "yauzl": "^2.10.0"
+ },
+ "bin": {
+ "extract-zip": "cli.js"
+ },
+ "engines": {
+ "node": ">= 10.17.0"
+ },
+ "optionalDependencies": {
+ "@types/yauzl": "^2.9.1"
+ }
+ },
+ "node_modules/extract-zip/node_modules/get-stream": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
+ "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
+ "dev": true,
+ "dependencies": {
+ "pump": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
@@ -28719,21 +28822,6 @@
"node": "^10.12.0 || >=12.0.0"
}
},
- "node_modules/flat-cache/node_modules/rimraf": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
- "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
- "dev": true,
- "dependencies": {
- "glob": "^7.1.3"
- },
- "bin": {
- "rimraf": "bin.js"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
"node_modules/flatstr": {
"version": "1.0.12",
"resolved": "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz",
@@ -28764,6 +28852,26 @@
"readable-stream": "^2.3.6"
}
},
+ "node_modules/follow-redirects": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz",
+ "integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
"node_modules/for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
@@ -29768,6 +29876,15 @@
"url": "https://github.com/sindresorhus/invert-kv?sponsor=1"
}
},
+ "node_modules/ip-regex": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz",
+ "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
@@ -30106,6 +30223,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-path-cwd": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
+ "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/is-path-inside": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
@@ -30218,6 +30344,12 @@
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
"dev": true
},
+ "node_modules/is-url": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz",
+ "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==",
+ "dev": true
+ },
"node_modules/is-utf8": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
@@ -30250,6 +30382,20 @@
"integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==",
"dev": true
},
+ "node_modules/is2": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/is2/-/is2-2.0.7.tgz",
+ "integrity": "sha512-4vBQoURAXC6hnLFxD4VW7uc04XiwTTl/8ydYJxKvPwkWQrSjInkuM5VZVg6BGr1/natq69zDuvO9lGpLClJqvA==",
+ "dev": true,
+ "dependencies": {
+ "deep-is": "^0.1.3",
+ "ip-regex": "^4.1.0",
+ "is-url": "^1.2.4"
+ },
+ "engines": {
+ "node": ">=v0.10.0"
+ }
+ },
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
@@ -36718,6 +36864,12 @@
"node": ">= 0.10"
}
},
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
+ "dev": true
+ },
"node_modules/prr": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
@@ -37332,9 +37484,9 @@
}
},
"node_modules/rimraf": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.1.tgz",
- "integrity": "sha512-IQ4ikL8SjBiEDZfk+DFVwqRK8md24RWMEJkdSlgNLkyyAImcjf8SWvU1qFMDOb4igBClbTQ/ugPqXcRwdFTxZw==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"dependencies": {
"glob": "^7.1.3"
@@ -37470,6 +37622,21 @@
"seek-table": "bin/seek-bzip-table"
}
},
+ "node_modules/selenium-webdriver": {
+ "version": "4.0.0-beta.4",
+ "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.0.0-beta.4.tgz",
+ "integrity": "sha512-+s/CIYkWzmnC9WASBxxVj7Lm0dcyl6OaFxwIJaFCT5WCuACiimEEr4lUnOOFP/QlKfkDQ56m+aRczaq2EvJEJg==",
+ "dev": true,
+ "dependencies": {
+ "jszip": "^3.6.0",
+ "rimraf": "^3.0.2",
+ "tmp": "^0.2.1",
+ "ws": ">=7.4.6"
+ },
+ "engines": {
+ "node": ">= 10.15.0"
+ }
+ },
"node_modules/semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@@ -38735,6 +38902,16 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
},
+ "node_modules/tcp-port-used": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/tcp-port-used/-/tcp-port-used-1.0.2.tgz",
+ "integrity": "sha512-l7ar8lLUD3XS1V2lfoJlCBaeoaWo/2xfYt81hM7VlvR4RrMVFqfmzfhLVk40hAb368uitje5gPtBRL1m/DGvLA==",
+ "dev": true,
+ "dependencies": {
+ "debug": "4.3.1",
+ "is2": "^2.0.6"
+ }
+ },
"node_modules/terminal-link": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz",
@@ -42228,6 +42405,12 @@
"defer-to-connect": "^1.0.1"
}
},
+ "@testim/chrome-version": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/@testim/chrome-version/-/chrome-version-1.0.7.tgz",
+ "integrity": "sha512-8UT/J+xqCYfn3fKtOznAibsHpiuDshCb0fwgWxRazTT19Igp9ovoXMPhXyLD6m3CKQGTMHgqoxaFfMWaL40Rnw==",
+ "dev": true
+ },
"@tootallnate/once": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
@@ -42435,6 +42618,11 @@
"@types/react": "*"
}
},
+ "@types/selenium-webdriver": {
+ "version": "4.0.15",
+ "resolved": "https://registry.npmjs.org/@types/selenium-webdriver/-/selenium-webdriver-4.0.15.tgz",
+ "integrity": "sha512-5760PIZkzhPejy3hsKAdCKe5LJygGdxLKOLxmZL9GEUcFlO5OgzM6G2EbdbvOnaw4xvUSa9Uip6Ipwkih12BPA=="
+ },
"@types/sizzle": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz",
@@ -43475,6 +43663,15 @@
"integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==",
"dev": true
},
+ "axios": {
+ "version": "0.21.1",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
+ "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
+ "dev": true,
+ "requires": {
+ "follow-redirects": "^1.10.0"
+ }
+ },
"babel": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel/-/babel-6.23.0.tgz",
@@ -45084,6 +45281,21 @@
"tslib": "^1.9.0"
}
},
+ "chromedriver": {
+ "version": "92.0.0",
+ "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-92.0.0.tgz",
+ "integrity": "sha512-IdJ5n5jLL6tCsGQF/fQHF2gDEhVzoYIqktUn6hE/BSsXlCcyDTi45fQbhTEhZlmshM8+BpnRtPuIT5DRbxNqKg==",
+ "dev": true,
+ "requires": {
+ "@testim/chrome-version": "^1.0.7",
+ "axios": "^0.21.1",
+ "del": "^6.0.0",
+ "extract-zip": "^2.0.1",
+ "https-proxy-agent": "^5.0.0",
+ "proxy-from-env": "^1.1.0",
+ "tcp-port-used": "^1.0.1"
+ }
+ },
"ci-info": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
@@ -45693,15 +45905,6 @@
"find-up": "^4.0.0"
}
},
- "rimraf": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
- "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
- "dev": true,
- "requires": {
- "glob": "^7.1.3"
- }
- },
"schema-utils": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz",
@@ -45903,11 +46106,11 @@
"dev": true
},
"debug": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
- "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
+ "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
"requires": {
- "ms": "^2.1.1"
+ "ms": "2.1.2"
}
},
"decamelize": {
@@ -46193,6 +46396,30 @@
}
}
},
+ "del": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/del/-/del-6.0.0.tgz",
+ "integrity": "sha512-1shh9DQ23L16oXSZKB2JxpL7iMy2E0S9d517ptA1P8iw0alkPtQcrKH7ru31rYtKwF499HkTu+DRzq3TCKDFRQ==",
+ "dev": true,
+ "requires": {
+ "globby": "^11.0.1",
+ "graceful-fs": "^4.2.4",
+ "is-glob": "^4.0.1",
+ "is-path-cwd": "^2.2.0",
+ "is-path-inside": "^3.0.2",
+ "p-map": "^4.0.0",
+ "rimraf": "^3.0.2",
+ "slash": "^3.0.0"
+ },
+ "dependencies": {
+ "slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "dev": true
+ }
+ }
+ },
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@@ -47399,6 +47626,29 @@
}
}
},
+ "extract-zip": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
+ "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
+ "dev": true,
+ "requires": {
+ "@types/yauzl": "^2.9.1",
+ "debug": "^4.1.1",
+ "get-stream": "^5.1.0",
+ "yauzl": "^2.10.0"
+ },
+ "dependencies": {
+ "get-stream": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
+ "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
+ "dev": true,
+ "requires": {
+ "pump": "^3.0.0"
+ }
+ }
+ }
+ },
"extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
@@ -47721,17 +47971,6 @@
"requires": {
"flatted": "^3.1.0",
"rimraf": "^3.0.2"
- },
- "dependencies": {
- "rimraf": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
- "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
- "dev": true,
- "requires": {
- "glob": "^7.1.3"
- }
- }
}
},
"flatstr": {
@@ -47761,6 +48000,12 @@
"readable-stream": "^2.3.6"
}
},
+ "follow-redirects": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz",
+ "integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==",
+ "dev": true
+ },
"for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
@@ -48546,6 +48791,12 @@
"integrity": "sha512-CYdFeFexxhv/Bcny+Q0BfOV+ltRlJcd4BBZBYFX/O0u4npJrgZtIcjokegtiSMAvlMTJ+Koq0GBCc//3bueQxw==",
"dev": true
},
+ "ip-regex": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz",
+ "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==",
+ "dev": true
+ },
"ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
@@ -48781,6 +49032,12 @@
"dev": true,
"peer": true
},
+ "is-path-cwd": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
+ "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==",
+ "dev": true
+ },
"is-path-inside": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
@@ -48857,6 +49114,12 @@
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
"dev": true
},
+ "is-url": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz",
+ "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==",
+ "dev": true
+ },
"is-utf8": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
@@ -48883,6 +49146,17 @@
"integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==",
"dev": true
},
+ "is2": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/is2/-/is2-2.0.7.tgz",
+ "integrity": "sha512-4vBQoURAXC6hnLFxD4VW7uc04XiwTTl/8ydYJxKvPwkWQrSjInkuM5VZVg6BGr1/natq69zDuvO9lGpLClJqvA==",
+ "dev": true,
+ "requires": {
+ "deep-is": "^0.1.3",
+ "ip-regex": "^4.1.0",
+ "is-url": "^1.2.4"
+ }
+ },
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
@@ -53936,6 +54210,12 @@
"ipaddr.js": "1.9.1"
}
},
+ "proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
+ "dev": true
+ },
"prr": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
@@ -54438,9 +54718,9 @@
"dev": true
},
"rimraf": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.1.tgz",
- "integrity": "sha512-IQ4ikL8SjBiEDZfk+DFVwqRK8md24RWMEJkdSlgNLkyyAImcjf8SWvU1qFMDOb4igBClbTQ/ugPqXcRwdFTxZw==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"requires": {
"glob": "^7.1.3"
@@ -54557,6 +54837,18 @@
"commander": "^2.8.1"
}
},
+ "selenium-webdriver": {
+ "version": "4.0.0-beta.4",
+ "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.0.0-beta.4.tgz",
+ "integrity": "sha512-+s/CIYkWzmnC9WASBxxVj7Lm0dcyl6OaFxwIJaFCT5WCuACiimEEr4lUnOOFP/QlKfkDQ56m+aRczaq2EvJEJg==",
+ "dev": true,
+ "requires": {
+ "jszip": "^3.6.0",
+ "rimraf": "^3.0.2",
+ "tmp": "^0.2.1",
+ "ws": ">=7.4.6"
+ }
+ },
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@@ -55597,6 +55889,16 @@
"xtend": "^4.0.0"
}
},
+ "tcp-port-used": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/tcp-port-used/-/tcp-port-used-1.0.2.tgz",
+ "integrity": "sha512-l7ar8lLUD3XS1V2lfoJlCBaeoaWo/2xfYt81hM7VlvR4RrMVFqfmzfhLVk40hAb368uitje5gPtBRL1m/DGvLA==",
+ "dev": true,
+ "requires": {
+ "debug": "4.3.1",
+ "is2": "^2.0.6"
+ }
+ },
"terminal-link": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz",
diff --git a/package.json b/package.json
index 26776c9f..2f59a888 100644
--- a/package.json
+++ b/package.json
@@ -6,6 +6,7 @@
"dependencies": {
"@types/react": "^16.9.22",
"@types/react-dom": "^16.9.5",
+ "@types/selenium-webdriver": "^4.0.15",
"babel": "^6.23.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.6",
@@ -21,11 +22,13 @@
"@types/jquery": "^3.3.31",
"@typescript-eslint/eslint-plugin": "^4.9.1",
"@typescript-eslint/parser": "^4.9.1",
+ "chromedriver": "^92.0.0",
"copy-webpack-plugin": "^6.0.3",
"eslint": "^7.15.0",
"eslint-plugin-react": "^7.21.5",
"jest": "^27.0.6",
"rimraf": "^3.0.0",
+ "selenium-webdriver": "^4.0.0-beta.4",
"ts-jest": "^27.0.3",
"ts-loader": "^6.2.1",
"typescript": "~4.3",
@@ -53,7 +56,8 @@
"dev:firefox": "npm run build:dev:firefox && concurrently \"npm run web-run:firefox\" \"npm run build:watch:firefox\"",
"dev:firefox-android": "npm run build:dev:firefox && concurrently \"npm run web-run:firefox-android\" \"npm run build:watch:firefox\"",
"clean": "rimraf dist",
- "test": "npx jest",
+ "test": "npm run build:chrome && npx jest",
+ "test-without-building": "npx jest",
"lint": "eslint src",
"lint:fix": "eslint src --fix"
},
diff --git a/test/selenium.test.ts b/test/selenium.test.ts
new file mode 100644
index 00000000..397552f2
--- /dev/null
+++ b/test/selenium.test.ts
@@ -0,0 +1,149 @@
+import { Builder, By, until, WebDriver } from "selenium-webdriver";
+import * as Chrome from "selenium-webdriver/chrome";
+import * as Path from "path";
+
+test("Selenium Chrome test", async () => {
+ const driver = await setup();
+
+ try {
+ await waitForInstall(driver);
+ // This video has no ads
+ await goToVideo(driver, "jNQXAC9IVRw");
+
+ await createSegment(driver, "4", "10.33", "0:04.000 to 0:10.330");
+
+ await editSegments(driver, 0, "0:04.000", "0:10.330", "5", "13.211", "0:05.000 to 0:13.211", false);
+
+ await autoskipSegment(driver, 5, 13.211);
+ } finally {
+ await driver.quit();
+ }
+}, 100_000);
+
+async function setup(): Promise<WebDriver> {
+ const options = new Chrome.Options();
+ options.addArguments("--load-extension=" + Path.join(__dirname, "../dist/"));
+ options.addArguments("--mute-audio");
+ options.addArguments("--disable-features=PreloadMediaEngagementData, MediaEngagementBypassAutoplayPolicies");
+ options.windowSize({
+ width: 1280,
+ height: 720
+ });
+
+ let driver;
+ if (process.env.BROWSERSTACK_BUILD_NAME) {
+ const capabilities = {
+ 'os': 'windows',
+ 'os_version': '10',
+ 'browserName': 'chrome',
+ 'browser_version' : 'latest',
+ 'browserstack.local': 'true',
+ 'build': process.env.BROWSERSTACK_BUILD_NAME,
+ 'project': process.env.BROWSERSTACK_PROJECT_NAME,
+ 'browserstack.localIdentifier': process.env.BROWSERSTACK_LOCAL_IDENTIFIER,
+ 'browserstack.user': process.env.BROWSERSTACK_USERNAME,
+ 'browserstack.key': process.env.BROWSERSTACK_ACCESS_KEY
+ }
+
+ driver = await new Builder()
+ .usingServer('http://hub-cloud.browserstack.com/wd/hub')
+ .setChromeOptions(options)
+ .withCapabilities(capabilities)
+ .build();
+ } else {
+ driver = await new Builder()
+ .forBrowser("chrome")
+ .setChromeOptions(options)
+ .build();
+ }
+
+ driver.manage().setTimeouts({
+ implicit: 5000
+ });
+
+ return driver;
+}
+
+async function waitForInstall(driver: WebDriver, startingTab = 0): Promise<void> {
+ // Selenium only knows about the one tab it's on,
+ // so we can't wait for the help page to appear
+ await driver.sleep(3000);
+
+ const handles = await driver.getAllWindowHandles();
+ await driver.switchTo().window(handles[startingTab]);
+}
+
+async function goToVideo(driver: WebDriver, videoId: string): Promise<void> {
+ await driver.get("https://www.youtube.com/watch?v=" + videoId);
+ await driver.wait(until.elementIsVisible(await driver.findElement(By.className("ytd-video-primary-info-renderer"))));
+}
+
+async function createSegment(driver: WebDriver, startTime: string, endTime: string, expectedDisplayedTime: string): Promise<void> {
+ const startSegmentButton = await driver.findElement(By.id("startSegmentButton"));
+ const cancelSegmentButton = await driver.findElement(By.id("cancelSegmentButton"));
+ await driver.executeScript("document.querySelector('video').currentTime = " + startTime);
+
+ await startSegmentButton.click();
+ await driver.wait(until.elementIsVisible(cancelSegmentButton));
+
+ await driver.executeScript("document.querySelector('video').currentTime = " + endTime);
+
+ await startSegmentButton.click();
+ await driver.wait(until.elementIsNotVisible(cancelSegmentButton));
+
+ const submitButton = await driver.findElement(By.id("submitButton"));
+ await submitButton.click();
+
+ const sponsorTimeDisplays = await driver.findElements(By.className("sponsorTimeDisplay"));
+ const sponsorTimeDisplay = sponsorTimeDisplays[sponsorTimeDisplays.length - 1];
+ await driver.wait(until.elementTextIs(sponsorTimeDisplay, expectedDisplayedTime));
+}
+
+async function editSegments(driver: WebDriver, index: number, expectedStartTimeBox: string, expectedEndTimeBox: string,
+ startTime: string, endTime: string, expectedDisplayedTime: string, openSubmitBox: boolean): Promise<void> {
+
+ if (openSubmitBox) {
+ const submitButton = await driver.findElement(By.id("submitButton"));
+ await submitButton.click();
+ }
+
+ let editButton = await driver.findElement(By.id("sponsorTimeEditButtonSubmissionNotice" + index));
+ let sponsorTimeDisplays = await driver.findElements(By.className("sponsorTimeDisplay"));
+ let sponsorTimeDisplay = sponsorTimeDisplays[index];
+ await sponsorTimeDisplay.click();
+ // Ensure edit time appears
+ await driver.findElement(By.id("submittingTime0SubmissionNotice" + index));
+
+ // Try the edit button too
+ await editButton.click();
+ await editButton.click();
+
+ const startTimeBox = await driver.findElement(By.id("submittingTime0SubmissionNotice" + index));
+ expect((await startTimeBox.getAttribute("value"))).toBe(expectedStartTimeBox);
+ await startTimeBox.clear();
+ await startTimeBox.sendKeys(startTime);
+
+ const endTimeBox = await driver.findElement(By.id("submittingTime1SubmissionNotice" + index));
+ expect((await endTimeBox.getAttribute("value"))).toBe(expectedEndTimeBox);
+ await endTimeBox.clear();
+ await endTimeBox.sendKeys(endTime);
+
+ editButton = await driver.findElement(By.id("sponsorTimeEditButtonSubmissionNotice" + index));
+ await editButton.click();
+
+ sponsorTimeDisplays = await driver.findElements(By.className("sponsorTimeDisplay"));
+ sponsorTimeDisplay = sponsorTimeDisplays[index];
+ await driver.wait(until.elementTextIs(sponsorTimeDisplay, expectedDisplayedTime));
+}
+
+async function autoskipSegment(driver: WebDriver, startTime: number, endTime: number): Promise<void> {
+ const video = await driver.findElement(By.css("video"));
+
+ await driver.executeScript("document.querySelector('video').currentTime = " + (startTime - 0.5));
+ await driver.executeScript("document.querySelector('video').play()");
+
+ await driver.sleep(1300);
+
+ expect(parseFloat(await video.getAttribute("currentTime"))).toBeGreaterThan(endTime);
+ await driver.executeScript("document.querySelector('video').pause()");
+} \ No newline at end of file