Commit graph

146 commits

Author SHA1 Message Date
Tim Ledbetter
a9261b9daf test-web: Don't include skipped tests in --dry-run output 2026-06-19 09:47:55 +02:00
Shannon Booth
a8cb98ccf7 Tests: Support WPT reftests with multiple references
Store reftest expectations as a list of match/mismatch reference URLs
and evaluate each reference in sequence.

This lets test-web run WPT reftests that specify multiple reference
relations, such as tests with both match and mismatch links.
2026-06-14 22:12:00 +02:00
Andreas Kling
0aaae1ac76 Tests/LibWeb: Cover UI-owned session history
Teach test-web to expose the UI-process history dump. Add focused
navigation tests for same-document traversal, fallback traversal, and
cross-document browser back and forward behavior. The expectations
assert document state and the UI-owned history snapshot.
2026-06-14 17:38:44 +02:00
Sam Atkins
e805e86ea8 test-web: Report invalid test variants instead of VERIFY()ing
Co-authored-by: sideshowbarker <mike@w3.org>
2026-06-10 13:40:42 +01:00
Sam Atkins
dbe2ba74d7 test-web: Move test-collection code into its own files
No behaviour changes.
2026-06-10 13:40:42 +01:00
Sam Atkins
85d401d1f9 test-web: Move test-variant handling code into its own files
No behaviour changes.
2026-06-10 13:40:42 +01:00
Andreas Kling
37e7526367 LibGfx: Split image decoders into a separate library
Move the image loader sources and decoder-only dependencies from LibGfx
into a new LibImageDecoders library. This keeps the APNG-enabled PNG
loader out of processes that only need core graphics and image writers.

Link the ImageDecoder service, direct decoder tests, fuzzers, test-web,
and the image utility against LibImageDecoders where they still decode
images in-process.
2026-06-10 11:55:48 +02:00
Sam Atkins
10bca58c3d test-web: Stop runtime WPT variant discovery
After the previous commit, variant tests are already expanded out during
collection, so we no longer need to ask running tests if they have
variants.
2026-06-09 16:48:33 +02:00
Sam Atkins
69b457c993 test-web: Expand WPT variants before running tests
Scan sources of Text tests during collection to identify test variants,
using a very basic HTML parser. All tests with variants use the same
pattern for their meta tags, so even this is overkill for what we need,
but it should work for any future tests that happen to be arranged a
little differently.
2026-06-09 16:48:33 +02:00
Sam Atkins
3a5767809a test-web: Share variant path construction code 2026-06-09 16:48:33 +02:00
Shannon Booth
472b0a3baa Tests/LibWeb: Use unique localhost hosts for echo-served tests
Load tests that require the echo server through a per-test
*.localhost hostname instead of plain localhost. This prevents shared
per-host browser state, from leaking between parallel or repeated test
runs.

Update HTTPTestServer to create echo URLs on the current origin when a
test is already loaded from the echo server, preserving same-origin
behavior for tests that inspect echo-served iframes.
2026-06-06 13:48:43 +02:00
InvalidUsernameException
2635c334b0 test-web: Exit more gracefully if --test-path is not provided 2026-06-04 17:52:59 +02:00
InvalidUsernameException
8e21673577 test-web: Do not crash test runner on missing ref-test expectation file
Individual tests should not be able to crash the runner. Instead simply
fail the test in question.
2026-06-04 17:52:59 +02:00
Aliaksandr Kalenik
626dc6ff3f LibWebView+WebContent: Make page IDs browser-assigned
Page IDs were allocated independently by each WebContent PageHost,
starting at zero for every process. That made them unsuitable as a
global identity for page-presenting compositor contexts, because the
same numeric page ID could exist in multiple WebContent processes.

Move page ID allocation to WebView::Application and initialize each
WebContent process with its browser-assigned first page ID over IPC.
New view requests now get a browser-assigned page ID before
WebContent creates the PageClient, and PageHost no longer owns a
local page counter.

