Skip to content
Merged
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 cmake/WKWebViewSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function(webfront_add_wkwebview_tests)
add_executable(wkwebview_lifecycle "${webtest_source_dir}/WKWebViewLifecycle.cpp"
"${webtest_source_dir}/WKWebViewHeaderConsumer.cpp")
target_link_libraries(wkwebview_lifecycle PRIVATE WebFront WebFront_warnings WebFront_options)
foreach(mode repeated-show main-thread native-close quit navigation-diagnostic startup-timeout settings redirect-policy missing-response committed-navigation agent-application download choose-file cancel-choose replaced-download choose-in-blank choose-in-srcdoc close-with-open-panel close-with-save-panel script-dialogs close-with-script-dialog sandboxed-script-dialog)
foreach(mode repeated-show main-thread native-close quit navigation-diagnostic startup-timeout settings hidden-scheduling redirect-policy missing-response committed-navigation agent-application download choose-file cancel-choose replaced-download choose-in-blank choose-in-srcdoc close-with-open-panel close-with-save-panel script-dialogs close-with-script-dialog sandboxed-script-dialog)
Comment thread
ambroise-leclerc marked this conversation as resolved.
Resolved
add_test(NAME WKWebViewLifecycle-${mode} COMMAND wkwebview_lifecycle ${mode})
webfront_set_browser_test_properties("WKWebViewLifecycle-${mode}" "${webtest_source_dir}" 90)
endforeach()
Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ these entries stays in the GitHub releases and the Git history.

### Changed

