test(fakeweb p2): a round that does not idle keeps the whole in-flight list, what the lifecycle held open at the expiry, and each open request's history on the Juggler wire (+4 unit tests)

(cherry picked from commit c7b8c4533e)
This commit is contained in:
feder-cr committed 2026-11-22 14:26:58 +01:00
1 parent a84cb8d95f
commit 8044dc0cb5
4 files changed
+317 -12

No files matched your search

+2 -2
View File
@@ -14,8 +14,8 @@
{"id": "wrapper.e2e.fakeweb", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_fakeweb_p2_e2e.py", "tests/test_fakeweb_p4_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The fake web, offline: our browser on the hard pages (profile P2: a reused routed page reaches networkidle every time, also under a load of three other browsers; the other site is another process) and on the 17-step journey of a person (profile P4), each judged against what stock Firefox does, as tests/fakeweb/pages.json declares it. 4 = 3 + 1. Stock itself is held to that declaration, and compared with ours step by step, by scripts/run_fakeweb.py in .github/workflows/fakeweb.yml. Needs the candidate binary (STEALTHFOX_E2E_BINARY)."},
{"id": "wrapper.e2e.fontconfig", "giro": "G2", "os": ["linux"], "min_tests": 2, "exact": true, "tests": ["tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py"], "marker": "e2e", "needs_root": false, "linux_only": "Fontconfig exists only on Linux: the parent of the engine shows <GRE>/fonts to it (FcConfigAppFontAddDir) to rebuild a font from a path and a face index. On Windows DirectWrite opens the file from its path, with no folder to scan and no cache to read, so this test has no Windows counterpart.", "note": "2 = (1) the stand-in that runs the engine under strace stays in the engine's place, as the core launches it (the leader of a process group of its own): a fake engine with a child, no browser; the process the launcher holds lives as long as the fake engine, and the group killed holds strace and the child (the stand-in that exec'd setsid forked and exited 0 at once: candidate 44161687675); (2) the warm launch of the parent reads the bundle from fontconfig's cache and does not scan it again (from firefox-66, engine_at_least). Two launches under strace with the same XDG_CACHE_HOME of the test, the first cold and the second warm: the cold parent opens every font file of <GRE>/fonts (the folder as the disk lists it) before any page and fontconfig writes its cache; the warm parent does not open every one of them, and it opens a *.cache-* file of fontconfig (a few files are opened to be used, so the verdict asks about the whole folder, as a scan does). Scan and drawing are told apart by position: only what the parent opens before the first page counts (the opens that draw are written as after_startup). Evidence in RUNNER_TEMP/invpw-evidence/fontconfig-cache: the interval and the number of opens of the bundle, the names of the files of the bundle each launch opened before the first page, the size of the cache file, the VmRSS of the parent after about:blank and after a page with every family, and a third launch with gfx.bundled-fonts.activate=0 (the behaviour before), which is evidence only. Needs strace on the runner: without it both are red, not skipped. No threshold."},
{"id": "wrapper.unit.compositing", "giro": "G1", "os": ["linux", "windows"], "min_tests": 30, "exact": true, "tests": ["tests/test_the_page_bytes_reference_compares_decoded_pixels.py"], "marker": "unit", "needs_root": false, "note": "The helpers of wrapper.e2e.compositing on known inputs, no browser: the PNG compared on decoded pixels (another deBG chunk and compression are the same, one pixel is not, every scanline filter), the comparison with a reference (changed, missing and extra keys named, the entry to record), the type of an engine process, an engine process known by its executable and not by the name it gives itself (Linux), and the CPU of a window, and the shape of the committed Windows reference, and the box cut out of a screenshot (its pixels, a box outside the picture refused, written as a PNG and read back, two boxes told apart by a pixel that is named, the pixels that are not grey)."},
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 2301, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_moving_page_model.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/testLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 2302, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_moving_page_model.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_Line truncated
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 2301, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_moving_page_model.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/testLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 2302, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_moving_page_model.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_Line truncated
{"id": "wrapper.e2e.securitystate", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_security_state_engine_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The security state the core declares, against the engine: the engine launched directly in its generate mode makes what it is given (the contract's result, security_state/ with the bytes of the full filter and of the delta, the core's own validation of it); a normal launch declares no pref of the mode and re-imports nothing; a certificate that Mozilla's CRLite test data say is revoked in a delta is refused at the first navigation (SEC_ERROR_REVOKED_CERTIFICATE) while a valid one loads, and the revoked one loads when the ready directory has no data; a ready directory with no or an empty security_state/ starts. Certificates made on the run (a fresh root trusted in cert9.db by the engine's own xpcshell, Mozilla's default test key as the key of CN=int), servers on loopback, no network. Red on firefox-67 (no generate mode)."},
{"id": "wrapper.e2e.suite.linux.1", "giro": "G2", "os": ["linux"], "min_tests": 376, "exact": true, "tests": ["tests/test_a_closed_browser_leaves_the_others_alone_e2e.py", "tests/test_a_context_that_ends_leaves_no_process_e2e.py", "tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py", "tests/test_a_declared_webgl_extension_survives_its_use_e2e.py", "tests/test_a_granted_permission_is_the_one_the_page_asks_for_e2e.py", "tests/test_a_launch_without_a_session_gets_one_e2e.py", "tests/test_a_left_documents_body_is_evicted_e2e.py", "tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py", "tests/test_a_served_browser_answers_a_plain_client_e2e.py", "tests/test_a_tiny_download_on_a_served_browser_is_saved_e2e.py", "tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py", "tests/test_accept_language_on_the_wire_e2e.py", "tests/test_browser_output_is_drained.py", "tests/test_click_rhythm.py", "tests/test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py", "tests/test_control_a_selects_all_in_a_field_e2e.py", "tests/test_cross_origin_iframe.py", "tests/test_declared_host_network_e2e.py", "tests/test_detectors_e2e.py", "tests/test_e2e.py", "tests/test_element_handle_actions.py", "tests/test_element_screenshot_e2e.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_file_chooser.py", "tests/test_fingerprint_surface.py", "tests/test_fission_frames_history_and_processes_e2e.py", "tests/test_fission_frames_workers_storage_and_special_frames_e2e.py", "tests/test_frames_outlive_the_back_forward_cache_e2e.py", "tests/test_goto_networkidle_after_spa_e2e.py", "tests/test_goto_script_redirect_e2e.py", "tests/test_hidden_display_linux.py", "tests/test_ice_names_by_the_context_proxy_e2e.py::test_the_ice_name_of_a_context_goes_by_the_proxy_of_that_context", "tests/test_ignore_https_errors_e2e.py", "tests/test_injected_node_surface.py", "tests/test_juggler_connection.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_navigation_across_processes_e2e.py", "tests/test_navigation_response.py", "tests/test_networkidle_reaches_the_client_e2e.py", "tests/test_oop_frame_element.py", "tests/test_oop_frame_geometry.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pointer_position.py", "tests/test_popups_reach_the_client_e2e.py", "tests/test_preload_newtab_turns_the_privileged_about_process_off_e2e.py", "tests/test_realness_behind_a_declared_exit_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_route_header_order_e2e.py", "tests/test_same_document_goto_e2e.py", "tests/test_screencast.py", "tests/test_screencast_stop_e2e.py", "tests/test_screenshot_looks_where_you_are.py", "tests/test_security_state_engine_e2e.py", "tests/test_service_worker.py", "tests/test_service_worker_controller_e2e.py", "tests/test_set_offline_e2e.py", "tests/test_shadow_trusted_input.py", "tests/test_strict_and_force.py", "tests/test_the_callers_code_is_not_counted_e2e.py", "tests/test_the_device_enumeration_takes_the_declared_time_e2e.py", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_a_launch_scans_no_process_of_the_machine", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_after_close_no_process_of_the_session_is_left", "tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py", "tests/test_trial_does_not_act.py", "tests/test_turn_over_tcp_is_tried_for_real_e2e.py", "tests/test_ua_widget_not_selectable.py", "tests/test_voices_e2e.py", "tests/test_wait_for_function.py", "tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py", "tests/test_webgl_noise_active.py", "tests/test_webrtc_realness.py::test_a_gateway_that_is_far_away_still_gives_the_page_a_srflx_born_through_its_relay", "tests/test_webrtc_realness.py::test_a_gather_after_the_page_loaded_through_the_gateway_costs_only_the_road_to_the_server", "tests/test_webrtc_realness.py::test_a_host_with_ipv6_addresses_gathers_through_an_ipv4_relay", "tests/test_webrtc_realness.py::test_a_proxy_that_does_not_relay_udp_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_relay_never_answers_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_udp_leaves_from_another_address_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_not_blocked_behind_tcp_only_socks", "tests/test_webrtc_realness.py::test_the_first_candidate_of_a_gather_does_not_wait_for_a_gateway_that_is_far_away", "tests/test_webrtc_realness.py::test_the_turn_over_tcp_of_a_context_goes_through_the_proxy_of_that_context", "tests/test_webrtc_realness.py::test_two_contexts_with_two_proxies_each_gets_the_srflx_of_its_own"], "marker": "e2e", "needs_root": false, "windows_twin"Line truncated
{"id": "wrapper.e2e.suite.linux.2", "giro": "G2", "os": ["linux"], "min_tests": 411, "exact": true, "tests": ["tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py", "tests/test_a_context_init_script_runs_once_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py", "tests/test_a_page_cannot_probe_the_juggler_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_isolated_page_and_the_next_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_caller_world_handles_e2e.py", "tests/test_canvas_reads_as_drawn.py", "tests/test_canvas_render_stealth.py", "tests/test_context_locale_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_download_is_intercepted_e2e.py", "tests/test_drag_motion.py", "tests/test_expose_binding_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_fission_frames_dialogs_downloads_popups_e2e.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fission_iframe_crash_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_to_the_same_url_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_juggler_actions.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_juggler_lifecycle_e2e.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_long_session_e2e.py", "tests/test_mouse.py", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_new_page_defaults.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_proxy_socks_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_e2e.py", "tests/test_route_post_data_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_route_superseded_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screenshot_of_text_returns_linux_e2e.py", "tests/test_scroll_into_view.py", "tests/test_scroll_only_if_needed_e2e.py", "tests/test_service_workers_blocked.py", "tests/test_set_input_files_payloads.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_favicon_stays_out_of_sight_e2e.py", "tests/test_the_font_list_is_the_bundle_e2e.py", "tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py", "tests/test_the_scheme_is_the_personas_e2e.py", "tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_when_the_exit_of_the_lab_is_loopback", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_wait_for_timeout.py", "tests/test_web_fonts_of_closed_contexts_e2e.py"], "marker": "e2e", "needs_root": false, "windows_twin": "wrapper.e2e.suite.windows.2", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 2 rows of linux are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 564 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapLine truncated
+183 -7
View File
@@ -8,6 +8,8 @@ verdict is "same outcome as stock".
"""
from __future__ import annotations
import json
import re
import time
BLOCKED = ("image", "media")
@@ -17,8 +19,9 @@ def install_route(context):
context.route("**/*", lambda route: route.abort() if route.request.resource_type in BLOCKED else route.continue_())
def navigate(page, url, *, idle_timeout_ms, client_log=None):
"""`client_log`, a list (default None: nothing kept), gets one entry per event the client heard (wall time `t`, time.time(), and `m`, time.perf_counter()):
def navigate(page, url, *, idle_timeout_ms, client_log=None, lifecycle_probe=None):
"""`lifecycle_probe`, a function (default None: nothing), is called the moment the wait for networkidle expires and its answer is kept in `lifecycle_open`
of the cell (`lifecycle_open_requests`). `client_log`, a list (default None: nothing kept), gets one entry per event the client heard (wall time `t`, time.time(), and `m`, time.perf_counter()):
the navigation's start and end, and every request, its response and its end. A test that saves evidence when it fails passes it."""
rec = {"idle": False, "err": None, "seconds": None}
# The requests the client has heard of and not yet heard the end of: a navigation that does not idle says who is still in flight
@@ -64,7 +67,15 @@ def navigate(page, url, *, idle_timeout_ms, client_log=None):
except Exception as exc: # recorded, the run goes on: the verdict compares outcomes
text = str(exc).strip()
rec["err"] = (text.splitlines()[0] if text else repr(exc))[:200]
rec["in_flight"] = list(open_requests.values())[:30]
# First thing at the expiry, before anything else is read: what the served browser's own lifecycle holds as open is what keeps networkidle away.
if lifecycle_probe is not None:
rec["expired_at"] = {"t": round(time.time(), 4), "m": round(time.perf_counter(), 6)}
try:
rec["lifecycle_open"] = lifecycle_probe()
except Exception as problem: # the evidence never changes the outcome it is about
rec["lifecycle_open"] = [{"error": repr(problem)}]
# The WHOLE list, not a head of it: what is left open is the question.
rec["in_flight"] = list(open_requests.values())
finally:
for event, handler in (("request", started), ("response", answered), ("requestfinished", ended), ("requestfailed", ended)):
try:
@@ -76,7 +87,168 @@ def navigate(page, url, *, idle_timeout_ms, client_log=None):
return rec
def drive(browser, origin, patterns, repetitions, idle_timeout_ms=10000, client_log=None):
def lifecycle_open_requests(server):
"""What the in-process server of a served browser (`launch_server()`) holds as OPEN, per page: the lifecycle's own map of the requests it waits the end of
(`Lifecycle._open`: request id -> (owner frame, navigation)), each with what the lifecycle knows of its owner frame, and the frame tree. A client cannot
read it: the test reaches the lifecycle through the registry of the server (`RemoteServer._endpoint.server._objects`, whose `Page` objects are the
`PageDispatcher`s, each with its `lifecycle`). Read-only; the lifecycle's lock is taken for at most two seconds, and the dump says when it was not."""
pages = []
for obj in list(server._endpoint.server._objects.values()):
if getattr(obj, "TYPE", None) != "Page":
continue
try:
lifecycle = obj.lifecycle
except Exception:
continue
locked = lifecycle._cv.acquire(timeout=2)
try:
frames = dict(lifecycle.frames)
held = list(lifecycle._open.items())
main = lifecycle.main_frame
tree = lifecycle.frame_tree()
finally:
if locked:
lifecycle._cv.release()
opened = []
for rid, (owner, navigation) in held:
frame = frames.get(owner or main)
opened.append({"rid": rid, "owner": owner, "navigation": navigation, "owner_is_known": (owner in frames) if owner else None,
"owner_url": frame.url if frame else None, "owner_parent": frame.parent if frame else None,
"owner_navigation": frame.navigation if frame else None, "owner_states": sorted(frame.states) if frame else None})
pages.append({"page": obj.guid, "main_frame": main, "lock_taken": locked, "open": opened, "frame_tree": tree})
return pages
# ---- the history of the requests still open, read from the Juggler wire (tests/_evidence_on_failure.py writes it) -----------------------------------
#: The commands that answer an intercepted request, and the events of a frame that matter around a request of it.
INTERCEPT_COMMANDS = ("Network.resumeInterceptedRequest", "Network.abortInterceptedRequest", "Network.fulfillInterceptedRequest")
FRAME_EVENTS = ("Page.frameAttached", "Page.frameDetached", "Page.navigationStarted", "Page.navigationCommitted", "Page.navigationAborted",
"Page.sameDocumentNavigation")
#: Seconds of a frame's events kept before a request and after it.
FRAME_WINDOW = (1.0, 20.0)
_FIELDS = ("requestId", "frameId", "url", "navigationId", "errorCode")
def _string_field(text, name):
found = re.search(r'"%s"\s*:\s*"((?:[^"\\]|\\.)*)"' % name, text)
return found.group(1) if found else None
def _wire_events(lines):
"""The records of the wire log (one JSON per line) as events: time, direction and the message; a message the log cut is read from the fields it still shows."""
events = []
for line in lines:
try:
record = json.loads(line)
except ValueError:
continue
text = record.get("msg") or ""
try:
msg = json.loads(text)
except ValueError:
msg = None
if not isinstance(msg, dict):
number = re.search(r'"id"\s*:\s*(\d+)', text)
msg = {"method": _string_field(text, "method"), "id": int(number.group(1)) if number else None,
"params": {name: _string_field(text, name) for name in _FIELDS}, "_cut": True}
events.append({"t": record.get("t"), "m": record.get("m"), "dir": record.get("dir") or "", "msg": msg})
return events
def _brief(msg, *names):
params = msg.get("params") or {}
return " ".join("%s=%s" % (n, params.get(n)) for n in names if params.get(n) is not None)
def open_requests_history(wire_lines, cells):
"""The text of `p2-open-requests-history.txt`: for each request id the lifecycle held open when a wait for networkidle expired (the `lifecycle_open` of
the cells), in time order, what the Juggler wire says of it: `requestWillBeSent` (frame, interception, address, navigation), each command that answered
the interception and its reply, `responseReceived`, `requestFinished` or `requestFailed` if any, and, around it, the `Page` events of its frame
(frameAttached/Detached, navigationStarted/Committed/Aborted): the history that says who ended it and who did not."""
events = _wire_events(wire_lines)
wanted = {}
for cell in cells or []:
for page in cell.get("lifecycle_open") or []:
for entry in page.get("open") or []:
wanted.setdefault(entry["rid"], []).append((cell, entry))
out = ["The requests the served browser's lifecycle held open when the wait for networkidle expired, and what the Juggler wire says of each.",
"t: wall clock (seconds since the epoch), m: perf_counter of the test process, +s: seconds from the request's requestWillBeSent. Around a request "
"the events of its frame are kept from %.0f s before to %.0f s after. A message longer than the wire log's limit is read from the fields "
"still readable (cut)." % FRAME_WINDOW, ""]
if not wanted:
out.append("No request was held open at an expiry (no cell was not idle, or the lifecycle could not be read).")
return "\n".join(out) + "\n"
by_request, replies = {}, {}
for ev in events:
msg = ev["msg"]
method = msg.get("method")
params = msg.get("params") if isinstance(msg.get("params"), dict) else {}
rid = params.get("requestId")
if rid is not None and method and method.startswith("Network."):
by_request.setdefault(rid, []).append(ev)
elif not method and msg.get("id") is not None and ev["dir"] == "in":
replies.setdefault(msg["id"], []).append(ev)
def line(ev, base, text):
t = ev["t"]
after = (" (+%.3fs)" % (t - base)) if (t is not None and base is not None) else ""
return " t=%s m=%s %s%s %s" % (t, ev["m"], ev["dir"].ljust(3), after, text)
def first_expiry(rid):
return min(((c.get("expired_at") or {}).get("t") or 0) for c, _e in wanted[rid])
for rid in sorted(wanted, key=first_expiry):
out.append("== request %s" % rid)
for cell, entry in wanted[rid]:
expired = cell.get("expired_at") or {}
out.append(" open at the expiry of round %s %s%s (t=%s m=%s): owner frame %s (known to the lifecycle: %s, url %s, its navigation %s, states %s), "
"the request's navigation %s" % (cell.get("round"), cell.get("pattern"), " (canary)" if cell.get("canary") else "",
expired.get("t"), expired.get("m"), entry.get("owner"), entry.get("owner_is_known"),
entry.get("owner_url"), entry.get("owner_navigation"), entry.get("owner_states"),
entry.get("navigation")))
mine = by_request.get(rid, [])
sent = [ev for ev in mine if ev["msg"].get("method") == "Network.requestWillBeSent"]
base = sent[0]["t"] if sent else None
frame = None
if not mine:
out.append(" not on the wire: its requestWillBeSent came before the wire was logged, or from another connection")
for ev in mine:
msg = ev["msg"]
method = msg["method"]
if method == "Network.requestWillBeSent":
frame = frame or (msg.get("params") or {}).get("frameId")
out.append(line(ev, base, "requestWillBeSent %s%s" % (_brief(msg, "frameId", "isIntercepted", "navigationId", "redirectedFrom", "method", "url"),
" (cut)" if msg.get("_cut") else "")))
elif method in INTERCEPT_COMMANDS:
out.append(line(ev, base, "%s sent, id=%s %s" % (method.split(".")[1], msg.get("id"), _brief(msg, "requestId"))))
answers = replies.get(msg.get("id"), [])
for reply in answers:
body = reply["msg"]
verdict = ("error " + json.dumps(body.get("error"), default=str)[:300]) if body.get("error") else "ok"
out.append(line(reply, base, " reply to id=%s: %s" % (msg.get("id"), verdict)))
if not answers:
out.append(" no reply to id=%s on the wire" % msg.get("id"))
else:
out.append(line(ev, base, "%s %s" % (method.split(".")[1], _brief(msg, "errorCode", "url"))))
if mine and not [ev for ev in mine if ev["msg"].get("method") in ("Network.requestFinished", "Network.requestFailed")]:
out.append(" no requestFinished or requestFailed for it on the wire")
if frame is not None and base is not None:
out.append(" events of its frame %s, %.0f s before to %.0f s after the request:" % ((frame,) + FRAME_WINDOW))
shown = 0
for ev in events:
msg = ev["msg"]
params = msg.get("params") if isinstance(msg.get("params"), dict) else {}
if msg.get("method") in FRAME_EVENTS and params.get("frameId") == frame and ev["t"] is not None \
and base - FRAME_WINDOW[0] <= ev["t"] <= base + FRAME_WINDOW[1]:
shown += 1
out.append(line(ev, base, "%s %s" % (msg["method"].split(".")[1], _brief(msg, "navigationId", "url", "parentFrameId", "errorText"))))
if not shown:
out.append(" none")
out.append("")
return "\n".join(out) + "\n"
def drive(browser, origin, patterns, repetitions, idle_timeout_ms=10000, client_log=None, lifecycle_probe=None):
"""Every pattern `repetitions` times, each followed by the canary. Returns a list of cells."""
cells = []
context = browser.new_context()
@@ -86,7 +258,8 @@ def drive(browser, origin, patterns, repetitions, idle_timeout_ms=10000, client_
for rep in range(1, repetitions + 1):
for name in patterns:
for pattern, canary in ((name, False), ("quiet", True)):
cell = navigate(page, "%s/p/%s" % (origin, pattern), idle_timeout_ms=idle_timeout_ms, client_log=client_log)
cell = navigate(page, "%s/p/%s" % (origin, pattern), idle_timeout_ms=idle_timeout_ms, client_log=client_log,
lifecycle_probe=lifecycle_probe)
cell.update(round=rep, pattern=pattern, canary=canary, after=name if canary else None)
cells.append(cell)
finally:
@@ -97,11 +270,14 @@ def drive(browser, origin, patterns, repetitions, idle_timeout_ms=10000, client_
return cells
def run_on_candidate(sync_playwright, binary, origin, patterns, repetitions, **kw):
"""Our engine, served over the Playwright WebSocket and driven by the stock client."""
def run_on_candidate(sync_playwright, binary, origin, patterns, repetitions, lifecycle_dump=False, **kw):
"""Our engine, served over the Playwright WebSocket and driven by the stock client. With `lifecycle_dump`, a cell that does not idle keeps what the
server's lifecycle held open when its wait expired (`lifecycle_open_requests`)."""
from invisible_playwright._juggler.remote import launch_server
server = launch_server(headless=True, binary_path=binary, locale="en-US", timezone="Europe/Rome")
if lifecycle_dump:
kw["lifecycle_probe"] = lambda: lifecycle_open_requests(server)
try:
with sync_playwright() as p:
browser = p.firefox.connect(server.ws_endpoint)
+32 -3
View File
@@ -12,6 +12,7 @@ from __future__ import annotations
import importlib
import json
import pathlib
import sys
import pytest
@@ -26,6 +27,34 @@ HARD = ["leaving_beacons_subframe", "leaving_beacons", "cancel_among_beacons"]
REPETITIONS = 10
class P2Evidence(FailureEvidence):
"""What a round that does not reach networkidle leaves, on top of the helper's own files: `p2-not-idle.json` (each such cell with its WHOLE in-flight list:
type, method, url, frame url, seconds from the navigation's start; and what the served browser's lifecycle held open when the wait expired) and
`p2-open-requests-history.txt` (the history of each of those open requests on the Juggler wire, `profile_p2.open_requests_history`). It only reads what the
helper already saved; a failure of its own is written to stderr and never hides the failure of the test."""
def _save(self, exc_type, exc, kept: str = "") -> None:
self.saved_to = None
super()._save(exc_type, exc, kept)
target = self.saved_to
if target is None:
return
try:
cells = self.cells or []
not_idle = [{key: cell.get(key) for key in ("round", "pattern", "canary", "after", "err", "seconds", "expired_at", "in_flight", "lifecycle_open")}
for cell in cells if not cell.get("idle")]
(target / "p2-not-idle.json").write_text(json.dumps(not_idle, indent=1, default=str), encoding="utf-8")
wire = target / "juggler-wire.jsonl"
lines = wire.read_text(encoding="utf-8").splitlines() if wire.exists() else []
(target / "p2-open-requests-history.txt").write_text(profile_p2.open_requests_history(lines, cells), encoding="utf-8")
meta_path = target / "meta.json"
meta = json.loads(meta_path.read_text(encoding="utf-8"))
meta["files"] = sorted(p.name for p in target.iterdir())
meta_path.write_text(json.dumps(meta, indent=1), encoding="utf-8")
except Exception as problem:
sys.stderr.write("p2 evidence: could not be written: %r\n" % (problem,))
def _stock_client():
"""The stock Playwright client (a pinned dev dependency), imported by name: the fork's guard forbids a static import."""
try:
@@ -135,7 +164,7 @@ def test_the_page_that_leaves_with_beacons_reaches_networkidle_every_time_under_
import tempfile
import time
with FailureEvidence("fakeweb-leaving-beacons-under-load") as evidence:
with P2Evidence("fakeweb-leaving-beacons-under-load") as evidence:
loader = pathlib.Path(__file__).resolve().parent / "fakeweb" / "loader.py"
ready_dir = pathlib.Path(tempfile.mkdtemp(prefix="fakeweb-loaders-"))
ready = [ready_dir / ("loader-%d.ready" % i) for i in range(LOADERS)]
@@ -148,7 +177,7 @@ def test_the_page_that_leaves_with_beacons_reaches_networkidle_every_time_under_
assert wait_until(lambda: all(mark.exists() for mark in ready), 180, lambda: time.sleep(0.25)), "the loaders did not start loading: %s" % [m.name for m in ready if not m.exists()]
evidence.arm()
cells = profile_p2.run_on_candidate(_stock_client(), firefox_binary, origin, ["leaving_beacons_subframe"], 10,
client_log=evidence.client_log)
client_log=evidence.client_log, lifecycle_dump=True)
evidence.note_cells(cells)
finally:
stop()
@@ -163,7 +192,7 @@ def test_the_page_that_leaves_with_beacons_reaches_networkidle_every_time_under_
assert len(cells) == 20, "the run made %d navigations, not 20" % len(cells)
return
bad = ["round %d%s: %s -- in flight: %s" % (c["round"], " (canary)" if c["canary"] else "", c["err"],
[(r["type"], r["method"], r["frame"]) for r in c.get("in_flight", [])[:3]])
[(r["type"], r["method"], r["frame"], r["url"], r["t"]) for r in c.get("in_flight", [])])
for c in cells if not c["idle"]]
assert not bad, "%d of %d navigations did not reach networkidle under load:%s" % (
len(bad), len(cells), "".join("\n " + line for line in bad[:6]))
+100
View File
@@ -0,0 +1,100 @@
"""What the fake web's P2 case keeps when a round does not reach networkidle (no browser): the requests the served browser's lifecycle holds open, and their history on the
Juggler wire.
The lifecycle's open requests are read through the registry of the in-process server (`RemoteServer._endpoint.server._objects`, the `PageDispatcher`s, their
`lifecycle`), from a real `Lifecycle` driven by the events a page's engine sends. The history text (`p2-open-requests-history.txt`) is read from a wire log in the format of
`tests/_evidence_on_failure.py`. Known-bad input: a request whose resume was sent and never answered, whose frame was detached, and that no end ever came for: the text
must say all three, and must not list a request that ended.
"""
from __future__ import annotations
import json
from types import SimpleNamespace
import pytest
from invisible_core.juggler.connection import EventListeners
from invisible_core.juggler.lifecycle import Lifecycle
from fakeweb import profile_p2
pytestmark = pytest.mark.unit
def _server_of(*lifecycles):
objects = {"page@%d" % n: SimpleNamespace(TYPE="Page", guid="page@%d" % n, lifecycle=lc) for n, lc in enumerate(lifecycles)}
objects["browser"] = SimpleNamespace(TYPE="Browser", guid="browser")
return SimpleNamespace(_endpoint=SimpleNamespace(server=SimpleNamespace(_objects=objects)))
def _lifecycle():
lifecycle = Lifecycle(EventListeners(), "session")
lifecycle._on_event("Page.frameAttached", {"frameId": "main", "parentFrameId": None})
lifecycle._on_event("Page.navigationCommitted", {"frameId": "main", "navigationId": "nav-1", "url": "http://a.test/p/x", "name": ""})
lifecycle._on_event("Page.frameAttached", {"frameId": "sub", "parentFrameId": "main"})
return lifecycle
def _sent(rid, frame, navigation=None, intercepted=True):
return {"requestId": rid, "frameId": frame, "navigationId": navigation, "isIntercepted": intercepted, "method": "POST", "url": "http://o.test/beacon"}
def test_the_lifecycle_open_requests_are_read_with_their_owner_frame_and_navigation():
lifecycle = _lifecycle()
lifecycle._on_event("Network.requestWillBeSent", _sent("r-open", "sub", "nav-9"))
lifecycle._on_event("Network.requestWillBeSent", _sent("r-done", "main"))
lifecycle._on_event("Network.requestFinished", {"requestId": "r-done"})
pages = profile_p2.lifecycle_open_requests(_server_of(lifecycle))
assert len(pages) == 1 and pages[0]["lock_taken"] and pages[0]["main_frame"] == "main"
held = {e["rid"]: e for e in pages[0]["open"]}
assert list(held) == ["r-open"], held
assert held["r-open"]["owner"] == "sub" and held["r-open"]["navigation"] == "nav-9" and held["r-open"]["owner_is_known"] is True
assert held["r-open"]["owner_parent"] == "main"
assert pages[0]["frame_tree"]["main"]["url"] == "http://a.test/p/x"
def _wire(*records):
return [json.dumps({"t": t, "m": t - 1000, "dir": d, "len": len(msg), "cut": cut, "msg": msg}) for t, d, msg, cut in records]
def test_the_history_of_an_open_request_has_its_start_its_resume_without_a_reply_and_its_frame_events():
sent = json.dumps({"method": "Network.requestWillBeSent", "params": _sent("r-open", "sub", "nav-9"), "sessionId": "s"})
resume = json.dumps({"id": 7, "method": "Network.resumeInterceptedRequest", "params": {"requestId": "r-open"}, "sessionId": "s"})
detached = json.dumps({"method": "Page.frameDetached", "params": {"frameId": "sub"}, "sessionId": "s"})
other = json.dumps({"method": "Page.navigationCommitted", "params": {"frameId": "elsewhere", "url": "http://x/"}})
done_sent = json.dumps({"method": "Network.requestWillBeSent", "params": _sent("r-done", "main")})
done_end = json.dumps({"method": "Network.requestFinished", "params": {"requestId": "r-done"}})
lines = _wire((1000.0, "in", sent, False), (1000.1, "out", resume, False), (1000.5, "in", detached, False), (1000.6, "in", other, False),
(1000.7, "in", done_sent, False), (1000.8, "in", done_end, False))
lifecycle = _lifecycle()
lifecycle._on_event("Network.requestWillBeSent", _sent("r-open", "sub", "nav-9"))
cell = {"round": 3, "pattern": "leaving_beacons_subframe", "canary": False, "expired_at": {"t": 1011.0, "m": 11.0},
"lifecycle_open": profile_p2.lifecycle_open_requests(_server_of(lifecycle))}
text = profile_p2.open_requests_history(lines, [cell])
assert "== request r-open" in text and "r-done" not in text
assert "open at the expiry of round 3 leaving_beacons_subframe" in text and "owner frame sub" in text
assert "requestWillBeSent frameId=sub isIntercepted=True navigationId=nav-9" in text
assert "resumeInterceptedRequest sent, id=7 requestId=r-open" in text and "no reply to id=7 on the wire" in text
assert "no requestFinished or requestFailed for it on the wire" in text
assert "frameDetached" in text and "elsewhere" not in text
def test_a_reply_and_an_end_are_in_the_history_and_a_cut_message_is_read_from_its_fields():
# longer than the wire log's limit: the log keeps its head, which is no JSON, with the fields that matter in it
sent = json.dumps({"method": "Network.requestWillBeSent", "params": dict(_sent("r1", "main", "nav-1"), postData="x" * 6000)})[:4000]
resume = json.dumps({"id": 4, "method": "Network.resumeInterceptedRequest", "params": {"requestId": "r1"}})
reply = json.dumps({"id": 4, "result": {}})
failed = json.dumps({"method": "Network.requestFailed", "params": {"requestId": "r1", "errorCode": "NS_BINDING_ABORTED"}})
committed = json.dumps({"method": "Page.navigationCommitted", "params": {"frameId": "main", "navigationId": "nav-2", "url": "http://a.test/p/quiet"}})
lines = _wire((50.0, "in", sent, True), (50.1, "out", resume, False), (50.2, "in", reply, False), (50.4, "in", failed, False), (50.5, "in", committed, False))
cell = {"round": 1, "pattern": "quiet", "canary": True, "lifecycle_open": [{"open": [{"rid": "r1", "owner": "main", "navigation": "nav-1"}]}]}
text = profile_p2.open_requests_history(lines, [cell])
assert "requestWillBeSent frameId=main navigationId=nav-1" in text and "(cut)" in text
assert "reply to id=4: ok" in text and "requestFailed errorCode=NS_BINDING_ABORTED" in text
assert "no requestFinished or requestFailed" not in text
assert "navigationCommitted navigationId=nav-2 url=http://a.test/p/quiet" in text
def test_a_run_with_nothing_open_says_so():
assert "No request was held open" in profile_p2.open_requests_history([], [{"round": 1, "idle": True}])
cell = {"round": 2, "lifecycle_open": [{"error": "RuntimeError()"}]}
assert "No request was held open" in profile_p2.open_requests_history([], [cell])