This gives page-presenting compositor contexts a stable global page
identity, which will allow their context IDs to be derived from page
IDs and simplify compositor context allocation in a follow-up.
2026-05-30 17:30:00 +01:00
sideshowbarker
ae2783e705 Tests: Stop dropping post-navigation load events in Text-mode tests
Problem: Text-mode tests that perform a top-level cross-document
navigation can hang forever — even when the target page reports PASS.
For example, the connect-src test in Tests/LibWeb/Text/input/navigation/
has been intermittently timing out on CI for months, and has its own
in-test workaround. But that’s a mitigation that just narrows the race.

Cause: The Text-mode on_load_finish handler in test-web/main.cpp filters
by URL and bails out if the loaded URL doesn’t match the test’s original
URL — to ignore subframe loads. But page_did_finish_loading is already
gated on navigable->is_traversable(). So, it’s top-level-only — and the
URL filter is actually rejecting load events from top-level navigations
away from the original test URL.

When the original page’s did_finish_loading IPC hasn’t reached test-web
by the time the navigation target loads and signals PASS, the target’s
did_finish_loading is the only surviving load notification — and the URL
filter masks it. So, did_finish_loading is never set test-side. And so
the test-finish handler then bails on the did_finish_loading &&
did_check_variants check — and the test hangs.

Fix: Drop the URL filter from the Text-mode on_load_finish handler. Any
top-level load (the original page, or any subsequent navigation) now
sets did_finish_loading. The variant-loading logic is unchanged: The
second variant-check just no-ops — because test.variant is already set
from the first response.
2026-05-30 11:20:01 +02:00
Andreas Kling
faf7e4c720 Tests: Support platform screenshot expectations
Look for screenshot expectations in an expected-<platform>
directory before using the shared expected directory. This lets tests
that cover system-derived rendering keep platform-specific baselines
without making other platforms use the same PNG.
2026-05-29 13:49:51 +02:00
Sam Atkins
d3ad37e635 Meta: Define helper processes for Ladybird and test-web in one place
These both require the same helper processes, and maintaining the same
list in multiple places is error-prone. For example, I spent too long
debugging why test-web was crashing, when the issue was that Compositor
hadn't been rebuilt as test-web didn't depend on it. That problem can
no longer happen if we define the same dependency list for both.
2026-05-28 14:45:48 +01:00
Andreas Kling
a289601eb0 LibWeb: Expose content blocker test controls
Add internals helpers so text tests can install local blocker rules and
toggle content blocking without browser-process IPC. Clear installed
rules after each non-crashed test-web case so blocker state cannot leak
into the next test.
2026-05-21 21:16:56 +02:00
Andreas Kling
6be5e80025 LibWebView: Share content blocker lists as buffers
Add a repeatable blocker-list option that reads local list files in the
browser process. The files are concatenated into one buffer and shared
with WebContent through the content blocker IPC path when view options
are applied.

Parse the buffer in WebContent and reject malformed UTF-8 without
replacing the currently installed rules.
2026-05-21 21:16:56 +02:00
Andreas Kling
46e1a08742 LibWeb: Rename ContentFilter to ContentBlocker
Rename the local content blocking implementation and its tests from
ContentFilter to ContentBlocker while keeping the existing substring
matcher backend and behavior.

Update the WebContent IPC method, WebView option names, debug toggle,
and default config file name to use content blocker terminology.
2026-05-21 21:16:56 +02:00
Andreas Kling
ac8887e34d Tests: Preserve LibWeb harness diagnostics on early exits
Keep a small harness-status.txt file in the test-web results
directory and refresh it whenever tests start, finish, or the run stops
early. This leaves the last known active views, counts, and remaining
test count behind even if the harness does not reach its normal result
generation path.

Also report helper-process log write failures instead of treating them
as "no logs". That makes artifact gaps visible instead of silently
losing the only clue from a helper process failure.
2026-05-13 13:32:49 +02:00
Andreas Kling
774407f0ed test-web: Route helper process exit log through the captured output
The exit-status line added in b71d82645b was being written with outln()
straight to stdout, which corrupts the live progress bar that the
default display renders on stdout during a run.

