Skip to content

Commit 8b3a5c3

Browse files
authoredJan 3, 2021
update QUnit, use Karma, make some of CI work locally as well (#672)
* workflows: Rename "CI" to "Release" Rename this to make space for a separate "CI" workflow that will run continuous integration and testing jobs for commits and PRs. * workflows: add CI workflow for unit tests and support running locally * Load qunit package from npm, this is the start of a larger transition. ref at #554. * Update QUnit from 2.3 to 2.13. * Use Karma for the running of unit tests (instead of Nightwatch). While it was possible to use a fake "UI" test to open the QUnit web page with Nightwatch, this had numerous limitations: - relies on fragile and unsupported DOM scraping to collect test results, which breaks between framework versions. ref #660. - severely limits debugging information for failing tests. - cannot easily be reproduced or debugged locally from the command-line as the Nightwatch config was pinned to Sauce Labs, and creating a local configuration is not easy because Nightwatch has a hard requirement for installing and running a WebDriver server. People usually do not have this installed and it's non-trivial to set up and keep working in the long term, and across multiple different software projects. - cannot easily be run in a secure container separate from your personal computer, thus putting personal data at risk. - lacks wider integration and plugins to enrich unit testing, such as test coverage reports. Using Karma means: - We can run 'npm test' locally during development and have it automatically run the tests in headless Firefox and Chrome and report back, all from the command-line. - The same exact same stack is also used in CI with SauceLabs for additional browser coverage (same as before). - It has no external dependencies other than the plain web browser itself. This means if you have a development container (e.g. based on Docker) that has Node.js + Firefox + Chromium, you can run the tests there without exposing anything from your personal computer, besides the current directory. <https://timotijhof.net/posts/2019/protect-yourself-from-npm/> - In a future change, we can plug in karma-coverage to generate a test coverage report, to submit to Codecov or Coveralls. ref #528. * I have pinned the version of 'http-server' and 'nightwatch' in package.json so that these don't silently upgrade in a way that may introduce security issues or drop compatibility for the environment we currently support. Fixes #653. * Re-enable unit and UI tests in latest Edge The tests were disabled after #499 due to an issue with the Edge version that was the default "edge" on SauceLabs in May 2019 (not sure which version that was, the last pre-Chromium Edge version was 44, which was passing, so perhaps SauceLabs defaulted to a beta release, or used a much older version like 15-18?) Now that Edge uses Chromium, try re-enabling the tests. Fixes #502.
1 parent aea8a7b commit 8b3a5c3

16 files changed

+6747
-5469
lines changed
 

‎.github/workflows/CI.yml

+85-49
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,101 @@
1-
# This sets the environment for building Kiwix JS store packages and runs the build script
2-
31
name: CI
42

5-
# Controls when the action will run.
63
on:
7-
release:
8-
# Triggers the workflow on publishing a release
9-
types:
10-
- published
11-
schedule:
12-
# Nightly run at 01:37 UTC (avoiding the usual midnight surge and rounded times)
13-
- cron: '37 1 * * *'
14-
# Allows us to run this workflow manually from the Actions tab
15-
workflow_dispatch:
4+
- push
5+
- pull_request
6+
# Allow running manually
7+
- workflow_dispatch
168

179
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1810
jobs:
19-
# This workflow contains a single job called "build"
20-
build:
21-
# The type of runner that the job will run on
11+
12+
# This job runs always, including for remote pull requests, and
13+
# has external dependencies or special permission needs, besides a
14+
# local install of Node.js, Firefox, and Chromium or Chrome.
15+
#
16+
# You can run these same tests locally in your own developer
17+
# environment via `npm ci && npm test`.
18+
tests-basic:
19+
# Packages 'firefox' and 'google-chrome' are pre-installed.
20+
#
21+
# https://github.com/actions/virtual-environments/blob/ubuntu20/20201210.0/images/linux/Ubuntu2004-README.md
2222
runs-on: ubuntu-20.04
23+
steps:
24+
# Clone the repo and checkout the commit for which the workflow was triggered
25+
- uses: actions/checkout@v2
26+
27+
# Install Node.js LTS
28+
- uses: actions/setup-node@v2
29+
with:
30+
node-version: 10.x
31+
32+
- name: Install dependencies
33+
run: npm ci
2334

24-
# Steps represent a sequence of tasks that will be executed as part of the job
35+
- name: Unit tests (Linux)
36+
run: npm test
37+
38+
# This job only runs when SauceLabs credentials are available
39+
# (e.g. direct pushes and local non-fork PRs) and is used to
40+
# run tests on additional operating systems and browsers.
41+
tests-secure:
42+
# Ideally this would be `if: secrets.SAUCE_USERNAME` or `if: fork`, which Travis CI
43+
# supported, but GitHub Actions does not. When a commit or PR is from a source (non-fork)
44+
# repo, the secrets are loaded only after the conditions are checked, not before.
45+
# https://git.1-hub.cnmunity/t/if-expression-with-context-variable/16558
46+
#
47+
# WARNING: GitHub evaluates workflow secrets and their protections always from the
48+
# perspective of the source repo. This means you cannot test secure jobs from a
49+
# forked repostiory. Unlike Travis, any secrets you configure in the fork are ignored.
50+
# To test a secure job, you will have to create a fresh repo under a different name,
51+
# add your secrets, and push to this additional remote from your local clone.
52+
#
53+
# One workaround is to check the secret from an early bash step and return early, but
54+
# that would display this job as having succeeded instead of skipped, which is confusing.
55+
#
56+
# Another way is to approximate the secret permission as best we can and hope
57+
# we don't accidentally run it when we shouldn't. Note that this condition only
58+
# decides whether the job runs, not the secrets loads, so it doesn't need to be
59+
# match perfectly. At worst it might in some edge case skip or run when it shouldn't
60+
# and simply fail due to absence of secrets.
61+
# https://git.1-hub.cnmunity/t/have-github-action-only-run-on-master-repo-and-not-on-forks/140840
62+
# https://git.1-hub.cnmunity/t/distinguish-between-forked-pr-and-own-pr/16678/2
63+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
64+
runs-on: ubuntu-20.04
2565
steps:
26-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2766
- uses: actions/checkout@v2
67+
- uses: actions/setup-node@v2
68+
with:
69+
node-version: 10.x
70+
- name: Install dependencies
71+
run: npm ci
2872

29-
# Set up secret files from encrypted secrets
30-
- name: Set up secret files
73+
- name: QUnit tests (Cross-browser)
3174
env:
32-
SSH_KEY: ${{ secrets.SSH_KEY }}
33-
CHROME_EXTENSION_KEY: ${{ secrets.CHROME_EXTENSION_KEY }}
34-
shell: bash
35-
run: |
36-
echo "$SSH_KEY" > ./scripts/ssh_key
37-
chmod 600 ./scripts/ssh_key
38-
echo "$CHROME_EXTENSION_KEY" > ./scripts/kiwix-html5.pem
39-
chmod 600 ./scripts/kiwix-html5.pem
75+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
76+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
77+
run: npm run test-unit-saucelabs
4078

41-
# Set up the environment
42-
- name: Setup environment
43-
shell: bash
44-
run: |
45-
sudo apt-get update
46-
sudo apt-get --yes install ./scripts/ubuntu_touch_packages/*.deb
4779

48-
# Runs the build scripts
49-
- name: Run the build scripts
80+
# Start a SauceLabs tunnel for Nightwatch (Karma does this automatically)
81+
- name: Start tunnel for End-to-end tests
82+
uses: saucelabs/sauce-connect-action@v1.1.2
83+
with:
84+
username: ${{ secrets.SAUCE_USERNAME }}
85+
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
86+
87+
- name: End-to-end tests (Cross-browser)
5088
env:
51-
MOZILLA_API_SECRET: ${{ secrets.MOZILLA_API_SECRET }}
52-
MOZILLA_API_KEY: ${{ secrets.MOZILLA_API_KEY }}
53-
TAG_NAME: ${{ github.event.release.tag_name }}
54-
shell: bash
55-
# Switch -t indicates a tag release (public release); add -d for dry run (for testing)
56-
# BEFORE the -v switch (because $TAG_NAME is empty for non-public builds)
89+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
90+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
5791
run: |
58-
# Run xvfb to make Chrome/Chromium believe it has a display. Else it fails signing the package
59-
Xvfb -ac :99 -screen 0 1280x1024x16 &
60-
export DISPLAY=:99
61-
if [ "x$TAG_NAME" = "x" ]; then
62-
./scripts/create_all_packages.sh
63-
else
64-
./scripts/create_all_packages.sh -t -v "$TAG_NAME"
65-
fi
92+
./node_modules/.bin/http-server . &
93+
sleep 2
94+
curl "http://localhost:8080" | head
95+
# The free account on Sauce does not allow more than 5 concurrent sessions (including the main one)
96+
# So we separate the recent and old browsers in order to respect this limit.
97+
# REMINDER: Keep this list in sync with the Unit tests, in tests/karma.conf.saucelabs.js
98+
./node_modules/.bin/nightwatch -c nightwatch.js --env firefox,chrome,edge
99+
./node_modules/.bin/nightwatch -c nightwatch.js --env edge40,edge44
100+
./node_modules/.bin/nightwatch -c nightwatch.js --env firefox45,chrome58,ie11
101+
pkill node || echo "Node process not running (anymore)"

‎.github/workflows/Release.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Workflow for building Kiwix JS store packages for nightly and tagged releases.
2+
3+
name: Release
4+
5+
# Controls when the action will run.
6+
on:
7+
release:
8+
# Triggers the workflow on publishing a release
9+
types:
10+
- published
11+
schedule:
12+
# Nightly run at 01:37 UTC (avoiding the usual midnight surge and rounded times)
13+
- cron: '37 1 * * *'
14+
# Allows us to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
18+
jobs:
19+
# This workflow contains a single job called "build"
20+
build:
21+
# The type of runner that the job will run on
22+
runs-on: ubuntu-20.04
23+
24+
# Steps represent a sequence of tasks that will be executed as part of the job
25+
steps:
26+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
27+
- uses: actions/checkout@v2
28+
29+
# Set up secret files from encrypted secrets
30+
- name: Set up secret files
31+
env:
32+
SSH_KEY: ${{ secrets.SSH_KEY }}
33+
CHROME_EXTENSION_KEY: ${{ secrets.CHROME_EXTENSION_KEY }}
34+
shell: bash
35+
run: |
36+
echo "$SSH_KEY" > ./scripts/ssh_key
37+
chmod 600 ./scripts/ssh_key
38+
echo "$CHROME_EXTENSION_KEY" > ./scripts/kiwix-html5.pem
39+
chmod 600 ./scripts/kiwix-html5.pem
40+
41+
# Set up the environment
42+
- name: Setup environment
43+
shell: bash
44+
run: |
45+
sudo apt-get update
46+
sudo apt-get --yes install ./scripts/ubuntu_touch_packages/*.deb
47+
48+
# Runs the build scripts
49+
- name: Run the build scripts
50+
env:
51+
MOZILLA_API_SECRET: ${{ secrets.MOZILLA_API_SECRET }}
52+
MOZILLA_API_KEY: ${{ secrets.MOZILLA_API_KEY }}
53+
TAG_NAME: ${{ github.event.release.tag_name }}
54+
shell: bash
55+
# Switch -t indicates a tag release (public release); add -d for dry run (for testing)
56+
# BEFORE the -v switch (because $TAG_NAME is empty for non-public builds)
57+
run: |
58+
# Run xvfb to make Chrome/Chromium believe it has a display. Else it fails signing the package
59+
Xvfb -ac :99 -screen 0 1280x1024x16 &
60+
export DISPLAY=:99
61+
if [ "x$TAG_NAME" = "x" ]; then
62+
./scripts/create_all_packages.sh
63+
else
64+
./scripts/create_all_packages.sh -t -v "$TAG_NAME"
65+
fi

‎.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ www-ghdeploy
5151
/scripts/travisci_builder_id_key
5252
/scripts/ssh_key
5353
/scripts/secret_files.tar.gz
54+
/reports/
5455

5556
#Visual Studio
5657
/.vs/
5758
/.vscode/
58-
package-lock.json

‎.travis.yml

-19
This file was deleted.

‎README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ It might also work with other content in the OpenZIM format: https://wiki.openzi
1010

1111
If your Internet access is expensive/rare/slow/unreliable/watched/censored, you still can browse this amazing repository of knowledge and culture.
1212

13-
[![Build Status](https://github.com/kiwix/kiwix-js/workflows/CI/badge.svg?query=branch%3Amaster)](https://github.com/kiwix/kiwix-js/actions?query=branch%3Amaster)
13+
[![Build Status: Continuous Integration](https://github.com/kiwix/kiwix-js/workflows/CI/badge.svg?query=branch%3Amaster)](https://github.com/kiwix/kiwix-js/actions?query=branch%3Amaster)
14+
[![Build Status: Release](https://github.com/kiwix/kiwix-js/workflows/Release/badge.svg?query=branch%3Amaster)](https://github.com/kiwix/kiwix-js/actions?query=branch%3Amaster)
1415
[![CodeFactor](https://www.codefactor.io/repository/github/kiwix/kiwix-js/badge)](https://www.codefactor.io/repository/github/kiwix/kiwix-js)
1516
[![Kiwix for Firefox](https://img.shields.io/amo/v/kiwix-offline?label=Kiwix%20for%20Firefox)](https://addons.mozilla.org/fr/firefox/addon/kiwix-offline/)
1617
[![Kiwix for Chrome](https://img.shields.io/chrome-web-store/v/donaljnlmapmngakoipdmehbfcioahhk?label=Kiwix%20for%20Chrome)](https://chrome.google.com/webstore/detail/kiwix/donaljnlmapmngakoipdmehbfcioahhk)
@@ -58,7 +59,7 @@ The source code can be found at https://github.com/kiwix/kiwix-js
5859

5960
## Unit tests
6061

61-
Unit tests can be run by opening tests.html file on Firefox or Edge (or Chromium/Chrome with some tweaks).
62+
Unit tests can be run by opening `tests/index.html` file in Firefox, Edge, or Chromium/Chrome.
6263

6364
## Public releases and nightly builds
6465

‎browser-tests/nightwatch_runner.js

-14
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,6 @@
2121
*/
2222
'use strict';
2323
module.exports = {
24-
'Unit Tests': function(browser) {
25-
// We need to skip the UI tests on Internet Explorer,
26-
// because they are not supported, even if the UI tests are supported on this browser
27-
if (browser.options.desiredCapabilities.browserName !== "internet explorer") {
28-
browser
29-
.url('http://localhost:8080/tests.html')
30-
.waitForElementVisible('#qunit-testresult', 10000)
31-
.pause(10000);
32-
browser.expect.element('#qunit-testresult').text.to.contain('tests completed in');
33-
browser.expect.element('#qunit-testresult .failed').text.to.equal('0');
34-
browser.expect.element('#qunit-testresult .passed').text.not.to.equal('0');
35-
browser.end();
36-
}
37-
},
3824
'UI Tests': function(browser) {
3925
browser
4026
.url('http://localhost:8080/')

‎nightwatch.js

+9-17
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* along with Kiwix (file LICENSE-GPLv3.txt). If not, see <http://www.gnu.org/licenses/>
2222
*/
2323
'use strict';
24-
const TRAVIS_JOB_NUMBER = process.env.TRAVIS_JOB_NUMBER;
24+
const build = `${process.env.GITHUB_REPOSITORY} run #${process.env.GITHUB_RUN_ID}`;
2525

2626
module.exports = {
2727
"src_folders" : ["browser-tests"],
@@ -52,17 +52,15 @@ module.exports = {
5252
"version": "45.0",
5353
"javascriptEnabled": true,
5454
"acceptSslCerts": true,
55-
"build": "build-" + TRAVIS_JOB_NUMBER,
56-
"tunnel-identifier": TRAVIS_JOB_NUMBER
55+
"build": build
5756
}
5857
},
5958
"firefox" : {
6059
"desiredCapabilities": {
6160
"browserName": "firefox",
6261
"javascriptEnabled": true,
6362
"acceptSslCerts": true,
64-
"build": "build-" + TRAVIS_JOB_NUMBER,
65-
"tunnel-identifier": TRAVIS_JOB_NUMBER
63+
"build": build
6664
}
6765
},
6866
"chrome58" : {
@@ -71,26 +69,23 @@ module.exports = {
7169
"version": "58.0",
7270
"javascriptEnabled": true,
7371
"acceptSslCerts": true,
74-
"build": "build-" + TRAVIS_JOB_NUMBER,
75-
"tunnel-identifier": TRAVIS_JOB_NUMBER
72+
"build": build
7673
}
7774
},
7875
"chrome" : {
7976
"desiredCapabilities": {
8077
"browserName": "chrome",
8178
"javascriptEnabled": true,
8279
"acceptSslCerts": true,
83-
"build": "build-" + TRAVIS_JOB_NUMBER,
84-
"tunnel-identifier": TRAVIS_JOB_NUMBER
80+
"build": build
8581
}
8682
},
8783
"edge" : {
8884
"desiredCapabilities": {
8985
"browserName": "MicrosoftEdge",
9086
"javascriptEnabled": true,
9187
"acceptSslCerts": true,
92-
"build": "build-" + TRAVIS_JOB_NUMBER,
93-
"tunnel-identifier": TRAVIS_JOB_NUMBER
88+
"build": build
9489
}
9590
},
9691
"edge40" : {
@@ -99,8 +94,7 @@ module.exports = {
9994
"version": "15.15063",
10095
"javascriptEnabled": true,
10196
"acceptSslCerts": true,
102-
"build": "build-" + TRAVIS_JOB_NUMBER,
103-
"tunnel-identifier": TRAVIS_JOB_NUMBER
97+
"build": build
10498
}
10599
},
106100
"edge44" : {
@@ -109,17 +103,15 @@ module.exports = {
109103
"version": "18.17763",
110104
"javascriptEnabled": true,
111105
"acceptSslCerts": true,
112-
"build": "build-" + TRAVIS_JOB_NUMBER,
113-
"tunnel-identifier": TRAVIS_JOB_NUMBER
106+
"build": build
114107
}
115108
},
116109
"ie11" : {
117110
"desiredCapabilities": {
118111
"browserName": "internet explorer",
119112
"javascriptEnabled": true,
120113
"acceptSslCerts": true,
121-
"build": "build-" + TRAVIS_JOB_NUMBER,
122-
"tunnel-identifier": TRAVIS_JOB_NUMBER
114+
"build": build
123115
}
124116
}
125117
}

‎package-lock.json

+6,441
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"test": "npm run test-unit-local",
5+
"test-unit-local": "karma start tests/karma.conf.local.js",
6+
"test-unit-saucelabs": "karma start tests/karma.conf.saucelabs.js"
7+
},
8+
"engines": {
9+
"node": ">=10"
10+
},
11+
"devDependencies": {
12+
"http-server": "^0.12.3",
13+
"karma": "^5.2.3",
14+
"karma-chrome-launcher": "^3.1.0",
15+
"karma-firefox-launcher": "^2.1.0",
16+
"karma-qunit": "^4.1.1",
17+
"karma-requirejs": "^1.1.0",
18+
"karma-sauce-launcher": "^4.3.4",
19+
"nightwatch": "^1.5.1",
20+
"qunit": "^2.13.0",
21+
"requirejs": "2.3.3"
22+
}
23+
}

