Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
89a8f2e
The Moon's picture is made on a canvas kept in memory, so reading it …
epheterson Nov 12, 2026
90fff36
A scroll inside the open card menu no longer closes it, and the keep …
epheterson Nov 12, 2026
75c4b69
Tests: Home's apps are read in the turn that sorted them, and the dot…
epheterson Nov 12, 2026
69e1d37
Tests: the Manage Maps redraw is counted in the turn that announces t…
epheterson Nov 12, 2026
da992ce
Tests: the station's two-finger slide is read after each move has rea…
epheterson Nov 12, 2026
4e201f4
Tests: the Almanac tables page starts from a page that has finished g…
epheterson Nov 12, 2026
320e3f1
Tests: the clock's page holds the sky still, and lands a moment by th…
epheterson Nov 12, 2026
2d6b49d
Tests: the star tap begins after the Almanac's late work
epheterson Nov 12, 2026
5dcff45
Tests: the Almanac tables page's Back test waits for the page's state…
epheterson Nov 12, 2026
3c7fbc5
Tests: the sheet above the keyboard is read when its transition has r…
epheterson Nov 12, 2026
286aa08
Tests: the clock's waits on the page's state are bounded as a hang, n…
epheterson Nov 12, 2026
0504eeb
Tests: three fixed sleeps in the card tests are waits for the state t…
epheterson Nov 12, 2026
7c47e84
Tests: the AM/PM flip is read frame by frame on held time, not on the…
epheterson Nov 12, 2026
12d8519
Tests: the browsers that draw WebGL in software draw 2D canvases on t…
epheterson Nov 12, 2026
2c3e33f
Tests: the PDF failure toast is recorded as it is added, not looked f…
epheterson Nov 12, 2026
32fd9bf
Voices on the portable build: the data folder beside the executable i…
epheterson Nov 12, 2026
01f090f
Merge branch 'fix/voices-portable-env' into v1.15.7
epheterson Nov 13, 2026
940c44b
Zimi 1.15.7
epheterson Nov 13, 2026
7cc7c0b
Rebuild the Almanac ZIM for 1.15.7 (the Moon picture change is in its…
epheterson Nov 13, 2026
2476cc8
Refresh the shipped catalog snapshots for 1.15.7
epheterson Nov 13, 2026
202358e
Tests: the paused ring is looked for while the card redraws, not read…
epheterson Nov 13, 2026
a5ad0b5
Place the 21 StreetZim maps the refreshed catalog added
epheterson Nov 13, 2026
e2d900c
zimi doctor --check says why a venv could not be made instead of a tr…
epheterson Nov 13, 2026
9c69e8a
Undo a formatter's rewrap of runtimes.py; keep only the venv fix
epheterson Nov 13, 2026
61d15e3
Tests: the games sync test reads the account once the push has reache…
epheterson Nov 13, 2026
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

## [1.15.7]

### Highlights

**Zimi**

- Voices install on the portable Linux build, pip step included (#151).
- A card's menu no longer closes by itself while a download updates.
- Changing the date no longer freezes the page on machines without a graphics card.

## [1.15.6]

### Highlights
Expand Down
5 changes: 3 additions & 2 deletions ci/smoke_portable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ci/smoke_portable.sh <unpacked-folder> [path-to-a-test.zim]
# Copies the folder to a fresh "stick" with a zimi-data and a zims folder beside the executable, then:
# `serve -d` answers /health with the ZIM, leaves zimi.pid and zimi.log in zimi-data, writes its state there
# and nowhere else, `doctor --check` passes, `service print` points at this executable, and stopping it
# and nowhere else, `doctor --check` passes (it makes a venv under the data folder and imports ssl with its python), `service print` points at this executable, and stopping it
# removes the pid file.
set -euo pipefail

Expand All @@ -28,7 +28,8 @@ echo "zimi config (the portable folder decides the paths)..."
"$Z" config | tee "$STICK/config.txt"
grep -q "portable" "$STICK/config.txt" || { echo "FAIL: config does not show the portable folder"; exit 1; }

echo "zimi doctor --check (also: the machine's python3, started from the app, is not handed the bundle's libraries, #151)..."
echo "zimi doctor --check (also: the machine's python3, and a venv python made in the data folder beside the executable"
echo "(what voices run pip with), started from the app, are not handed the bundle's libraries, #151)..."
"$Z" doctor --check | tee "$STICK/doctor.txt"
grep -q "would not run properly" "$STICK/doctor.txt" && { echo "FAIL: the app leaks its environment to outside programs"; exit 1; }

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "zimi"
version = "1.15.6"
version = "1.15.7"
description = "Offline knowledge server for ZIM files — search and read Wikipedia, Stack Overflow and 50+ sources with no internet"
readme = "README.md"
license = {text = "GPL-3.0-or-later"}
Expand Down
22 changes: 22 additions & 0 deletions scripts/build_map_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,28 @@
"osm-washington-dc": [-77.6, 38.6, -76.6, 39.2],
"osm-west-africa": [-18.0, 4.0, 16.0, 28.0],
"osm-west-asia": [25.0, 12.0, 63.5, 42.5],
# Added with the 2026-11-13 catalog refresh.
"osm-athens": [23.4, 37.8, 24.1, 38.2],
"osm-cairo": [30.9, 29.8, 31.6, 30.3],
"osm-india-central": [73.5, 17.5, 84.5, 26.9],
"osm-india-central-light": [73.5, 17.5, 84.5, 26.9],
"osm-india-east": [83.0, 17.8, 89.9, 27.3],
"osm-india-east-light": [83.0, 17.8, 89.9, 27.3],
"osm-india-northeast": [89.6, 21.9, 97.5, 29.5],
"osm-india-northeast-light": [89.6, 21.9, 97.5, 29.5],
"osm-india-northwest": [68.1, 23.9, 81.1, 37.1],
"osm-india-northwest-light": [68.1, 23.9, 81.1, 37.1],
"osm-india-south-light": [74.0, 8.0, 85.0, 19.9],
"osm-india-west": [68.1, 15.6, 80.9, 24.7],
"osm-india-west-light": [68.1, 15.6, 80.9, 24.7],
"osm-kyiv": [30.2, 50.2, 30.9, 50.6],
"osm-moscow": [36.8, 55.1, 38.0, 56.0],
"osm-osaka": [135.1, 34.4, 135.8, 34.9],
"osm-seoul": [126.7, 37.4, 127.2, 37.7],
"osm-south-central-us": [-109.1, 25.8, -88.8, 37.0],
"osm-taipei": [121.3, 24.9, 121.7, 25.2],
"osm-tehran": [51.1, 35.5, 51.7, 35.9],
"osm-thailand": [97.3, 5.6, 105.7, 20.5],
}


Expand Down
1 change: 1 addition & 0 deletions tests/test_almanac_back_to_1x_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
VIEW = {"width": 390, "height": 844}
Expand Down
1 change: 1 addition & 0 deletions tests/test_almanac_bodyinfo_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
PHONE = {"width": 390, "height": 844}
Expand Down
136 changes: 87 additions & 49 deletions tests/test_almanac_clock_browser.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/test_almanac_flyto_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
VIEW = {"width": 390, "height": 844}
Expand Down
1 change: 1 addition & 0 deletions tests/test_almanac_hd_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
VIEW = {"width": 390, "height": 844}
Expand Down
1 change: 1 addition & 0 deletions tests/test_almanac_iss_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
PLACE = '{"lat":37.77,"lon":-122.42,"name":"San Francisco"}'
Expand Down
1 change: 1 addition & 0 deletions tests/test_almanac_landmarks_bodies_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
VIEW = {"width": 390, "height": 844}
Expand Down
1 change: 1 addition & 0 deletions tests/test_almanac_landmarks_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
VIEW = {"width": 390, "height": 844}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_almanac_layout_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
GL_ARGS = (
[]
if sys.platform == "darwin"
else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"]
else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"]
)
VIEW = {"width": 390, "height": 844}
PLACE = {"lat": 37.7749, "lon": -122.4194, "name": "San Francisco"}
Expand Down
1 change: 1 addition & 0 deletions tests/test_almanac_link_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
READY_MS = 180_000
Expand Down
2 changes: 1 addition & 1 deletion tests/test_almanac_live_sky_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"]
GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"]
VIEW = {"width": 390, "height": 844}
PLACE = {"lat": 37.7749, "lon": -122.4194, "name": "San Francisco"}
DAY = "2026-09-30T21:00:00Z" # 14:00 in San Francisco, the Sun high in the south
Expand Down
2 changes: 1 addition & 1 deletion tests/test_almanac_look_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
GL_ARGS = (
[]
if sys.platform == "darwin"
else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"]
else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"]
)
VIEW = {"width": 390, "height": 844}
PLACE = {"lat": 37.7749, "lon": -122.4194, "name": "San Francisco"}
Expand Down
9 changes: 8 additions & 1 deletion tests/test_almanac_pan_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
VIEW = {"width": 390, "height": 844}
Expand Down Expand Up @@ -171,9 +172,15 @@ def test_two_fingers_slide_the_view_across_the_station_and_pinch_zooms(station):
dist0 = pg.evaluate("() => _ae.dist")
# Two fingers 120 px apart move together 40 px right and 30 px down, spreading to 160 px: slide and zoom at once.
touches(cdp, "touchStart", [(135, 400), (255, 400)])
# Moves reach the page aligned to its frames, and a frame holds only the latest of the moves sent before it: two sent
# back to back on a slow runner arrive as one (the spread and the slide together), and the slide is then measured
# at a different distance from the station. Each is sent once the page has taken the one before.
touches(cdp, "touchMove", [(115, 415), (275, 415)])
pg.wait_for_function(
"() => !!_ae.pinch && _ae.pinch.span === 160 && _ae.pinch.mx === 195 && _ae.pinch.my === 415",
timeout=10_000,
)
touches(cdp, "touchMove", [(155, 430), (315, 430)])
# Moves reach the page aligned to its frames: the state is read once the last one has, not while it is on its way.
pg.wait_for_function(
"() => !!_ae.pinch && _ae.pinch.span === 160 && _ae.pinch.mx === 235 && _ae.pinch.my === 430",
timeout=10_000,
Expand Down
1 change: 1 addition & 0 deletions tests/test_almanac_phone_defects_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
VIEW = {"width": 390, "height": 844}
Expand Down
1 change: 1 addition & 0 deletions tests/test_almanac_places_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
VIEW = {"width": 390, "height": 844}
Expand Down
1 change: 1 addition & 0 deletions tests/test_almanac_planets_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
VIEW = {"width": 390, "height": 844}
Expand Down
17 changes: 16 additions & 1 deletion tests/test_almanac_sky_physical_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"]
GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"]
VIEW = {"width": 390, "height": 844}
PLACE = {"lat": 37.7749, "lon": -122.4194, "name": "San Francisco"}
NIGHT = "2026-08-10T08:00:00Z" # 01:00 in San Francisco, Sagittarius low in the south
Expand Down Expand Up @@ -124,6 +124,20 @@ def _settle(pg, iso):
)


def _page_has_done_its_late_work(pg):
"""Until the page has drawn what it draws when it is quiet and given back the space it reserved for it.

The Almanac's late sections are drawn from a queue that runs between the page's other work, and the tide's reserved
height is released when it is done (17 s after load on a loaded runner, the page 24 px shorter). A test that reads a
place on the page, then acts on it in another turn, begins after that, not on the moment the runner's speed picks.
"""
pg.wait_for_function(
"() => { const p = document.getElementById('almanac-place');"
" return !_quietJobs.length && !_quietBusy && (!p || p.style.minHeight === ''); }",
polling=POLL_MS,
)


def _drawn(pg):
"""Until the GPU sky has its data and has painted with it."""
pg.wait_for_function(
Expand Down Expand Up @@ -624,6 +638,7 @@ def test_every_bright_star_can_be_tapped_and_its_figure_comes_with_it(browser, s
try:
_settle(pg, NIGHT)
_drawn(pg)
_page_has_done_its_late_work(pg)
pg.wait_for_function("() => _skyNames && _skyTapStars > 500", polling=POLL_MS)
# Nothing asks for the constellations while the default (no lines) stands.
_frames(pg)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_almanac_skyfind_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
GL_ARGS = (
[]
if sys.platform == "darwin"
else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"]
else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"]
)
VIEW = {"width": 390, "height": 844}
PLACE = {"lat": 37.7749, "lon": -122.4194, "name": "San Francisco"}
Expand Down
1 change: 1 addition & 0 deletions tests/test_almanac_spin_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
GL_ARGS = [
"--use-angle=swiftshader",
"--enable-unsafe-swiftshader",
"--disable-accelerated-2d-canvas",
"--ignore-gpu-blocklist",
]
VIEW = {"width": 390, "height": 844}
Expand Down
51 changes: 31 additions & 20 deletions tests/test_almanac_tables_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"]
GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"]
VIEW = {"width": 390, "height": 844}
SF = {
"lat": 37.7749,
Expand Down Expand Up @@ -117,6 +117,14 @@ def page(served):
pg.on("pageerror", lambda e: pg.errors.append(str(e)))
pg.goto(served + "/#almanac", wait_until="load")
pg.wait_for_function("() => document.getElementById('alm-group-tables')")
# The page keeps growing after it is first drawn: its late sections come when the page is quiet, and the
# tide's reserved space is given back when the tide (or nothing) is drawn. Tests that measure the page's
# height or its end start from there, not from a moment the runner's speed picks.
pg.wait_for_function(
"() => { const p = document.getElementById('almanac-place');"
" return typeof _atRender === 'function' && !!p && p.style.minHeight === '' && !_quietJobs.length && !_quietBusy; }",
timeout=120_000,
)
pg.evaluate("typeof _cancelAllRAF === 'function' && _cancelAllRAF()")
yield pg
br.close()
Expand Down Expand Up @@ -403,11 +411,12 @@ def test_a_sheet_stands_above_the_keyboard(page):
"() => { const vv = window.visualViewport; Object.defineProperty(vv, 'height', { configurable: true, get: () => innerHeight - 300 });"
" vv.dispatchEvent(new Event('resize')); }"
)
# (It moves by a transition: read it once that has run.)
# (It moves by a transition: read it once that has run. A transition ends at the first frame past its time, and a
# runner software-drawing the page makes seconds between frames: the bound is a hang's, not the transition's.)
page.wait_for_function(
"() => { const p = document.querySelector('.tk-pop'), q = p.querySelector('input'), top = innerHeight - 300;"
" return p.getBoundingClientRect().bottom <= top + 1 && q.getBoundingClientRect().bottom <= top; }",
timeout=5000,
timeout=30_000,
)
page.evaluate("() => { delete window.visualViewport.height; }")
page.keyboard.press("Escape")
Expand Down Expand Up @@ -625,12 +634,9 @@ def test_back_returns_to_the_almanac_where_it_was(page):
page.evaluate(
"window.AlmanacRef && document.getElementById('alm-ref') && AlmanacRef.close()"
)
page.wait_for_timeout(300)
page.evaluate("document.getElementById('alm-group-tables').scrollIntoView()")
# The late sections (the tide) and the phone's header settle first.
page.wait_for_timeout(2000)
page.wait_for_function("() => !document.getElementById('alm-ref')")
# The late sections (the tide) are in, and the reserve given back, from the page fixture on.
page.evaluate("document.getElementById('alm-group-tables').scrollIntoView()")
page.wait_for_timeout(500)
top = page.evaluate("document.getElementById('almanac-content').scrollTop")
page.evaluate("document.querySelector(\".alm-tile[data-tb='seasons']\").click()")
page.wait_for_function(DRAWN, timeout=60000)
Expand All @@ -645,16 +651,12 @@ def test_back_returns_to_the_almanac_where_it_was(page):
page.evaluate("document.querySelector(\".alm-tile[data-tb='units']\").click()")
page.wait_for_function(DRAWN, timeout=60000)
page.go_back()
page.wait_for_function("() => !document.getElementById('alm-ref')")
page.wait_for_timeout(300)
assert page.evaluate("_almanacOpen")
page.wait_for_function("() => !document.getElementById('alm-ref') && _almanacOpen")
# The view's own Back.
page.evaluate("document.querySelector(\".alm-tile[data-tb='days']\").click()")
page.wait_for_function(DRAWN, timeout=60000)
page.click("[data-tb-close]")
page.wait_for_function("() => !document.getElementById('alm-ref')")
page.wait_for_timeout(300)
assert page.evaluate("_almanacOpen")
page.wait_for_function("() => !document.getElementById('alm-ref') && _almanacOpen")
assert not page.errors, page.errors


Expand Down Expand Up @@ -1228,6 +1230,17 @@ def busy_once(route):
assert not page.errors, page.errors


# The failure toast lives 3 s from the moment it is made, and the browser's dialog is asked for after the fonts and two
# frames: on a runner drawing a frame a second the toast is gone before the dialog is asked for. What the test asserts is
# that it was shown, so it is recorded as it is added, not looked for after.
WATCH_TOASTS = """() => {
window.__toasts = [];
new MutationObserver((records) => records.forEach((r) => r.addedNodes.forEach((n) => {
if (n.nodeType === 1 && n.tagName === 'DIV') window.__toasts.push(n.textContent);
}))).observe(document.body, { childList: true });
}"""


def test_still_busy_after_the_retry_prints_the_page(page):
"""Busy twice: the toast, then the browser's own dialog over the book."""
_open(page, "seasons")
Expand All @@ -1242,16 +1255,15 @@ def busy(route):
)

page.route("**/almanac/pdf", busy)
page.evaluate(WATCH_TOASTS)
page.evaluate(
"() => { window.__printed = 0; window.__pr = window.print; window.print = () => { window.__printed++; }; }"
)
try:
page.click("[data-tb-act='print']")
page.wait_for_function("() => window.__printed === 1", timeout=30000)
assert len(seen) == 2
assert page.evaluate(
"[...document.querySelectorAll('body > div')].some((d) => d.textContent === t('tb_pdf_failed'))"
)
assert page.evaluate("t('tb_pdf_failed')") in page.evaluate("window.__toasts")
page.evaluate("_tbPrintOff()")
finally:
page.unroute("**/almanac/pdf")
Expand All @@ -1267,6 +1279,7 @@ def test_print_falls_back_to_the_page_when_the_pdf_fails(page):
"**/almanac/pdf",
lambda route: route.fulfill(status=500, body='{"error": "render failed"}'),
)
page.evaluate(WATCH_TOASTS)
page.evaluate(
"() => { window.__printed = 0; window.__pr = window.print; window.__book = 0;"
" window.print = () => { window.__printed++; window.__book = document.querySelectorAll('#alm-book .tb-book-page').length; }; }"
Expand All @@ -1275,9 +1288,7 @@ def test_print_falls_back_to_the_page_when_the_pdf_fails(page):
page.click("[data-tb-act='print']")
page.wait_for_function("() => window.__printed === 1", timeout=60000)
assert page.evaluate("window.__book") == 1
assert page.evaluate(
"[...document.querySelectorAll('body > div')].some((d) => d.textContent === t('tb_pdf_failed'))"
)
assert page.evaluate("t('tb_pdf_failed')") in page.evaluate("window.__toasts")
assert not page.evaluate("readerOpen")
page.evaluate("_tbPrintOff()")
finally:
Expand Down
Loading
Loading