@internetarchive/bookreader 5.0.0-94 → 5.0.0-96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BookReader/BookReader.js +1 -1
- package/BookReader/hypothesis/LICENSE +50 -0
- package/BookReader/hypothesis/README.md +55 -0
- package/BookReader/hypothesis/build/boot.js +1 -0
- package/BookReader/hypothesis/build/manifest.json +20 -0
- package/BookReader/hypothesis/build/scripts/annotator.bundle.js +184 -0
- package/BookReader/hypothesis/build/scripts/annotator.bundle.js.map +1 -0
- package/BookReader/hypothesis/build/scripts/sidebar.bundle.js +798 -0
- package/BookReader/hypothesis/build/scripts/sidebar.bundle.js.map +1 -0
- package/BookReader/hypothesis/build/scripts/ui-playground.bundle.js +711 -0
- package/BookReader/hypothesis/build/scripts/ui-playground.bundle.js.map +1 -0
- package/BookReader/hypothesis/build/styles/annotator.css +2235 -0
- package/BookReader/hypothesis/build/styles/annotator.css.map +1 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/highlights.css +2 -0
- package/BookReader/hypothesis/build/styles/highlights.css.map +1 -0
- package/BookReader/hypothesis/build/styles/katex.min.css +2 -0
- package/BookReader/hypothesis/build/styles/katex.min.css.map +1 -0
- package/BookReader/hypothesis/build/styles/pdfjs-overrides.css +2 -0
- package/BookReader/hypothesis/build/styles/pdfjs-overrides.css.map +1 -0
- package/BookReader/hypothesis/build/styles/sidebar.css +2731 -0
- package/BookReader/hypothesis/build/styles/sidebar.css.map +1 -0
- package/BookReader/hypothesis/build/styles/ui-playground.css +2659 -0
- package/BookReader/hypothesis/build/styles/ui-playground.css.map +1 -0
- package/BookReader/hypothesis/package.json +126 -0
- package/README.md +0 -2
- package/package.json +6 -1
- package/.eslintrc.cjs +0 -51
- package/.gitattributes +0 -2
- package/.github/ISSUE_TEMPLATE/bug.md +0 -32
- package/.github/ISSUE_TEMPLATE/feature-request.md +0 -30
- package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -15
- package/.github/workflows/node.js.yml +0 -102
- package/.github/workflows/npm-publish.yml +0 -33
- package/.testcaferc.cjs +0 -10
- package/BookReaderDemo/BookReaderDemo.css +0 -40
- package/BookReaderDemo/BookReaderJSAdvanced.js +0 -112
- package/BookReaderDemo/BookReaderJSSimple.js +0 -56
- package/BookReaderDemo/IADemoBr.js +0 -149
- package/BookReaderDemo/assets/v5/Bookreader-logo-cool-grad.svg +0 -1
- package/BookReaderDemo/assets/v5/Bookreader-logo-flat.svg +0 -1
- package/BookReaderDemo/assets/v5/Bookreader-logo-hex-cool-grad.png +0 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-hex-flat.png +0 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-lines.png +0 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-lines.svg +0 -1
- package/BookReaderDemo/assets/v5/Bookreader-logo-warm.svg +0 -1
- package/BookReaderDemo/assets/v5/bookreader-logo-renders@1x.png +0 -0
- package/BookReaderDemo/assets/v5/bookreader-logo-renders@2x.png +0 -0
- package/BookReaderDemo/assets/v5/bookreader-v5-screenshot.png +0 -0
- package/BookReaderDemo/demo-advanced.html +0 -33
- package/BookReaderDemo/demo-embed-iframe-src.html +0 -85
- package/BookReaderDemo/demo-embed.html +0 -26
- package/BookReaderDemo/demo-fullscreen-mobile.html +0 -34
- package/BookReaderDemo/demo-fullscreen.html +0 -31
- package/BookReaderDemo/demo-iiif.html +0 -121
- package/BookReaderDemo/demo-internetarchive.html +0 -271
- package/BookReaderDemo/demo-multiple.html +0 -44
- package/BookReaderDemo/demo-preview-pages.html +0 -1093
- package/BookReaderDemo/demo-simple.html +0 -35
- package/BookReaderDemo/demo-vendor-fullscreen.html +0 -34
- package/BookReaderDemo/ia-multiple-volumes-manifest.js +0 -169
- package/BookReaderDemo/immersion-1up.html +0 -64
- package/BookReaderDemo/immersion-mode.html +0 -33
- package/BookReaderDemo/toggle_controls.html +0 -54
- package/BookReaderDemo/view_mode.html +0 -40
- package/BookReaderDemo/viewmode-cycle.html +0 -40
- package/CHANGELOG.md +0 -1080
- package/CONTRIBUTING.md +0 -7
- package/babel.config.cjs +0 -20
- package/codecov.yml +0 -23
- package/index.html +0 -34
- package/netlify.toml +0 -9
- package/renovate.json +0 -52
- package/screenshot.png +0 -0
- package/scripts/postversion.js +0 -11
- package/scripts/preversion.js +0 -15
- package/scripts/version.js +0 -27
- package/tests/e2e/README.md +0 -112
- package/tests/e2e/autoplay.test.js +0 -16
- package/tests/e2e/base.test.js +0 -27
- package/tests/e2e/helpers/base.js +0 -263
- package/tests/e2e/helpers/debug.js +0 -13
- package/tests/e2e/helpers/mockSearch.js +0 -90
- package/tests/e2e/helpers/params.js +0 -17
- package/tests/e2e/helpers/rightToLeft.js +0 -23
- package/tests/e2e/helpers/search.js +0 -73
- package/tests/e2e/models/BookReader.js +0 -11
- package/tests/e2e/models/Navigation.js +0 -39
- package/tests/e2e/rightToLeft.test.js +0 -19
- package/tests/e2e/viewmode.test.js +0 -44
- package/tests/jest/BookNavigator/book-navigator.test.js +0 -653
- package/tests/jest/BookNavigator/bookmarks/bookmark-button.test.js +0 -43
- package/tests/jest/BookNavigator/bookmarks/bookmark-edit.test.js +0 -132
- package/tests/jest/BookNavigator/bookmarks/bookmarks-list.test.js +0 -221
- package/tests/jest/BookNavigator/bookmarks/ia-bookmarks.test.js +0 -45
- package/tests/jest/BookNavigator/downloads/downloads-provider.test.js +0 -67
- package/tests/jest/BookNavigator/downloads/downloads.test.js +0 -53
- package/tests/jest/BookNavigator/search/search-provider.test.js +0 -179
- package/tests/jest/BookNavigator/search/search-results.test.js +0 -289
- package/tests/jest/BookNavigator/sharing/sharing-provider.test.js +0 -49
- package/tests/jest/BookNavigator/viewable-files/viewable-files-provider.test.js +0 -80
- package/tests/jest/BookNavigator/visual-adjustments.test.js +0 -200
- package/tests/jest/BookReader/BookModel.test.js +0 -372
- package/tests/jest/BookReader/BookReaderPublicFunctions.test.js +0 -263
- package/tests/jest/BookReader/ImageCache.test.js +0 -150
- package/tests/jest/BookReader/Mode1UpLit.test.js +0 -73
- package/tests/jest/BookReader/Mode2Up.test.js +0 -98
- package/tests/jest/BookReader/Mode2UpLit.test.js +0 -190
- package/tests/jest/BookReader/ModeCoordinateSpace.test.js +0 -16
- package/tests/jest/BookReader/ModeSmoothZoom.test.js +0 -218
- package/tests/jest/BookReader/ModeThumb.test.js +0 -71
- package/tests/jest/BookReader/Navbar/Navbar.test.js +0 -182
- package/tests/jest/BookReader/PageContainer.test.js +0 -249
- package/tests/jest/BookReader/ReduceSet.test.js +0 -38
- package/tests/jest/BookReader/Toolbar/Toolbar.test.js +0 -26
- package/tests/jest/BookReader/utils/HTMLDimensionsCacher.test.js +0 -59
- package/tests/jest/BookReader/utils/ScrollClassAdder.test.js +0 -49
- package/tests/jest/BookReader/utils/SelectionObserver.test.js +0 -57
- package/tests/jest/BookReader/utils/classes.test.js +0 -88
- package/tests/jest/BookReader/utils.test.js +0 -250
- package/tests/jest/BookReader.keyboard.test.js +0 -190
- package/tests/jest/BookReader.options.test.js +0 -47
- package/tests/jest/BookReader.test.js +0 -316
- package/tests/jest/plugins/plugin.archive_analytics.test.js +0 -20
- package/tests/jest/plugins/plugin.autoplay.test.js +0 -35
- package/tests/jest/plugins/plugin.chapters.test.js +0 -193
- package/tests/jest/plugins/plugin.iframe.test.js +0 -42
- package/tests/jest/plugins/plugin.resume.test.js +0 -85
- package/tests/jest/plugins/plugin.text_selection.test.js +0 -447
- package/tests/jest/plugins/plugin.vendor-fullscreen.test.js +0 -65
- package/tests/jest/plugins/search/plugin.search.test.js +0 -120
- package/tests/jest/plugins/search/plugin.search.view.test.js +0 -131
- package/tests/jest/plugins/search/utils.js +0 -25
- package/tests/jest/plugins/search/utils.test.js +0 -29
- package/tests/jest/plugins/tts/AbstractTTSEngine.test.js +0 -173
- package/tests/jest/plugins/tts/FestivalTTSEngine.test.js +0 -59
- package/tests/jest/plugins/tts/PageChunk.test.js +0 -57
- package/tests/jest/plugins/tts/PageChunkIterator.test.js +0 -179
- package/tests/jest/plugins/tts/WebTTSEngine.test.js +0 -178
- package/tests/jest/plugins/tts/utils.test.js +0 -74
- package/tests/jest/plugins/url/UrlPlugin.test.js +0 -198
- package/tests/jest/plugins/url/plugin.url.test.js +0 -168
- package/tests/jest/setup.js +0 -3
- package/tests/jest/util/browserSniffing.test.js +0 -62
- package/tests/jest/util/docCookies.test.js +0 -24
- package/tests/jest/util/strings.test.js +0 -63
- package/tests/jest/utils.js +0 -83
- package/webpack.config.js +0 -97
package/CONTRIBUTING.md
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# Contributing
|
2
|
-
|
3
|
-
- Please try to follow the code style within the file (spacing/comments/etc).
|
4
|
-
- Please only submit merge requests for features that would be useful for the general use
|
5
|
-
- Please try to avoid adding new libraries
|
6
|
-
- If the PR is a bug fix, include a link to a jsbin/codepen if possible
|
7
|
-
- Please test the changes in desktop, mobile, and embed modes, and also on many different devices/browsers.
|
package/babel.config.cjs
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
presets: [
|
3
|
-
[
|
4
|
-
"@babel/preset-env",
|
5
|
-
process.env.NODE_ENV == "test" ? { targets: { node: process.version } } :
|
6
|
-
process.env.NODE_ENV == "development" ? { targets: "last 2 Chrome versions, last 2 Firefox versions, last 2 Safari versions, last 2 Edge versions" } : {
|
7
|
-
targets: "> 2%, ie 11, edge 14, samsung > 9, OperaMini all, UCAndroid > 12, Safari >= 9",
|
8
|
-
useBuiltIns: "usage",
|
9
|
-
corejs: 3,
|
10
|
-
},
|
11
|
-
],
|
12
|
-
],
|
13
|
-
plugins: [
|
14
|
-
["@babel/plugin-proposal-decorators", {
|
15
|
-
version: "2018-09",
|
16
|
-
decoratorsBeforeExport: true,
|
17
|
-
}],
|
18
|
-
["@babel/plugin-proposal-class-properties"],
|
19
|
-
],
|
20
|
-
};
|
package/codecov.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
codecov:
|
2
|
-
notify:
|
3
|
-
require_ci_to_pass: yes
|
4
|
-
status:
|
5
|
-
project:
|
6
|
-
default:
|
7
|
-
# Allow small drops in coverage
|
8
|
-
threshold: 0.5 # 0.5%
|
9
|
-
if_not_found: failure
|
10
|
-
|
11
|
-
coverage:
|
12
|
-
precision: 2
|
13
|
-
round: down
|
14
|
-
range: "70...100"
|
15
|
-
|
16
|
-
parsers:
|
17
|
-
javascript:
|
18
|
-
enable_partials: yes
|
19
|
-
|
20
|
-
ignore:
|
21
|
-
- "BookReader"
|
22
|
-
- "tests"
|
23
|
-
|
package/index.html
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>BookReader Demos</title>
|
5
|
-
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
7
|
-
<meta name="apple-mobile-web-app-capable" content="yes">
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<ul>
|
11
|
-
<li><a href="BookReaderDemo/demo-simple.html">Simple</a></li>
|
12
|
-
<li><a href="BookReaderDemo/view_mode.html">Set initial view mode</a></li>
|
13
|
-
<li><a href="BookReaderDemo/toggle_controls.html">Toggle and override individual controls</a></li>
|
14
|
-
<li><a href="BookReaderDemo/demo-fullscreen.html">Fullscreen with mobile nav</a></li>
|
15
|
-
<li><a href="BookReaderDemo/demo-fullscreen-mobile.html">Inline on page, with mobile nav on fullscreen</a></li>
|
16
|
-
<li><a href="BookReaderDemo/demo-vendor-fullscreen.html">Vendor native fullscreen</a></li>
|
17
|
-
<li><a href="BookReaderDemo/demo-advanced.html">Advanced</a></li>
|
18
|
-
<li><a href="BookReaderDemo/demo-preview-pages.html">Preview Pages</a></li>
|
19
|
-
<li><a href="BookReaderDemo/demo-embed.html">Embed</a></li>
|
20
|
-
<li><a href="BookReaderDemo/demo-multiple.html">Multiple on same page</a></li>
|
21
|
-
<!-- plugin.search.js -->
|
22
|
-
<li><a href="BookReaderDemo/demo-internetarchive.html?ocaid=theworksofplato01platiala">From Internet Archive</a></li>
|
23
|
-
<!-- plugin.search.js -->
|
24
|
-
<li><a href="BookReaderDemo/demo-internetarchive.html?ocaid=adventureofsherl0000unse">From Internet Archive - a book with CHAPTERS</a></li>
|
25
|
-
<li><a href="BookReaderDemo/demo-iiif.html">IIIF</a></li>
|
26
|
-
<li><a href="BookReaderDemo/demo-internetarchive.html?ocaid=goodytwoshoes00newyiala&autoflip=1">Autoplay (kiosk mode)</a></li>
|
27
|
-
<li><a href="BookReaderDemo/demo-plugin-menu-toggle.html">Plugin: Full screen menu toggle</a></li>
|
28
|
-
<li><a href="BookReaderDemo/immersion-mode.html">Start in immersion (fullscreen) mode</a></li>
|
29
|
-
<!-- plugin.search.js -->
|
30
|
-
<li><a href="BookReaderDemo/immersion-1up.html">Start in immersion mode on 1up default item</a></li>
|
31
|
-
<li><a href="BookReaderDemo/viewmode-cycle.html">Replace view mode buttons with view mode cycler</a></li>
|
32
|
-
</ul>
|
33
|
-
</body>
|
34
|
-
</html>
|
package/netlify.toml
DELETED
package/renovate.json
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"extends": [
|
3
|
-
"config:base",
|
4
|
-
"schedule:monthly"
|
5
|
-
],
|
6
|
-
"packageRules": [
|
7
|
-
{
|
8
|
-
"matchPackageNames": [
|
9
|
-
"@babel/eslint-parser",
|
10
|
-
"@open-wc/testing-helpers",
|
11
|
-
"@types/jest",
|
12
|
-
"codecov/codecov-action",
|
13
|
-
"eslint",
|
14
|
-
"eslint-plugin-no-jquery",
|
15
|
-
"eslint-plugin-testcafe",
|
16
|
-
"jest",
|
17
|
-
"jest-environment-jsdom",
|
18
|
-
"sinon",
|
19
|
-
"testcafe"
|
20
|
-
],
|
21
|
-
"automerge": true
|
22
|
-
},
|
23
|
-
{
|
24
|
-
"matchPackageNames": [
|
25
|
-
"concurrently",
|
26
|
-
"http-server",
|
27
|
-
"live-server",
|
28
|
-
"node-fetch"
|
29
|
-
],
|
30
|
-
"matchUpdateTypes": ["minor", "patch"],
|
31
|
-
"automerge": true
|
32
|
-
},
|
33
|
-
{
|
34
|
-
"matchPackagePatterns": ["^@internetarchive/icon-"],
|
35
|
-
"groupName": "@internetarchive icons",
|
36
|
-
"rangeStrategy": "bump"
|
37
|
-
},
|
38
|
-
{
|
39
|
-
"matchPackagePatterns": ["*"],
|
40
|
-
"rangeStrategy": "bump"
|
41
|
-
},
|
42
|
-
{
|
43
|
-
"matchPackagePatterns": ["^actions/"],
|
44
|
-
"groupName": "GitHub Actions",
|
45
|
-
"automerge": true
|
46
|
-
},
|
47
|
-
{
|
48
|
-
"matchPackagePatterns": ["^@internetarchive"],
|
49
|
-
"schedule": ["at any time"]
|
50
|
-
}
|
51
|
-
]
|
52
|
-
}
|
package/screenshot.png
DELETED
Binary file
|
package/scripts/postversion.js
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
import fs from 'fs';
|
2
|
-
import PACKAGE_JSON from '../package.json' assert { type: 'json' };
|
3
|
-
const NEW_VERSION = PACKAGE_JSON.version;
|
4
|
-
|
5
|
-
const tag = `v${NEW_VERSION}`;
|
6
|
-
const releaseBody = fs.readFileSync('CHANGELOG.md').toString()
|
7
|
-
.split(/\n# /)[0] // split at headings and get first heading
|
8
|
-
.split('\n').slice(1).join('\n'); // remove heading line
|
9
|
-
|
10
|
-
const GITHUB_RELEASE_URL = `https://github.com/internetarchive/bookreader/releases/new?tag=${tag}&title=${tag}&body=${encodeURIComponent(releaseBody)}`;
|
11
|
-
console.log(`After you push/merge, use this link to release: ${GITHUB_RELEASE_URL}`);
|
package/scripts/preversion.js
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
import PACKAGE_JSON from '../package.json' assert { type: 'json' };
|
2
|
-
|
3
|
-
const OLD_VERSION = PACKAGE_JSON.version;
|
4
|
-
const OLD_RELEASE_URL = `https://api.github.com/repos/internetarchive/bookreader/releases/tags/v${OLD_VERSION}`;
|
5
|
-
|
6
|
-
async function main() {
|
7
|
-
const {created_at} = await fetch(OLD_RELEASE_URL).then(r => r.json());
|
8
|
-
const today = new Date().toISOString().slice(0, -5);
|
9
|
-
const searchUrl = 'https://github.com/internetarchive/bookreader/pulls?' + new URLSearchParams({
|
10
|
-
q: `is:pr is:merged merged:${created_at}..${today}Z sort:updated-asc`
|
11
|
-
}).toString();
|
12
|
-
console.log(`Here are all the PRs that were merged since the last version: ${searchUrl}`);
|
13
|
-
}
|
14
|
-
|
15
|
-
main();
|
package/scripts/version.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
import fs from 'fs';
|
2
|
-
import { execSync } from 'child_process';
|
3
|
-
import PACKAGE_JSON from '../package.json' assert { type: 'json' };
|
4
|
-
const NEW_VERSION = PACKAGE_JSON.version;
|
5
|
-
|
6
|
-
async function main() {
|
7
|
-
// Update the changelog
|
8
|
-
const old_changelog = fs.readFileSync('CHANGELOG.md').toString();
|
9
|
-
const new_changelog = `# ${NEW_VERSION}\n<!-- Write here... -->\n\n` + old_changelog;
|
10
|
-
fs.writeFileSync('CHANGELOG.md', new_changelog);
|
11
|
-
while (fs.readFileSync('CHANGELOG.md').toString().includes('<!-- Write here... -->')) {
|
12
|
-
console.log('Changelog contains dummy text. Update the changelog, and press ENTER continue.');
|
13
|
-
await new Promise(res => process.stdin.once("data", res));
|
14
|
-
}
|
15
|
-
execSync('git add CHANGELOG.md');
|
16
|
-
|
17
|
-
// npm install to make sure deps are correct
|
18
|
-
execSync('npm install', { stdio: "inherit" });
|
19
|
-
|
20
|
-
// build
|
21
|
-
execSync('npm run build', { stdio: "inherit" });
|
22
|
-
|
23
|
-
// Add build files
|
24
|
-
execSync('git add ./BookReader');
|
25
|
-
}
|
26
|
-
|
27
|
-
main().then(() => process.exit());
|
package/tests/e2e/README.md
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
# TestCafe End to End (e2e) Testing
|
2
|
-
|
3
|
-
## Running
|
4
|
-
|
5
|
-
To run all tests in all browsers currently specified, run
|
6
|
-
|
7
|
-
`npm run test:e2e`
|
8
|
-
|
9
|
-
The list of browsers TestCafe will attempt to use are stored in
|
10
|
-
`.testcaferc.json`.
|
11
|
-
|
12
|
-
The test runner will pick up any file within the tests/e2e directory or
|
13
|
-
subdirectories that ends in `test.js`. If you would like to abstract some code
|
14
|
-
and place it alongside the test fixtures, as long as the file name does not
|
15
|
-
end in this suffix, the test runner won't pick it up and attempt to set up a
|
16
|
-
test fixture.
|
17
|
-
|
18
|
-
### Testing a specific browser
|
19
|
-
|
20
|
-
To run all tests in one or more specified browsers, supply the names of the
|
21
|
-
application executables after the command above. For example, if you only want
|
22
|
-
to run tests in Chrome, run `npm run test:e2e chrome`. To run
|
23
|
-
in both Chrome and Safari, run `npm run test:e2e chrome,safari`.
|
24
|
-
|
25
|
-
### Testing in Chrome using device emulation
|
26
|
-
|
27
|
-
You can specify device presets or specify custom parameters for Chrome's
|
28
|
-
device emulation when starting tests. For example:
|
29
|
-
|
30
|
-
`npm run test:e2e "chrome:emulation:width=414;height=736;mobile=true;orientation=vertical;touch=true"`
|
31
|
-
|
32
|
-
### Testing on remote devices
|
33
|
-
|
34
|
-
If you need to run tests on other devices like a phone, tablet, or other
|
35
|
-
computer, you can specify the number of browsers on the remote devices you'd
|
36
|
-
like to connect to the test runner. For example, to test Chrome on both a
|
37
|
-
phone and tablet, you'd specify '2' remote browsers. If you're only testing
|
38
|
-
on a phone, but are testing in Chrome and Safari, you'd also specify '2'.
|
39
|
-
|
40
|
-
`npm test:e2e remote:2`
|
41
|
-
|
42
|
-
This will provide you with a URL that you then visit in each browser. The URL
|
43
|
-
will look something like `http://127.0.0.1:52902/browser/connect`.
|
44
|
-
|
45
|
-
### Running a specific fixture
|
46
|
-
|
47
|
-
To run a particular fixture, add the path to the file at the end of your arguments list.
|
48
|
-
|
49
|
-
`npm run test:e2e chrome tests/e2e/example.test.js`
|
50
|
-
|
51
|
-
### Testing netlify or archive.org
|
52
|
-
|
53
|
-
```sh
|
54
|
-
BASE_URL='https://lucid-poitras-9a1249.netlify.app' npx testcafe
|
55
|
-
BASE_URL='https://archive.org' npx testcafe
|
56
|
-
```
|
57
|
-
|
58
|
-
### Testing any OCAID
|
59
|
-
|
60
|
-
For OCAIDs you should pick the specific test file to run, since things like autoplay tests won't work. The main tests are in `base.test.js`.
|
61
|
-
|
62
|
-
```sh
|
63
|
-
OCAIDS='goody,goodytwoshoes00newyiala' npx testcafe tests/e2e/base.test.js
|
64
|
-
OCAIDS='goody,goodytwoshoes00newyiala' BASE_URL='https://archive.org' npx testcafe tests/e2e/base.test.js
|
65
|
-
|
66
|
-
# right to left book; note this also runs the base tests
|
67
|
-
OCAIDS='gendaitankashu00meijuoft' BASE_URL='https://archive.org' npx testcafe tests/e2e/rightToLeft.test.js
|
68
|
-
```
|
69
|
-
|
70
|
-
### Running tests with browserstack
|
71
|
-
|
72
|
-
Note these can only test a public url, so you either need to create a draft PR and use the netlify link, or use ngrok to publish your dev server's port.
|
73
|
-
|
74
|
-
Note: Windows users, there is a bug that prevents spaces in the browser field when using `npx`, so you'll need to have `testcafe` globally installed, and run it without `npx`. (See https://github.com/DevExpress/testcafe/issues/6600 ). Or, you can add browserstack browsers the `.testcaferc.js` file.
|
75
|
-
|
76
|
-
```sh
|
77
|
-
# Set auth; find yours at https://www.browserstack.com/accounts/settings
|
78
|
-
export BROWSERSTACK_USERNAME="YOUR_USERNAME"
|
79
|
-
export BROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY"
|
80
|
-
|
81
|
-
BASE_URL='https://archive.org' OCAIDS='goody,goodytwoshoes00newyiala' npx testcafe 'browserstack:iPad Pro 12.9 2018@15' tests/e2e/base.test.js
|
82
|
-
```
|
83
|
-
|
84
|
-
See a list of available browsers with `npx testcafe -b browserstack`. Note there are some browsers which appear to not work for some reason (eg `browserstack:iPad Mini 4@9.3`).
|
85
|
-
|
86
|
-
Read more about other options/etc at the browserstack docs: https://www.browserstack.com/docs/automate/selenium/getting-started/nodejs/testcafe .
|
87
|
-
|
88
|
-
## Pending (skip) tests
|
89
|
-
|
90
|
-
You can skip any tests by calling the method `.skip` on the test object rather
|
91
|
-
than call the test function directly. If you have a test definition like:
|
92
|
-
|
93
|
-
```
|
94
|
-
test('Subnav opened when primary nav category clicked', async (t) => {
|
95
|
-
const textsTophat = Selector('.row.texts');
|
96
|
-
await t.expect(await textsTophat.visible).notOk();
|
97
|
-
await t.click('[data-top-kind=texts]');
|
98
|
-
await t.expect(await textsTophat.visible).ok();
|
99
|
-
});
|
100
|
-
```
|
101
|
-
|
102
|
-
You would skip it by changing the `test` call to `test.skip`.
|
103
|
-
|
104
|
-
## Running only one test
|
105
|
-
|
106
|
-
Similarly, you can use the `.only` method to skip all other tests and only run
|
107
|
-
the one specified.
|
108
|
-
|
109
|
-
```
|
110
|
-
test.only('Subnav opened when primary nav category clicked', async (t) => {
|
111
|
-
```
|
112
|
-
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { ClientFunction } from 'testcafe';
|
2
|
-
import params from './helpers/params.js';
|
3
|
-
|
4
|
-
const getLocationHref = ClientFunction(() => window.location.href.toString());
|
5
|
-
const FLIP_SPEED = 200;
|
6
|
-
const FLIP_DELAY = 500;
|
7
|
-
|
8
|
-
fixture `Autoplay plugin`.page `${params.baseUrl}/BookReaderDemo/demo-internetarchive.html?ocaid=goody&autoflip=1&flipSpeed=${FLIP_SPEED}&flipDelay=${FLIP_DELAY}`;
|
9
|
-
|
10
|
-
test('page auto-advances after allotted flip speed and delay', async t => {
|
11
|
-
// Flips from cover, to #page/n1 to #page/n3, etc
|
12
|
-
await t.expect(getLocationHref()).notMatch(/page\/n\d+/);
|
13
|
-
await t.wait(2 * (FLIP_SPEED + FLIP_DELAY) + 500);
|
14
|
-
// Don't check for a specific page; initial load time can vary
|
15
|
-
await t.expect(getLocationHref()).match(/page\/n\d+/);
|
16
|
-
});
|
package/tests/e2e/base.test.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
import { runBaseTests } from './helpers/base.js';
|
2
|
-
import BookReader from './models/BookReader.js';
|
3
|
-
import { runSearchTests } from './helpers/search.js';
|
4
|
-
import params from './helpers/params.js';
|
5
|
-
|
6
|
-
const ocaids = params.ocaids || [
|
7
|
-
'theworksofplato01platiala',
|
8
|
-
// Removed because failing test 'Canonical URL with cookie shows paramters'
|
9
|
-
// in tests/e2e/helpers/base.js
|
10
|
-
// Cookie path should be:
|
11
|
-
// /BookReaderDemo/demo-ia-olivertwist.html
|
12
|
-
// Cookie path is:
|
13
|
-
// /BookReaderDemo/demo-ia-olivertwist.html/page/n13/mode/2up
|
14
|
-
// 'demo-ia-olivertwist.html',
|
15
|
-
];
|
16
|
-
|
17
|
-
ocaids.forEach(ocaid => {
|
18
|
-
const url = params.getArchiveUrl(ocaid);
|
19
|
-
|
20
|
-
fixture `Base Tests for: ${ocaid}`.page `${url}`;
|
21
|
-
runBaseTests(new BookReader());
|
22
|
-
|
23
|
-
|
24
|
-
fixture `Search Tests for: ${ocaid}`
|
25
|
-
.page `${url}`;
|
26
|
-
runSearchTests(new BookReader());
|
27
|
-
});
|
@@ -1,263 +0,0 @@
|
|
1
|
-
import { ClientFunction, Selector } from 'testcafe';
|
2
|
-
|
3
|
-
const PAGE_FLIP_WAIT_TIME = 1000;
|
4
|
-
|
5
|
-
const getHash = ClientFunction(() => document.location.hash);
|
6
|
-
const getUrl = ClientFunction(() => window.location.href);
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Check URL page parameter in # and path
|
10
|
-
*/
|
11
|
-
const isPageInUrl = ClientFunction(() => {
|
12
|
-
const hash = document.location.hash;
|
13
|
-
if (hash) {
|
14
|
-
return hash.indexOf('#page/') > -1;
|
15
|
-
} else {
|
16
|
-
return window.location.href.indexOf('/page/') > -1;
|
17
|
-
}
|
18
|
-
});
|
19
|
-
|
20
|
-
/**
|
21
|
-
* Check URL mode parameter in # and path
|
22
|
-
*
|
23
|
-
* @param mode '1up', '2up', 'thumb'
|
24
|
-
*/
|
25
|
-
const isModeInUrl = ClientFunction((mode) => {
|
26
|
-
const hash = document.location.hash;
|
27
|
-
if (hash) {
|
28
|
-
return hash.indexOf('/mode/' + mode) > -1;
|
29
|
-
} else {
|
30
|
-
return window.location.href.indexOf('/mode/' + mode) > -1;
|
31
|
-
}
|
32
|
-
});
|
33
|
-
|
34
|
-
/**
|
35
|
-
* Runs all expected base tests for BookReader
|
36
|
-
*
|
37
|
-
* @param { import('../models/BookReader').default } br - Model
|
38
|
-
*/
|
39
|
-
export function runBaseTests (br) {
|
40
|
-
test('On load, pages fit fully inside of the BookReader™', async t => {
|
41
|
-
await t.expect(br.shell.visible).ok();
|
42
|
-
await t.expect(br.BRcontainer.visible).ok();
|
43
|
-
|
44
|
-
const shellHeight = await br.shell.getBoundingClientRectProperty('height');
|
45
|
-
const bookHeight = await br.BRcontainer.getBoundingClientRectProperty('height');
|
46
|
-
await t.expect(bookHeight).lte(shellHeight, 'images do not get cropped vertically');
|
47
|
-
|
48
|
-
const shellWidth = await br.shell.getBoundingClientRectProperty('width');
|
49
|
-
const bookWidth = await br.BRcontainer.getBoundingClientRectProperty('width');
|
50
|
-
await t.expect(bookWidth).lte(shellWidth, 'images do not get cropped horizontally');
|
51
|
-
});
|
52
|
-
|
53
|
-
test('nav menu displays properly', async t => {
|
54
|
-
const { nav } = br;
|
55
|
-
|
56
|
-
await t.expect(nav.goLeft.visible).ok();
|
57
|
-
await t.expect(nav.goRight.visible).ok();
|
58
|
-
await t.expect(nav.mode1Up.visible).ok();
|
59
|
-
await t.expect(nav.mode2Up.visible).ok();
|
60
|
-
await t.expect(nav.modeThumb.visible).ok();
|
61
|
-
await t.expect(nav.zoomIn.visible).ok();
|
62
|
-
await t.expect(nav.zoomOut.visible).ok();
|
63
|
-
await t.expect(nav.fullScreen.visible).ok();
|
64
|
-
});
|
65
|
-
|
66
|
-
test("Canonical URL has no initial parameters", async t => {
|
67
|
-
// Initial URL has no params
|
68
|
-
await t.expect(getHash()).eql('');
|
69
|
-
// Initial URL has no page/ mode/
|
70
|
-
await t.expect(getUrl()).notContains('#page/');
|
71
|
-
await t.expect(getUrl()).notContains('/page/');
|
72
|
-
await t.expect(getUrl()).notContains('/mode/');
|
73
|
-
});
|
74
|
-
|
75
|
-
// Need to disable page caching to have cookies persist in test
|
76
|
-
test.disablePageCaching('Canonical URL shows parameters if cookie set', async t => {
|
77
|
-
const { nav } = br;
|
78
|
-
|
79
|
-
// Check if uses plugin.resume.js
|
80
|
-
const usesResume = ClientFunction(() => {
|
81
|
-
const hasResumePlugin = typeof(br.plugins.resume) !== "undefined";
|
82
|
-
const hasResumeValue = hasResumePlugin ? br.plugins.resume.getResumeValue() : false;
|
83
|
-
return hasResumeValue;
|
84
|
-
});
|
85
|
-
|
86
|
-
// Store initial URL
|
87
|
-
const initialUrl = await getUrl();
|
88
|
-
|
89
|
-
// Set Cookie by page navigation, wait for cookie
|
90
|
-
await t.click(nav.goNext);
|
91
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
92
|
-
|
93
|
-
// reload canonical URL, wait for URL change
|
94
|
-
await t.navigateTo(initialUrl);
|
95
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
96
|
-
|
97
|
-
if (await usesResume()) {
|
98
|
-
await t.expect(isPageInUrl()).eql(true, initialUrl);
|
99
|
-
await t.expect(isModeInUrl('2up')).eql(true, initialUrl);
|
100
|
-
} else {
|
101
|
-
// No plugin, no br-resume cookie
|
102
|
-
await t.expect(getUrl()).notContains('#page/');
|
103
|
-
await t.expect(getUrl()).notContains('/page/');
|
104
|
-
await t.expect(getUrl()).notContains('/mode/');
|
105
|
-
}
|
106
|
-
});
|
107
|
-
|
108
|
-
test('2up mode - Clicking `Previous page` changes the page', async t => {
|
109
|
-
const { nav, BRcontainer} = br;
|
110
|
-
|
111
|
-
// Go to next page, so we can go previous if at front cover
|
112
|
-
await t.click(nav.goNext);
|
113
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
114
|
-
await t.click(nav.goNext);
|
115
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
116
|
-
|
117
|
-
const onLoadBrState = BRcontainer.child(0);
|
118
|
-
const initialImages = onLoadBrState.find('img');
|
119
|
-
const origImg1Src = await initialImages.nth(0).getAttribute('src');
|
120
|
-
const origImg2Src = await initialImages.nth(-1).getAttribute('src');
|
121
|
-
|
122
|
-
await t.click(nav.goPrev);
|
123
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
124
|
-
|
125
|
-
const nextBrState = Selector('.BRcontainer').child(0);
|
126
|
-
const prevImages = nextBrState.find('img');
|
127
|
-
const prevImg1Src = await prevImages.nth(0).getAttribute('src');
|
128
|
-
const prevImg2Src = await prevImages.nth(-1).getAttribute('src');
|
129
|
-
|
130
|
-
// we aren't showing the same image in both leaves
|
131
|
-
await t.expect(origImg1Src).notEql(origImg2Src);
|
132
|
-
|
133
|
-
// we are showing new pages
|
134
|
-
await t.expect(prevImg1Src).notEql(origImg1Src);
|
135
|
-
await t.expect(prevImg1Src).notEql(origImg2Src);
|
136
|
-
await t.expect(prevImg2Src).notEql(origImg1Src);
|
137
|
-
await t.expect(prevImg2Src).notEql(origImg2Src);
|
138
|
-
|
139
|
-
// we aren't showing the same image in the new pages
|
140
|
-
await t.expect(prevImg1Src).notEql(prevImg2Src);
|
141
|
-
});
|
142
|
-
|
143
|
-
test('2up mode - Clicking `Next page` changes the page', async t => {
|
144
|
-
// Note: this will fail on a R to L book if at front cover
|
145
|
-
const { nav, BRcontainer} = br;
|
146
|
-
// Flip away from cover
|
147
|
-
await t.click(nav.goNext);
|
148
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
149
|
-
|
150
|
-
const onLoadBrState = BRcontainer.child(0);
|
151
|
-
const initialImages = onLoadBrState.find('img');
|
152
|
-
const origImg1Src = await initialImages.nth(0).getAttribute('src');
|
153
|
-
const origImg2Src = await initialImages.nth(-1).getAttribute('src');
|
154
|
-
|
155
|
-
await t.click(nav.goNext);
|
156
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
157
|
-
|
158
|
-
const nextBrState = Selector('.BRcontainer').child(0);
|
159
|
-
const nextImages = nextBrState.find('img');
|
160
|
-
const nextImg1Src = await nextImages.nth(0).getAttribute('src');
|
161
|
-
const nextImg2Src = await nextImages.nth(-1).getAttribute('src');
|
162
|
-
|
163
|
-
// we are showing new pages
|
164
|
-
await t.expect(nextImg1Src).notEql(origImg1Src);
|
165
|
-
await t.expect(nextImg1Src).notEql(origImg2Src);
|
166
|
-
await t.expect(nextImg2Src).notEql(origImg1Src);
|
167
|
-
await t.expect(nextImg2Src).notEql(origImg2Src);
|
168
|
-
|
169
|
-
// we aren't showing the same image in the new pages
|
170
|
-
await t.expect(nextImg1Src).notEql(nextImg2Src);
|
171
|
-
});
|
172
|
-
|
173
|
-
test('Clicking `page flip buttons` updates location', async t => {
|
174
|
-
const { nav } = br;
|
175
|
-
// Page navigation creates params
|
176
|
-
await t.click(nav.goNext);
|
177
|
-
await t.expect(isPageInUrl()).eql(true);
|
178
|
-
await t.expect(isModeInUrl('2up')).eql(true);
|
179
|
-
|
180
|
-
await t.click(nav.goPrev);
|
181
|
-
await t.expect(isPageInUrl()).eql(true);
|
182
|
-
await t.expect(isModeInUrl('2up')).eql(true);
|
183
|
-
});
|
184
|
-
|
185
|
-
test('Clicking `2 page view` brings up cur page + caching', async t => {
|
186
|
-
const { nav } = br;
|
187
|
-
await t.click(nav.mode2Up);
|
188
|
-
await t.expect(Selector('.BRpagecontainer.BRpage-visible').count).eql(1);
|
189
|
-
await t.expect(Selector('.BRpagecontainer').count).eql(3);
|
190
|
-
});
|
191
|
-
|
192
|
-
test('Clicking `1 page view` brings up 1 at a time', async t => {
|
193
|
-
const { nav } = br;
|
194
|
-
await t.click(nav.mode1Up);
|
195
|
-
|
196
|
-
// Flip away from cover
|
197
|
-
await t.click(nav.goNext);
|
198
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
199
|
-
|
200
|
-
// we usually pre-fetch the page in question & the 2 after it
|
201
|
-
await t.expect(Selector('.BRpagecontainer').count).gte(3);
|
202
|
-
});
|
203
|
-
|
204
|
-
test('Clicking `thumbnail view` brings up all of the page thumbnails', async t => {
|
205
|
-
const { nav } = br;
|
206
|
-
await t.click(nav.modeThumb);
|
207
|
-
await t.expect(Selector('.BRpagecontainer').count).gte(3);
|
208
|
-
});
|
209
|
-
|
210
|
-
test('Clicking `zoom out` makes book smaller', async t => {
|
211
|
-
const { nav } = br;
|
212
|
-
const page = Selector('.BRpagecontainer.BRpage-visible');
|
213
|
-
|
214
|
-
await t.expect(br.BRcontainer.visible).ok();
|
215
|
-
await t.expect(page.visible).ok();
|
216
|
-
await t.expect(nav.zoomOut.visible).ok();
|
217
|
-
|
218
|
-
const initialBookHeight = await page.getBoundingClientRectProperty('height');
|
219
|
-
const initialBookWidth = await page.getBoundingClientRectProperty('width');
|
220
|
-
|
221
|
-
await t.click(nav.zoomOut);
|
222
|
-
|
223
|
-
const zoomOutBookHeight = await page.getBoundingClientRectProperty('height');
|
224
|
-
const zoomOutBookWidth = await page.getBoundingClientRectProperty('width');
|
225
|
-
|
226
|
-
await t.expect(zoomOutBookHeight).lt(initialBookHeight);
|
227
|
-
await t.expect(zoomOutBookWidth).lt(initialBookWidth);
|
228
|
-
});
|
229
|
-
|
230
|
-
test('Clicking `zoom in` makes book larger', async t => {
|
231
|
-
const { nav } = br;
|
232
|
-
const page = Selector('.BRpagecontainer.BRpage-visible');
|
233
|
-
|
234
|
-
await t.expect(br.BRcontainer.visible).ok();
|
235
|
-
await t.expect(page.visible).ok();
|
236
|
-
await t.expect(nav.zoomIn.visible).ok();
|
237
|
-
|
238
|
-
const initialBookHeight = await page.getBoundingClientRectProperty('height');
|
239
|
-
const initialBookWidth = await page.getBoundingClientRectProperty('width');
|
240
|
-
|
241
|
-
await t.click(nav.zoomIn);
|
242
|
-
|
243
|
-
const zoomInBookHeight = await page.getBoundingClientRectProperty('height');
|
244
|
-
const zoomIntBookWidth = await page.getBoundingClientRectProperty('width');
|
245
|
-
|
246
|
-
await t.expect(zoomInBookHeight).gt(initialBookHeight);
|
247
|
-
await t.expect(zoomIntBookWidth).gt(initialBookWidth);
|
248
|
-
});
|
249
|
-
|
250
|
-
test('Clicking `full screen button` and BookReader fills browser window', async (t) => {
|
251
|
-
const { nav, BRcontainer } = br;
|
252
|
-
const windowWidth = await ClientFunction(() => window.innerWidth)();
|
253
|
-
|
254
|
-
// initial in-page
|
255
|
-
await t.expect(BRcontainer.getBoundingClientRectProperty('width')).lte(windowWidth);
|
256
|
-
await t.click(nav.fullScreen);
|
257
|
-
// full screen
|
258
|
-
await t.expect(BRcontainer.getBoundingClientRectProperty('width')).eql(windowWidth);
|
259
|
-
await t.click(nav.fullScreen);
|
260
|
-
// in-page
|
261
|
-
await t.expect(BRcontainer.getBoundingClientRectProperty('width')).lte(windowWidth);
|
262
|
-
});
|
263
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Enables a debugging breakpoint in TestCafe tests
|
3
|
-
*
|
4
|
-
* Usage:
|
5
|
-
* import debug from './helpers/debug';
|
6
|
-
*
|
7
|
-
* test(`does a thing`, async (t) => {
|
8
|
-
* await debug(t);
|
9
|
-
* });
|
10
|
-
*/
|
11
|
-
export default async (t) => {
|
12
|
-
await t.debug().setNativeDialogHandler(() => true);
|
13
|
-
};
|