Send it through log_helper_message() instead, attributed to the exiting
process. That way the line lands at the tail of that pid's section in
helper-process-logs.html, only tees to the terminal when verbosity is
raised to VERBOSITY_LEVEL_LOG_TEST_OUTPUT, and stays out of the way of
the progress display in normal runs. Drain the helper's pending output
via consume_helper_capture() first so the exit message appears after
the process's final output rather than before it.
2026-05-13 00:50:58 +02:00
Andreas Kling
b71d82645b test-web: Log why the test runner exits early
Log active views and tests when test-web stops before all tests have
completed. Reuse the same reporting for signal handling, and accept any
future signal registration without asserting while explaining shutdown.

Also log observed helper process exits with decoded Unix wait status so
CI logs show whether a process exited normally or died from a signal.
2026-05-12 20:57:08 +02:00
Andreas Kling
a031d00695 WebContent: Exit cleanly when browser IPC disconnects
Exit WebContent immediately when either browser-side IPC peer
disconnects. Plumb Unix process exit status through LibWebView so the
browser process can tell clean owner-driven shutdown apart from renderer
crashes.

This keeps nonzero exits and signal deaths reported as crashes, while
letting status 0 exits disappear without making test-web report the page
as crashed.
2026-05-12 20:57:08 +02:00
Andreas Kling
191bd46cb8 LibWeb: Add compositor scroll state snapshots
Record the scroll geometry that CompositorThread can safely reason about
while the main thread is painting. The snapshot contains stable scroll
node IDs, parent links, scroll bounds, sticky inputs, and wheel blocker
regions in display-list coordinate space.

Add AsyncScrollingState and AsyncScrollTree under LibWeb/Compositor. The
state is the immutable main-thread snapshot; the tree is the mutable
compositor-side copy that can replay scroll deltas and sticky offsets
without touching DOM, layout, or paintables.

Expose the state through internals and add text tests for tree shape,
parent links, sticky areas, blocker hit testing, nested scrollers, and
admission decisions. Keep the directory skipped unless the feature is
enabled with --enable-async-scrolling.
2026-05-12 20:57:08 +02:00
Tim Ledbetter
b116e42f3c test-web: Wait for PDF.js layers to render before signalling completion
Previously, we signalled completion of a PDF test once the
`pagesloaded` event fired. This fires once page metadata is initialized
but the text and annotation layers are rendered asynchronously after
that. We now wait for the text and annotation layers of the first page
to render. The test runner will currently fail for PDFs with more than
one page bceause pages are loaded lazily once they are visible and
there's no guarantee that anything beyond the first page will be loaded.
2026-05-07 11:23:46 +02:00
Undefine
b9fec5edbf Meta: Rename and merge some lagom_* and ladybird_*
We had both {lagom,ladybird}_test and {lagom,ladybird}_lib, now both
are just one helper. Also rename all other lagom_* helpers to be
ladybird_*.
2026-05-05 22:08:24 +02:00
Johan Dahlin
f7499105dd LibWeb: Implement inline PDF viewing using the bundled pdf.js viewer 2026-04-30 07:46:12 +02:00
Jelle Raaijmakers
d8ad66d95d Tests/LibWeb: Dispatch TestRendered event when reftest-wait is present
This furthers our compatibility with WPT tests.
2026-04-29 20:28:15 +02:00
Ali Mohammad Pur
909013b972 LibWeb+LibTest: Move the progress bar/status printing stuff to LibTest 2026-04-23 18:48:56 +02:00
Tim Ledbetter
6f3833e857 test-web: Inject JS wait script into layout tests
This script waits until fonts have loaded and waits for 2 animation
frames before signalling test completion. This is the same mechanism
already used for ref and crash tests.
2026-04-22 15:35:07 +01:00
Jonathan Gamble
736ee40db0 test-web: Dont leak captured fds when a helper process dies 2026-04-21 20:01:41 +02:00
Undefine
e39a8719fd Meta: Move most dependency checks to check_for_dependencies.cmake
This file was here for quite a long while now. Let's finally move most
of the dependency checks to one centralized place.
2026-04-20 16:41:29 -06:00
Jonathan Gamble
3ca76a42ec test-web: Break live display and terminal code out of main.cpp 2026-04-20 20:26:40 +02:00
Jonathan Gamble
e8ca424b13 test-web: Compensate live display for short terminals 2026-04-20 20:26:40 +02:00
Jonathan Gamble
7279917b5b test-web: Remove deferred warnings
Deferred warnings were originally  intended to suppress output during
live display, ostensibly to avoid glitch scrolls.