- Keep automated browser windows visible and reuse one window for the six developer integration parts and additional compatible wf commands (#544, #556, `docs/TEST_PERFORMANCE.md`).
- Declare GCC 13 as the best-effort S2 minimum for the library and examples, document the GCC 14 exit clause and qualified Clang scope, and add GCC 13 ASan/UBSan fast tests (#525, ADR-022).

- Open the developer page on the interface, over the whole window, once the project has a preview; the terminal moves to a floating, movable window behind a tab on the right edge that shows the session's state, and keeps its session when collapsed. Its shortcut is F9, or the manifest's new optional `developer.terminalShortcut`. Environment sources 0.9.1, not published yet (#539, `docs/DEVELOPER_ENVIRONMENT.md`).
Expand All @@ -24,6 +25,7 @@ these entries stays in the GitHub releases and the Git history.

### Fixed

- Read all six developer integration reports in CTest after a part fails, and keep the successful parts' dependent tests runnable, also when the session's native deadline ends it (#556).
- On Windows, `wf install`, `wf build` and `wf test` no longer fail with `rename: Access is denied` while another process, such as an antivirus scan, still reads the files just written: the developer store tries the rename again for up to 635 ms; `wf test` also empties the directory of an interrupted run (#542).
- Run the commit attribution regression checks with older Git versions by dropping the unsupported `git log --no-graph` option (#525).

Expand Down
69 changes: 58 additions & 11 deletions docs/TEST_PERFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ shared within each group, in this order:
| JourneyBuildSession | check, test, build, embed |
| JourneyRestoreSession | missing offline cache, restore, verified offline cache |
| SelfBuildSession | install, build, developer specs, repeat build, permissions refusal |
| WebSuiteSession | install the browser suite, React adapter check and build |
| PublicationSession | React package, services package, site build and repeat |
| WfDriverManifestSession | initialize and install with the manifest in a subdirectory |

The Journey file preparation and cache deletion remain CTest fixtures between sessions. Self-build reproducibility,
refresh, publication and tampering checks retain their own dependencies. The driver writes a JSON result per command;
Expand Down Expand Up @@ -83,17 +86,61 @@ the functional owned/shared-window scenario.

## Visible windows and retained lifecycle contracts

Driver, embedded-distribution and compatible lifecycle windows use `visible=false` on WebView2/WKWebView. They still
create a native window, real engine/controller and native event loop. Window visibility is asserted in the native
lifecycle tests. Failed navigation, close, startup failures, watchdogs and cancellation remain real process tests.
The two macOS executable/dylib registration orders remain separate images and processes, with hidden native windows.

The developer integration keeps its visible interactive terminal and Life preview. The macOS agent-application case
keeps one visible window because its contract asserts visibility and the absence of a Dock icon. The automated direct
transport contract harness retains one native window on each desktop. Linux's real windows are confined to Xvfb. This
budgets **two visible openings on Windows and three on macOS** in the standard configuration; engine-specific manual
benchmarks and diagnostic runs are outside this budget. Restore all diagnostic windows with
`WEBFRONT_TEST_VISIBLE=1`. A hidden WKWebView requires macOS 14+ (public inactive scheduling preference) and a WindowServer session; this is not a headless-engine substitute.
Browser tests keep their windows visible by default on Windows and macOS. Their rendering is a daily visual check;
`WEBFRONT_TEST_VISIBLE=1` is no longer needed. Reduce repeated openings by reusing a window, rather than hiding it.
Linux's real windows remain on the suite's Xvfb display. Explicit tests of hidden-window behavior still use that option.

`DeveloperBrowserSession` opens **one visible native window for all six developer integration parts**, instead of six.
It displays up to four parts concurrently in visible iframe panes, each with its own native application, temporary
project, assigned loopback port and origin. Bootstraps are
staggered until their environment is ready so the archive unpackers do not compete on WebKit's shared JavaScript thread;
the ready pages' commands run in parallel. Each page learns its host's origin from its `?developer-session=<origin>`
query, not from its referrer.
A completed frame is removed and its slot reused; its Workers, listeners
and bridge go away. The same native view then navigates to workspace as a top-level page for its layout/rendering and
keyboard-focus checks; this retains WebKit's original focus ancestry. No active pane is hidden.
All assertions run in their original single-part mode, including workspace's first-launch/failed-first-build checks.
The familiar `DeveloperBrowserIntegration*` CTest names validate separate native reports. The producer fixture succeeds
when all six reports are complete and agree with the process status, even if some parts failed; each report reader
decides its own result and unlocks only its own dependent tests. A crash, missing/invalid report or inconsistent
process status fails the producer. An expired native deadline writes the reports of the parts first (a part that never
reported fails with the deadline as its diagnostic; the application and terminal parts, whose shutdown checks cannot
have run, are reported failed) and then exits with 1, so the parts that finished keep their results. The `--session`
command itself still exits with 1 when any part fails. A nested CTest regression verifies failed and successful readers
as well as their downstream fixtures, and a session ended by a shortened deadline (`WEBFRONT_TEST_DEVELOPER_DEADLINE`,
in seconds, 180 by default), using the same registration helper as the real suite. Each report retains the part's diagnostic. Life's generated header and the terminal's
cancellation check still come from their respective parts. Browser deadlines start after file preparation. An explicit hidden WKWebView
case checks both native invisibility and `inactiveSchedulingPolicy == None`; ordinary windows remain visible.
When the runtime lacks this preference (macOS 13.3), that case checks the documented rejection of hidden sessions.

The driver groups above each use one visible window. This change reduces the three WebSuite/React commands from three
openings to one, publication's four commands from four to one, and manifest-directory init/install from two to one.
With sessions disabled, the original individual commands and the six separate developer windows remain available.
The session reserves four CTest processors to account for its bounded internal parallelism. Each part retains its own
native 180-second deadline, even while other parts finish. Compare full-suite wall time as well as openings before
claiming a speedup. The session prints each part's `connectedMs` and `reportedMs` and the final
`nativeWindows=1 parts=6 durationMs=...` for timing comparisons.

Where the time goes, on macOS 27 with WKWebView (warm caches, 8 cores): the parts take 1.9 to 4.7 s alone, 19.5 s in all,
and 10.8 to 11.4 s run as six separate processes with four workers or as the shared window. In the shared window the five
concurrent parts end after 7 to 9 s (TypeScript, slowed from 4.7 s by the others, is last) and workspace then needs its own
1.9 s at the top level: it is the sequential tail, of the order of the 1.8 s gap of the Windows comparison below (not measured on Windows). Starting TypeScript first and
admitting a fifth pane moved the total from 11.1 s to 10.8 s on this machine; it was not retained, as the CI of that revision
showed a Linux scripts Worker readiness failure and a macOS hang of the nested regression, and 0.3 s does not justify
an unexplained risk. The parts' total is bound by the shared page's JavaScript and Worker work, not by the number of windows. A part's environment is unpacked on every page load,
so a pane cannot warm workspace's bootstrap for its later top-level page.

A local Windows/MSVC Release/WebView2 comparison used the same executable and fixtures, with four workers and no
concurrent compiler: six separate visible windows took 26.89 s; the shared visible window took 28.69 s (28.34 s inside
the native session). All six parts passed in both runs. This single pair demonstrates comparable elapsed time and five
fewer native openings; it does not establish a whole-suite speedup.

Failed navigation, native close, startup failures, watchdogs and cancellation remain real process tests. The two macOS
executable/dylib registration orders remain separate images and processes. `ConsumerJasmine` modes and `Automation*`
retain their own visible windows where they have not yet been grouped; no whole-suite budget of two or three visible
openings is claimed. Hidden WKWebView tests require macOS 14+ and a WindowServer session.
The timed `ConsumerJasmine-capture` sequence reserves four CTest processors too, so another test cannot cover its
visible window and throttle WebKit's rendering while it records.

## Profiling and interpreting the numbers

Expand Down
13 changes: 9 additions & 4 deletions docs/TEST_TIERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ share a process: `test/unit/ScenarioIsolation.cpp` restores the process-wide sta

## Following a browser test live

`DeveloperBrowserIntegration` and its siblings `DeveloperBrowserIntegration-scripts`, `-typescript`, `-jasmine` and `-terminal`
(the parts of `test/web/developer-specs.mjs`, which run in parallel on a port the system picks), the `Automation*` cases and the `WfDriver*` cases run `wf` commands (`create`, `install`,
`DeveloperBrowserIntegration` and its siblings `DeveloperBrowserIntegration-scripts`, `-typescript`, `-jasmine`, `-terminal`
and `-workspace` (the parts of `test/web/developer-specs.mjs`), the `Automation*` cases and the `WfDriver*` cases run `wf` commands (`create`, `install`,
`build`, `dev`, `preview`, `embed`, ...) that can take several seconds each. CTest hides the output of a passing test, so
to watch one:

Expand All @@ -40,8 +40,13 @@ ctest --test-dir build -R DeveloperBrowserIntegration -V # CTest prints t
ctest --test-dir build -R DeveloperBrowserIntegration -N -V # prints the command to run `developer_integration` directly
```

Run `developer_integration` with a fixtures directory and an output directory but no `--part=` to play every part in one
session, as the test did before it was cut; `--part=app|scripts|typescript|jasmine|terminal` plays one.
`DeveloperBrowserSession` displays all six parts in one visible native window, with a fresh page, project and origin per
part. `DeveloperBrowserIntegration*` keep their original names and check its independent reports. Run
`developer_integration <fixtures> <output> --session` directly to follow the shared window. Configure
`-DWEBFRONT_TEST_SESSIONS=OFF` to compare the separate-process path.

Run `developer_integration` with a fixtures directory and an output directory but no `--part=` for the older mode in
which all parts share one project; `--part=app|scripts|typescript|jasmine|terminal|workspace` plays one in its own visible window.

```bash
```
Expand Down
8 changes: 4 additions & 4 deletions docs/WEBVIEW2.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ A literal `+` in the path is automatically encoded as `%2B`: `show("a+b.html")`

The shared `path-encoding` lifecycle case opens `encoded path %23.html` under every frontend and checks the query and fragment (reaching the page proves the decoded filename); the Jasmine suite, which runs in a frame of the developer environment, serves `a+b.html` through the C++ URL builder. Catch2 also checks this path at the system-browser launcher boundary and verifies shell quoting. On Windows the system browser is opened directly with `ShellExecute`, without a command shell; POSIX launches quote the URL as one argument.

## Quiet automated sessions
## Window visibility

The per-opening options include `visible` (default `true`). Setting it to `false` creates the real native window and
engine without presenting or focusing the window. This retains the native event loop and startup/navigation deadlines;
it does not provide a sandbox or a headless engine. On macOS a WindowServer session is still required. The test driver
uses this option and supports `WEBFRONT_TEST_VISIBLE=1` for interactive diagnostics.
See [TEST_PERFORMANCE](TEST_PERFORMANCE.md) for the visible-window budget and retained lifecycle cases.
it does not provide a sandbox or a headless engine. Automated tests keep their windows visible by default and share
compatible sessions to reduce repeated openings. Explicit tests of hidden-window behavior still use this option.
See [TEST_PERFORMANCE](TEST_PERFORMANCE.md) for the shared sessions and retained lifecycle cases.
9 changes: 5 additions & 4 deletions docs/WKWEBVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,14 @@ Timed measurements are excluded from CTest and CI. [ADR-017](adr/ADR-017-acces-d
their measurements and the consequences of Apple's public APIs for a future direct transport, including the
Foundation type boundary, handler lifetime, origins and custom resource schemes. iOS remains unverified.

## Quiet automated sessions
## Window visibility

The per-opening options include `visible` (default `true`). Setting it to `false` creates the real native window and
engine without presenting or focusing the window. This retains the native event loop and startup/navigation deadlines;
it does not provide a sandbox or a headless engine. On macOS a WindowServer session is still required. The test driver
uses this option and supports `WEBFRONT_TEST_VISIBLE=1` for interactive diagnostics.
See [TEST_PERFORMANCE](TEST_PERFORMANCE.md) for the visible-window budget and retained lifecycle cases.
it does not provide a sandbox or a headless engine. On macOS a WindowServer session is still required. Automated tests
keep their windows visible by default and share compatible sessions to reduce repeated openings. Explicit tests of
hidden-window behavior still use this option. See [TEST_PERFORMANCE](TEST_PERFORMANCE.md) for the shared sessions and
retained lifecycle cases.

Hidden sessions require macOS 14+ and use the public `WKPreferences::inactiveSchedulingPolicy` value `None` so
asynchronous bridge and Worker work continues after the load event. Visible sessions retain macOS 13.3 support.
Loading
Loading