Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BookReaderDemo/IADemoBr.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const initializeBookReader = (brManifest) => {
enableFSLogoShortcut: true,
plugins: {
search: {
initialSearchTerm: searchTerm ? searchTerm : '',
initialSearchTerm: searchTerm,
},
},
};
Expand Down
1 change: 1 addition & 0 deletions BookReaderDemo/demo-internetarchive.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

<!-- plugins needed for archive.org, in same order as archive.org -->
<script src="/BookReader/plugins/plugin.search.js"></script>
<script src="/BookReader/plugins/plugin.search.ol-mobile.js"></script>
<script src="/BookReader/plugins/plugin.chapters.js"></script>
Comment thread
mekarpeles marked this conversation as resolved.
<script src="/BookReader/plugins/plugin.tts.js"></script>
<script src="/BookReader/plugins/plugin.url.js"></script>
Expand Down
98 changes: 98 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"@iiif/presentation-2": "^1.0.4",
"@iiif/presentation-3": "^2.1.3",
"@open-wc/testing-helpers": "3.0.1",
"@playwright/test": "1.60.0",
"@types/jest": "30.0.0",
"@webcomponents/webcomponentsjs": "^2.6.0",
"babel-loader": "10.1.1",
Expand Down Expand Up @@ -134,6 +135,8 @@
"DOCS:update:test-deps": "If CI succeeds, these should be good to update",
"update:test-deps": "npm i @babel/eslint-parser@latest @open-wc/testing-helpers@latest @types/jest@latest eslint@7 eslint-plugin-testcafe@latest jest@latest jest-environment-jsdom@latest sinon@latest testcafe@latest",
"DOCS:update:build-deps": "These can cause strange changes, so do an npm run build + check file size (git diff --stat), and check the site is as expected",
"update:build-deps": "npm i @babel/core@latest @babel/preset-env@latest @babel/plugin-proposal-class-properties@latest @babel/plugin-proposal-decorators@latest babel-loader@latest core-js@latest regenerator-runtime@latest sass@latest svgo@latest webpack@latest webpack-cli@latest"
"update:build-deps": "npm i @babel/core@latest @babel/preset-env@latest @babel/plugin-proposal-class-properties@latest @babel/plugin-proposal-decorators@latest babel-loader@latest core-js@latest regenerator-runtime@latest sass@latest svgo@latest webpack@latest webpack-cli@latest",
"test:playwright": "npx playwright test",
"test:playwright:ci": "npm run build && npx playwright test"
}
}
34 changes: 34 additions & 0 deletions playwright.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// @ts-check
import { defineConfig, devices } from '@playwright/test';

const BASE_URL = process.env.BASE_URL?.replace(/\/+$/, '') ?? 'http://127.0.0.1:8000';

export default defineConfig({
testDir: './tests/playwright',
timeout: 60_000,
retries: process.env.CI ? 1 : 0,
workers: 1, // OL mobile tests are sequential (share server state)
reporter: [['html', { open: 'never' }], ['line']],
use: {
baseURL: BASE_URL,
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
projects: [
{
name: 'mobile-chrome',
use: {
...devices['Pixel 5'], // Chromium-based mobile device
browserName: 'chromium',
},
},
],
// Assumes `npm run build && npx http-server -p 8000 -c-1 .` is already running.
// Set reuseExistingServer so CI can start it externally.
webServer: {
command: 'npx http-server -p 8000 -c-1 .',
port: 8000,
reuseExistingServer: true,
timeout: 15_000,
},
});
2 changes: 1 addition & 1 deletion src/BookReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ BookReader.prototype.initParams = function() {
// If we have a query string: q=[term]
const searchParams = new URLSearchParams(this.readQueryString());
const searchTerm = searchParams.get('q');
if (searchTerm) {
if (searchTerm != null) {
sp.options.initialSearchTerm = utils.decodeURIComponentPlus(searchTerm);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/css/BookReader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ $brScope: ".BookReader, .BRfloat";
@import 'TextSelection';
@import 'BRComponent';
@import 'BRBookmarks';
@import 'BRolMobile';
Loading