Then, 1af74d1a7c added log capture to the
test-web process. Suddenly, deferred warnings became deadly because
they're flushed during a tiny window after the capture notifier has
stopped draining the tee pipe but before stderr is restored.

This caused a deadlock at exit. The fix is to remove this system and
call warnln directly because display integrity is now protected by
other means.
2026-04-20 20:26:40 +02:00
Jonathan Gamble
778402640a test-web: Add run date and "copy run command" button to results header 2026-04-15 17:09:50 +02:00
Jonathan Gamble
1af74d1a7c test-web: Capture all browser and helper process output
This prevents glitches where stale test status lines can bleed above
the live display list. Log this additional captured output so it can
be reviewed if a main or helper process failure is suspected.
2026-04-15 17:09:50 +02:00
Jonathan Gamble
f8618915cb test-web: Move convert_ansi_to_html to CaptureFile.cpp 2026-04-15 17:09:50 +02:00
Jonathan Gamble
be7266326c test-web: Consolidate output capture handling
Use files instead of buffers. Consolidate stderr and stdout into one
view. Break handling out into TestRunCapture and CaptureFile helper
classes. We will use them to log output from ALL processes in the next
commit.
2026-04-15 17:09:50 +02:00
Jonathan Gamble
8b550f2a8b test-web: Remove --debug-timeouts
It's almost 100% useless in practice and not worth the noise.
2026-04-15 17:09:50 +02:00
Aliaksandr Kalenik
700026637d test-web: Add quiet mode for AI agent environments
When test-web runs inside Claude Code or Codex, per-test progress lines
are suppressed. These environments are non-interactive and the per-test
output (potentially thousands of lines) wastes the agent's context
window without adding value. The agent only needs the pass/fail summary
to decide next steps.

Quiet mode preserves: the "Running N tests..." line, the summary table,
non-passing test names, and the results URL.
2026-04-01 11:51:59 +02:00
Sam Atkins
cce85705f6 test-web: Prevent ref tests from injecting JS multiple times
This is a little more complicated than screenshot tests, because we deal
with two separate page loads, for the test and expectation pages. When
loading the expectation page, we clear the did_inject_js flag and also
store the URL so that we can compare that later.
2026-03-31 19:29:43 +01:00
Sam Atkins
84e72243d4 test-web: Prevent screenshot tests from injecting JS multiple times
Keep track of whether we've injected the JS, and avoid doing so again.

Also skip this entirely unless we're actually dealing with the test's
URL and not a subframe. This check is already done on dump tests.
2026-03-31 04:55:21 +01:00
Sam Atkins
fff3d76e55 test-web: Disconnect test-wait MutationObserver after firing
The MutationObserver was not disconnected after firing, so any other
modifications to the document's class attribute after that point would
signal the test completing again. This is unlikely to happen in
practice as we shouldn't be running any JS after completing a test, but
it's harmless to disconnect it.
2026-03-31 04:55:21 +01:00
Undefine
b9e5c0e98c Meta: Replace all use of LADYBIRD_PROJECT_ROOT with LADYBIRD_SOURCE_DIR
Those two are equivalent so no need to have two different variables.
2026-03-29 13:59:11 -06:00
Jelle Raaijmakers
d139b519d3 Tests/LibWeb: Add button to copy the test name in test-web results 2026-03-20 14:22:25 +01:00
Jelle Raaijmakers
e817b13c2a Tests/LibWeb: Centralize on_set_test_timeout logic
We don't need three copies of this.
2026-03-20 10:47:39 +01:00
Jelle Raaijmakers
fe5ffbce53 Tests/LibWeb: Centralize timeout logic and include about:blank load
We had three separate timeout timer sites in `test-web`, which are now
deduplicated into a single one. This single timeout timer is started
_before_ we start loading `about:blank`, which potentially catches more
timeouts when a WebContent process is left in a broken state by a
previous test.
2026-03-20 10:47:39 +01:00
Zaggy1024
ac69815740 Everywhere: Add an is_fullscreen parameter to set_viewport
This will be used by the UIs to notify WebContent when fullscreen for
content is entered or exited.
2026-03-17 18:58:37 -05:00