‎tests.html ‎tests/index.html

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
4+
<meta charset="utf-8">
5+
<base href="../">
56
<title>Kiwix-js Unit tests</title>
67

78
<!--
@@ -24,23 +25,22 @@
2425
along with Kiwix (file LICENSE-GPLv3.txt). If not, see <http://www.gnu.org/licenses/>
2526
-->
2627

27-
<link rel="stylesheet" href="tests/qunit-2.3.2.css" />
28-
<script src="tests/qunit-2.3.2.js"></script>
28+
<link rel="stylesheet" href="node_modules/qunit/qunit/qunit.css" />
29+
<script src="node_modules/qunit/qunit/qunit.js"></script>
30+
<script>
31+
QUnit.config.autostart = false;
32+
</script>
2933

3034
<!-- Using require.js, a module system for javascript, include the
3135
js files. This loads "main.js", which in turn can load other
3236
files, all handled by require.js:
3337
http://requirejs.org/docs/api.html#jsfiles -->
34-
<script type="text/javascript"
35-
data-main="tests/init.js"
36-
src="www/js/lib/require.js"></script>
37-
38-
38+
<script src="www/js/lib/require.js" data-main="tests/init.js"></script>
3939
</head>
4040
<body>
4141
<b>NOTE:</b> Firefox and Chrome do not allow access to some local filesystem files used in testing. So, if you're opening this through a file:// URL, you should instead go through a web server : either through a local one (http://localhost/...) or through a remote one (but you need SSL : https://webserver/...).<br/>
4242
Another option is to force your browser to accept that (but you'll open a security breach) : on Chrome, you can start it with --allow-file-access-from-files command-line argument; on Firefox, you can set privacy.file_unique_origin to false in about:config
4343
<div id="qunit"></div>
4444
<div id="qunit-fixture"></div>
4545
</body>
46-
</html>
46+
</html>

‎tests/init.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var params = {};
2727
var webpMachine = true;
2828

2929
require.config({
30-
baseUrl: 'www/js/lib',
30+
baseUrl: (window.__karma__ ? 'base/' : '') + 'www/js/lib/',
3131
paths: {
3232
'jquery': 'jquery-3.2.1.slim',
3333
'webpHeroBundle': 'webpHeroBundle_0.0.0-dev.27',

‎tests/karma.conf.local.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = function (config) {
2+
config.set({
3+
basePath: '../',
4+
// https://karma-runner.github.io/5.2/config/browsers.html
5+
browsers: [
6+
'FirefoxHeadless',
7+
'ChromeHeadless'
8+
],
9+
frameworks: ['qunit'],
10+
client: {
11+
qunit: {
12+
autostart: false
13+
}
14+
},
15+
// logLevel: 'DEBUG',
16+
files: [
17+
'www/js/lib/require.js',
18+
'tests/init.js',
19+
{ pattern: 'www/**/*', included: false },
20+
{ pattern: 'tests/**/*', included: false }
21+
],
22+
singleRun: true,
23+
autoWatch: false
24+
});
25+
};

‎tests/karma.conf.saucelabs.js

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
module.exports = function (config) {
2+
config.set({
3+
basePath: '../',
4+
// https://karma-runner.github.io/5.2/config/browsers.html
5+
// https://github.com/karma-runner/karma-sauce-launcher
6+
sauceLabs: {
7+
build: process.env.GITHUB_RUN_ID ? `${process.env.GITHUB_REPOSITORY} run #${process.env.GITHUB_RUN_ID}` : null,
8+
startConnect: true,
9+
username: process.env.SAUCE_USERNAME,
10+
accessKey: process.env.SAUCE_ACCESS_KEY
11+
},
12+
customLaunchers: {
13+
firefox45: {
14+
base: 'SauceLabs',
15+
browserName: 'firefox',
16+
version: '45.0'
17+
},
18+
firefox: {
19+
base: 'SauceLabs',
20+
browserName: 'firefox',
21+
},
22+
chrome58: {
23+
base: 'SauceLabs',
24+
browserName: 'chrome',
25+
version: '58.0',
26+
},
27+
chrome: {
28+
base: 'SauceLabs',
29+
browserName: 'chrome',
30+
},
31+
edge: {
32+
base: 'SauceLabs',
33+
browserName: 'MicrosoftEdge',
34+
},
35+
edge40: {
36+
base: 'SauceLabs',
37+
browserName: 'MicrosoftEdge',
38+
version: '15.15063',
39+
},
40+
edge44: {
41+
base: 'SauceLabs',
42+
browserName: 'MicrosoftEdge',
43+
version: '18.17763',
44+
},
45+
ie11: {
46+
base: 'SauceLabs',
47+
browserName: 'internet explorer',
48+
}
49+
},
50+
// The free account on Sauce does not allow more than 5 concurrent sessions
51+
concurrency: 4,
52+
53+
// REMINDER: Keep this list in sync with the UI tests, in .github/workflows/CI.yml.
54+
browsers: [
55+
'firefox',
56+
'chrome',
57+
'edge',
58+
'edge40',
59+
'edge44',
60+
'firefox45',
61+
'chrome58'
62+
// Skip unit tests in Internet Explorer due to Promise undefined
63+
// 'ie11'
64+
],
65+
frameworks: ['qunit'],
66+
client: {
67+
qunit: {
68+
autostart: false
69+
}
70+
},
71+
reporters: ['dots'],
72+
logLevel: 'WARN',
73+
files: [
74+
'www/js/lib/require.js',
75+
'tests/init.js',
76+
{ pattern: 'www/**/*', included: false },
77+
{ pattern: 'tests/**/*', included: false }
78+
],
79+
singleRun: true,
80+
autoWatch: false
81+
});
82+
};

‎tests/qunit-2.3.2.css

-436
This file was deleted.

‎tests/qunit-2.3.2.js

-4,920
This file was deleted.

‎tests/tests.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ define(['jquery', 'zimArchive', 'zimDirEntry', 'util', 'uiUtil', 'utf8'],
6868

6969
var splitBlobs = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o'].map(function(c) {
7070
var filename = 'wikipedia_en_ray_charles_2015-06.zima' + c;
71-
return makeBlobRequest('tests/' + filename, filename);
71+
return makeBlobRequest(require.toUrl('../../../tests/' + filename), filename);
7272
});
7373
Promise.all(splitBlobs)
7474
.then(function(values) {
@@ -383,5 +383,7 @@ define(['jquery', 'zimArchive', 'zimDirEntry', 'util', 'uiUtil', 'utf8'],
383383
};
384384
localZimArchive.getMainPageDirEntry(callbackMainPageArticleFound);
385385
});
386+
387+
QUnit.start();
386388
};
387389
});

0 commit comments

Comments
 (0)
Please sign in to comment.