Merge pull request #562 from oss-invisible/tests/actions-without-a-point-evidence
tests: the hidden-elements actions test keeps its evidence when it fails (second batch of the intermittent e2e)
This commit is contained in:
4 files changed
+323
-19
No files matched your search
@@ -14,7 +14,7 @@
|
||||
{"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": 2261, "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_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_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/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", Line truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 2262, "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_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_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_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.Line truncated
|
||||
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 2271, "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_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_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/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", Line truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 2272, "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_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_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_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.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)."}
|
||||
]
|
||||
+131
-8
@@ -19,10 +19,15 @@ import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
from _far_away_probes import LoadSampler, StallWitness
|
||||
from _far_away_probes import Records as ProbeRecords
|
||||
|
||||
#: The events of a page the client hears, recorded with the frame they are about.
|
||||
FRAME_EVENTS = ("frameattached", "framenavigated", "framedetached")
|
||||
#: The most records of the wire the summary keeps (the window of one test is a few hundred messages).
|
||||
SUMMARY_LIMIT = 600
|
||||
#: The most commands without an answer the summary says (a browser that is closed leaves a few; the evidence has the wire itself).
|
||||
UNANSWERED_LIMIT = 20
|
||||
#: The commands that carry code to a context.
|
||||
_CALLS = ("Runtime.evaluate", "Runtime.callFunction")
|
||||
#: The events of the engine that say which frame and which world exist, and when they come and go.
|
||||
@@ -175,23 +180,92 @@ class FrameWatch(Records):
|
||||
pass
|
||||
|
||||
|
||||
def unanswered_line(self, limit: int = 3) -> str:
|
||||
"""The commands the wire reading found with no answer, in one line each (id, method, context and its frame's url, seconds waited, whether the
|
||||
context was announced and whether it was destroyed). Empty when there is none. Never raises."""
|
||||
try:
|
||||
with self.wire.lock:
|
||||
found = [r for r in self.wire.records if r.get("event") == "command without an answer"]
|
||||
parts = []
|
||||
for r in found[:limit]:
|
||||
end = r.get("context_at_the_end") or {}
|
||||
frame = r.get("frame_at_the_end") or {}
|
||||
parts.append("%s #%s to context %s (frame %s, %s) had no answer after %ss; context %s" % (
|
||||
r.get("method"), r.get("id"), r.get("executionContextId"), end.get("frame"), frame.get("url"), r.get("waited_s"),
|
||||
"not announced in the window" if not end else ("destroyed at m=%s" % end.get("destroyed_m") if end.get("destroyed_m") else "alive")))
|
||||
return "; ".join(parts)
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
|
||||
class ProcessProbes:
|
||||
"""The stall witness and the runner's CPU load of ``tests/_far_away_probes.py``, on the clock of the wire: ``m`` is ``time.perf_counter()``
|
||||
(their epoch is 0, so ``from_gw`` and ``to_gw`` are ``m``). A beat that is late is a stall of the whole test process, the one that also holds
|
||||
the client's reader of the Juggler pipe; a quiet process and a call that gets no answer put the stall in the browser or in the context, not
|
||||
in the client. ``evidence.note_records`` keeps both lists. Nothing here raises: both recorders keep a failure as a record."""
|
||||
|
||||
def __init__(self, load_source=None):
|
||||
self.stall_records, self.load_records = ProbeRecords(), ProbeRecords()
|
||||
self.witness = StallWitness(self.stall_records, 0.0, clock=time.perf_counter)
|
||||
self.sampler = LoadSampler(self.load_records, 0.0, source=load_source, clock=time.perf_counter)
|
||||
|
||||
def keep_in(self, evidence) -> None:
|
||||
evidence.note_records("stalls-of-the-test-process", self.stall_records)
|
||||
evidence.note_records("runner-load", self.load_records)
|
||||
|
||||
def start(self) -> None:
|
||||
self.witness.start()
|
||||
self.sampler.start()
|
||||
|
||||
def stop(self) -> None:
|
||||
self.witness.stop()
|
||||
self.sampler.stop()
|
||||
|
||||
def line(self) -> str:
|
||||
"""Stalls and load in one short line (``m`` of each stall). Never raises."""
|
||||
try:
|
||||
stalls = sorted(self.witness.stalls(), key=lambda r: -r["gap_s"])
|
||||
if stalls:
|
||||
said = ", ".join("%.2fs at m=%.2f" % (r["gap_s"], r["from_gw"]) for r in stalls[:3])
|
||||
stall = "%d stall(s) of the test process over %.0f ms: %s" % (len(stalls), self.witness.stall_s * 1000, said)
|
||||
else:
|
||||
stall = "no stall of the test process over %.0f ms (%d beats, longest gap %.3fs)" % (
|
||||
self.witness.stall_s * 1000, self.witness.beats, self.witness.longest_gap_s)
|
||||
cpu = [r["cpu_percent"] for r in self.sampler.samples()]
|
||||
load = "runner CPU max %.0f%%, mean %.0f%% in %d samples" % (max(cpu), sum(cpu) / len(cpu), len(cpu)) if cpu else "runner CPU: no sample"
|
||||
return "%s; %s" % (stall, load)
|
||||
except Exception as problem:
|
||||
return "stalls and load: not read (%r)" % (problem,)
|
||||
|
||||
|
||||
class OnFailure:
|
||||
"""``with OnFailure(evidence, watch):`` around the body of a test: when the body fails, the frames and the wire reading are added and the
|
||||
evidence is saved (the folder the e2e jobs upload); the exception goes on, the very one the body raised."""
|
||||
|
||||
def __init__(self, evidence, watch: FrameWatch):
|
||||
def __init__(self, evidence, watch: FrameWatch, probes: ProcessProbes = None):
|
||||
self.evidence = evidence
|
||||
self.watch = watch
|
||||
self.probes = probes
|
||||
|
||||
def __enter__(self):
|
||||
self.watch.start(self.evidence)
|
||||
self._probes("start")
|
||||
return self
|
||||
|
||||
def _probes(self, action: str) -> None:
|
||||
try:
|
||||
if self.probes is not None:
|
||||
getattr(self.probes, action)()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def __exit__(self, exc_type, exc, tb):
|
||||
self._probes("stop")
|
||||
try:
|
||||
if exc_type is not None and issubclass(exc_type, Exception): # not a skip, not an interrupt
|
||||
self.watch.note("failure", {"type": exc_type.__name__, "message": str(exc)[:1500]})
|
||||
self.watch.at_failure(self.evidence)
|
||||
self._say(exc)
|
||||
try:
|
||||
self.evidence._save(exc_type, exc)
|
||||
except Exception as problem:
|
||||
@@ -205,6 +279,24 @@ class OnFailure:
|
||||
pass
|
||||
return False
|
||||
|
||||
def _say(self, exc) -> None:
|
||||
"""A note on the exception the body raised (the very object, its type and message untouched): what the wire says of the commands with no
|
||||
answer, and the stalls and load of the process. It is read in the failure report next to the traceback."""
|
||||
try:
|
||||
lines = []
|
||||
unanswered = self.watch.unanswered_line()
|
||||
if unanswered:
|
||||
lines.append("wire: " + unanswered)
|
||||
if self.probes is not None:
|
||||
lines.append("process: " + self.probes.line())
|
||||
if lines:
|
||||
self.watch.note("said at the failure", {"lines": lines})
|
||||
add_note = getattr(exc, "add_note", None)
|
||||
if add_note is not None:
|
||||
add_note("evidence of this failure: " + " | ".join(lines))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
# ---- the wire --------------------------------------------------------------------------------------------------------
|
||||
def _short(text, limit=160):
|
||||
@@ -217,19 +309,40 @@ def summarize_wire(path, since_m=None, marker: str = "window.__r") -> list:
|
||||
(``perf_counter``) on: the engine's frame and context events with their ids, urls and names; each ``Runtime.evaluate`` or ``callFunction`` sent
|
||||
with its context id and the beginning of its code; each answer to one of those (its error text, if it has one); and, for every command whose code
|
||||
contains ``marker``, a ``marker command`` record that joins the context id it was sent to with what the wire knows of that context (its frame id
|
||||
and name, when it was announced and when it was destroyed) and of that frame (the url it last committed, its parent). A line of the log
|
||||
that is not JSON, or was cut at the log's limit, is counted, not read. Never raises: a failure is a record."""
|
||||
and name, when it was announced and when it was destroyed) and of that frame (the url it last committed, its parent). Whatever the code, every
|
||||
command that has no answer by the end of the log gets a ``command without an answer`` record with the same join, taken when it was sent and at
|
||||
the end of the log, and the time it has waited: the evaluate that a client gave up on (``no response in 30s``) is there whether or not its code
|
||||
has the marker. An answer says how long after its command it came (``after_s``). A line of the log that is not JSON, or was cut at the log's
|
||||
limit, is counted, not read. Never raises: a failure is a record."""
|
||||
try:
|
||||
return _summarize_wire(path, since_m, marker)
|
||||
except Exception as problem:
|
||||
return [{"event": "the wire could not be read", "error": repr(problem)}]
|
||||
|
||||
|
||||
def _join(contexts, frames, context_id):
|
||||
"""What the wire knows now of a context, of its frame and of the frame's parent (copies: the entries change later); ``None`` for what it does
|
||||
not know (a context announced before the window, or never)."""
|
||||
context = dict(contexts.get(context_id) or {}) or None
|
||||
frame = dict(frames.get((context or {}).get("frame")) or {}) or None
|
||||
parent = dict(frames.get((frame or {}).get("parent")) or {}) or None
|
||||
return context, frame, parent
|
||||
|
||||
|
||||
def _after(start_m, end_m):
|
||||
try:
|
||||
return round(end_m - start_m, 4)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def _summarize_wire(path, since_m, marker) -> list:
|
||||
out = []
|
||||
contexts = {} # context id -> {"frame", "name", "created_m", "destroyed_m"}
|
||||
frames = {} # frame id -> {"url", "name", "parent", "attached_m", "detached_m", "committed_m"}
|
||||
sent = {} # command id -> the record of the command
|
||||
waiting = {} # command id -> what the wire knew of its context and frame when it was sent, until it is answered
|
||||
last_m = None
|
||||
unparsed = 0
|
||||
with open(path, "r", encoding="utf-8", errors="replace") as handle:
|
||||
for line in handle:
|
||||
@@ -250,6 +363,7 @@ def _summarize_wire(path, since_m, marker) -> list:
|
||||
continue
|
||||
if not isinstance(message, dict):
|
||||
continue
|
||||
last_m = m if last_m is None else max(last_m, m)
|
||||
base = {"t": row.get("t"), "m": m, "dir": row.get("dir")}
|
||||
method, params = message.get("method"), message.get("params") or {}
|
||||
if row.get("dir") == "out" and method in _CALLS:
|
||||
@@ -258,16 +372,17 @@ def _summarize_wire(path, since_m, marker) -> list:
|
||||
executionContextId=params.get("executionContextId"), code=_short(code))
|
||||
sent[message.get("id")] = record
|
||||
out.append(record)
|
||||
context, frame, parent = _join(contexts, frames, params.get("executionContextId"))
|
||||
waiting[message.get("id")] = {"record": record, "context": context, "frame": frame, "parent": parent}
|
||||
if marker and marker in str(code):
|
||||
context = dict(contexts.get(params.get("executionContextId")) or {}) or None # copies: the entries change later
|
||||
frame = dict(frames.get((context or {}).get("frame")) or {}) or None
|
||||
parent = dict(frames.get((frame or {}).get("parent")) or {}) or None
|
||||
out.append(dict(base, event="marker command", id=message.get("id"), executionContextId=params.get("executionContextId"),
|
||||
context=context, frame=frame, parent=parent))
|
||||
elif row.get("dir") == "in" and message.get("id") in sent:
|
||||
answer = message.get("error")
|
||||
result = message.get("result")
|
||||
out.append(dict(base, event="answer", id=message.get("id"), to=sent[message.get("id")].get("code"),
|
||||
command = sent[message.get("id")]
|
||||
waiting.pop(message.get("id"), None)
|
||||
out.append(dict(base, event="answer", id=message.get("id"), to=command.get("code"), after_s=_after(command.get("m"), m),
|
||||
error=_short(answer, 400) if answer is not None else None,
|
||||
result=_short(json.dumps(result, default=str), 300) if answer is None else None))
|
||||
elif row.get("dir") == "in" and method in _EVENTS:
|
||||
@@ -289,6 +404,14 @@ def _summarize_wire(path, since_m, marker) -> list:
|
||||
if len(out) >= SUMMARY_LIMIT:
|
||||
out.append({"event": "summary cut", "limit": SUMMARY_LIMIT})
|
||||
break
|
||||
out.append({"event": "summary end", "unparsed_lines": unparsed, "since_m": since_m,
|
||||
for command_id, known in list(waiting.items())[:UNANSWERED_LIMIT]:
|
||||
record = known["record"]
|
||||
context_now, frame_now, parent_now = _join(contexts, frames, record.get("executionContextId"))
|
||||
out.append({"event": "command without an answer", "id": command_id, "method": record.get("method"), "sessionId": record.get("sessionId"),
|
||||
"executionContextId": record.get("executionContextId"), "code": record.get("code"), "sent_m": record.get("m"),
|
||||
"waited_s": _after(record.get("m"), last_m), "context_known_when_sent": known["context"] is not None,
|
||||
"context_when_sent": known["context"], "frame_when_sent": known["frame"], "parent_when_sent": known["parent"],
|
||||
"context_at_the_end": context_now, "frame_at_the_end": frame_now, "parent_at_the_end": parent_now})
|
||||
out.append({"event": "summary end", "unparsed_lines": unparsed, "last_m": last_m, "commands_without_an_answer": len(waiting), "since_m": since_m,
|
||||
"contexts_known": len(contexts), "frames_known": len(frames)})
|
||||
return out
|
||||
@@ -16,6 +16,8 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from _evidence_on_failure import FailureEvidence
|
||||
from _frame_evidence import FrameWatch, OnFailure, ProcessProbes
|
||||
from invisible_core.juggler.actions import Actions, ElementNotActionable
|
||||
|
||||
MAIN = "frame-main"
|
||||
@@ -101,17 +103,38 @@ t.addEventListener('blur', e => got.push('blur'));
|
||||
</script>"""
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def evidence():
|
||||
"""What a failing run leaves for a reader and nothing a test waits for or asserts: the Juggler wire and the engine's own trace (armed before the
|
||||
browser is launched: the engine reads its trace folder at launch), the client's view of the frames and calls, the reading of the wire (every
|
||||
evaluate with the context, frame and times it went to, and the ones with no answer), and the stalls of the test process and the runner's load.
|
||||
Saved only when the body of the test fails (``OnFailure``); the folder is the one the e2e jobs upload."""
|
||||
held = FailureEvidence("actions-without-a-point")
|
||||
watch = FrameWatch()
|
||||
probes = ProcessProbes()
|
||||
held.note_records("client-view-of-the-frames", watch)
|
||||
held.note_records("juggler-wire-reading", watch.wire)
|
||||
probes.keep_in(held)
|
||||
held.arm()
|
||||
try:
|
||||
yield held, watch, probes
|
||||
finally:
|
||||
held.__exit__(None, None, None)
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
def test_hidden_elements_take_the_actions_playwright_allows(firefox_binary):
|
||||
def test_hidden_elements_take_the_actions_playwright_allows(firefox_binary, evidence):
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
held, watch, probes = evidence
|
||||
with InvisiblePlaywright(seed=42, binary_path=firefox_binary,
|
||||
humanize=False, headless=True) as browser:
|
||||
page = browser.new_page()
|
||||
page.set_content(PAGE)
|
||||
page.dispatch_event("#b", "click", timeout=30_000)
|
||||
page.focus("#t", timeout=30_000)
|
||||
page.locator("#t").blur(timeout=30_000)
|
||||
humanize=False, headless=True) as browser, OnFailure(held, watch, probes):
|
||||
page = watch.observed("new_page", browser.new_page)
|
||||
watch.listen(page, "page")
|
||||
watch.observed("set_content", lambda: page.set_content(PAGE))
|
||||
watch.observed("dispatch_event", lambda: page.dispatch_event("#b", "click", timeout=30_000))
|
||||
watch.observed("focus", lambda: page.focus("#t", timeout=30_000))
|
||||
watch.observed("blur", lambda: page.locator("#t").blur(timeout=30_000))
|
||||
# A display:none input cannot take focus, so only the dispatched
|
||||
# click reaches a listener; what matters is that none of the three
|
||||
# timed out asking a hidden element for a point.
|
||||
|
||||
@@ -10,7 +10,11 @@ recording is made to fail on purpose, and the watched call is the same:
|
||||
* ``OnFailure`` lets the body's exception through, the same one, when the frames cannot be read, the wire cannot be read and the save raises; it
|
||||
saves nothing for a skip;
|
||||
* the reading of the wire joins the context id an evaluate was sent to with the frame and url that context belongs to, and the answer; a log
|
||||
with lines that are not JSON, or a file that is not there, gives records and no exception.
|
||||
with lines that are not JSON, or a file that is not there, gives records and no exception;
|
||||
* the reading of the wire also says, for every command with no answer whatever its code, where it was sent (context, frame, url), how long it has
|
||||
waited and whether its context was destroyed since: the ``Runtime.evaluate`` of ``set_content`` has no marker in its code;
|
||||
* the stall witness and the load sampler that ``OnFailure`` may start never raise into the body, whatever they or the exception's own
|
||||
``add_note`` do, and what they say is a note on the exception, not a change of it.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -18,7 +22,7 @@ import json
|
||||
|
||||
import pytest
|
||||
|
||||
from _frame_evidence import FrameWatch, OnFailure, Records, summarize_wire
|
||||
from _frame_evidence import FrameWatch, OnFailure, ProcessProbes, Records, summarize_wire
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
@@ -269,3 +273,157 @@ def test_a_records_list_keeps_what_it_is_given_and_never_raises():
|
||||
records = Records(records=_Refuses())
|
||||
records.add({"event": "x"})
|
||||
assert list(records.records) == []
|
||||
|
||||
|
||||
# ---- a command with no answer, whatever its code -----------------------------------------------------------------------------
|
||||
def _page_rows():
|
||||
return [
|
||||
_row(1.0, "in", {"method": "Page.frameAttached", "params": {"frameId": "top", "parentFrameId": None}}),
|
||||
_row(1.1, "in", {"method": "Page.navigationCommitted", "params": {"frameId": "top", "url": "about:blank", "name": ""}}),
|
||||
_row(1.2, "in", {"method": "Runtime.executionContextCreated", "params": {"executionContextId": "ctx-1", "auxData": {"frameId": "top", "name": ""}}}),
|
||||
_row(1.3, "out", {"id": 3, "method": "Runtime.evaluate", "sessionId": "s1",
|
||||
"params": {"executionContextId": "ctx-1", "expression": "(() => { document.open(); document.write(1); })()"}}),
|
||||
_row(1.4, "out", {"id": 4, "method": "Runtime.callFunction", "sessionId": "s1",
|
||||
"params": {"executionContextId": "ctx-1", "functionDeclaration": "() => 1"}}),
|
||||
_row(1.5, "in", {"id": 4, "result": {"value": 1}}),
|
||||
]
|
||||
|
||||
|
||||
def test_a_command_with_no_answer_is_joined_with_its_context_though_its_code_has_no_marker(tmp_path):
|
||||
wire = tmp_path / "wire.jsonl"
|
||||
_write(wire, _page_rows() + [
|
||||
_row(31.3, "in", {"method": "Runtime.executionContextDestroyed", "params": {"executionContextId": "ctx-1"}}), # after it was sent
|
||||
])
|
||||
records = summarize_wire(wire, since_m=1.0)
|
||||
assert not [r for r in records if r["event"] == "marker command"]
|
||||
(silent,) = [r for r in records if r["event"] == "command without an answer"]
|
||||
assert silent["id"] == 3 and silent["method"] == "Runtime.evaluate" and silent["executionContextId"] == "ctx-1"
|
||||
assert "document.open()" in silent["code"] and silent["sent_m"] == 1.3 and silent["waited_s"] == 30.0
|
||||
assert silent["context_known_when_sent"] and silent["context_when_sent"]["frame"] == "top"
|
||||
assert silent["context_when_sent"]["destroyed_m"] is None and silent["context_at_the_end"]["destroyed_m"] == 31.3
|
||||
assert silent["frame_when_sent"]["url"] == "about:blank"
|
||||
end = records[-1]
|
||||
assert end["event"] == "summary end" and end["commands_without_an_answer"] == 1 and end["last_m"] == 31.3
|
||||
answered = [r for r in records if r["event"] == "answer"][0]
|
||||
assert answered["id"] == 4 and abs(answered["after_s"] - 0.1) < 1e-9
|
||||
|
||||
|
||||
def test_a_command_to_a_context_the_wire_never_announced_says_so(tmp_path):
|
||||
wire = tmp_path / "wire.jsonl"
|
||||
_write(wire, [_row(2.0, "out", {"id": 9, "method": "Runtime.evaluate", "params": {"executionContextId": "ctx-gone", "expression": "1"}}),
|
||||
_row(9.0, "in", {"method": "Page.navigationStarted", "params": {"frameId": "top"}})])
|
||||
(silent,) = [r for r in summarize_wire(wire, since_m=0.0) if r["event"] == "command without an answer"]
|
||||
assert silent["context_known_when_sent"] is False and silent["context_when_sent"] is None and silent["waited_s"] == 7.0
|
||||
|
||||
|
||||
def test_the_commands_without_an_answer_are_said_in_one_line_and_a_log_without_any_says_nothing(tmp_path):
|
||||
wire = tmp_path / "wire.jsonl"
|
||||
_write(wire, _page_rows())
|
||||
watch = FrameWatch()
|
||||
watch.wire.records.extend(summarize_wire(wire, since_m=1.0))
|
||||
line = watch.unanswered_line()
|
||||
assert "Runtime.evaluate #3 to context ctx-1" in line and "about:blank" in line and "alive" in line
|
||||
assert FrameWatch().unanswered_line() == ""
|
||||
assert _failing_watch().unanswered_line() == ""
|
||||
|
||||
|
||||
# ---- the stall witness and the load of the process ------------------------------------------------------------------------------
|
||||
class _Load:
|
||||
def __init__(self, raises=False):
|
||||
self.raises = raises
|
||||
|
||||
def cpu_percent(self, percpu=False):
|
||||
if self.raises:
|
||||
raise OSError("no counters")
|
||||
return 40.0
|
||||
|
||||
|
||||
class _Exploding:
|
||||
"""The probes of an ``OnFailure``, every one of which raises."""
|
||||
|
||||
def start(self):
|
||||
raise RuntimeError("start")
|
||||
|
||||
def stop(self):
|
||||
raise RuntimeError("stop")
|
||||
|
||||
def line(self):
|
||||
raise RuntimeError("line")
|
||||
|
||||
|
||||
def test_the_probes_start_stop_and_say_one_line_in_wire_time():
|
||||
probes = ProcessProbes(load_source=_Load())
|
||||
probes.start()
|
||||
probes.stop()
|
||||
line = probes.line()
|
||||
assert "no stall of the test process" in line and "runner CPU max 40%" in line
|
||||
assert probes.witness.beats >= 2 and probes.load_records.records[-1]["cpu_percent"] == 40.0
|
||||
assert probes.stall_records.records[-1]["event"] == "the witness stopped"
|
||||
|
||||
|
||||
def test_a_load_source_that_fails_is_a_record_and_a_line_still_comes():
|
||||
probes = ProcessProbes(load_source=_Load(raises=True))
|
||||
probes.start()
|
||||
probes.stop()
|
||||
assert "runner CPU: no sample" in probes.line()
|
||||
assert any(r.get("event") == "the sampler did not start" for r in probes.load_records.records)
|
||||
|
||||
|
||||
def test_a_stall_is_said_with_its_gap_and_the_wire_time_it_began():
|
||||
probes = ProcessProbes(load_source=_Load())
|
||||
probes.stall_records.add({"origin": "witness", "event": "stall", "from_gw": 12.5, "to_gw": 14.0, "gap_s": 1.5})
|
||||
assert "1 stall(s) of the test process over 200 ms: 1.50s at m=12.50" in probes.line()
|
||||
|
||||
|
||||
def test_probes_that_raise_never_change_the_exception_of_the_body(tmp_path):
|
||||
evidence = _Evidence(tmp_path / "missing.jsonl")
|
||||
problem = AssertionError("the test's own assertion")
|
||||
with pytest.raises(AssertionError) as caught:
|
||||
with OnFailure(evidence, _failing_watch(), _Exploding()):
|
||||
raise problem
|
||||
assert caught.value is problem and str(problem) == "the test's own assertion"
|
||||
assert evidence.saved == [(AssertionError, problem)]
|
||||
|
||||
|
||||
def test_an_exception_that_refuses_a_note_is_still_the_same_exception(tmp_path):
|
||||
class Refuses(Exception):
|
||||
def add_note(self, note):
|
||||
raise RuntimeError("no notes")
|
||||
|
||||
problem = Refuses("kept")
|
||||
evidence = _Evidence(tmp_path / "missing.jsonl")
|
||||
with pytest.raises(Refuses) as caught:
|
||||
with OnFailure(evidence, FrameWatch(), ProcessProbes(load_source=_Load())):
|
||||
raise problem
|
||||
assert caught.value is problem and evidence.saved == [(Refuses, problem)]
|
||||
|
||||
|
||||
def test_a_failure_carries_the_process_line_as_a_note_and_the_probes_run_for_the_body(tmp_path):
|
||||
wire = tmp_path / "wire.jsonl"
|
||||
evidence = _Evidence(wire)
|
||||
watch = FrameWatch()
|
||||
probes = ProcessProbes(load_source=_Load())
|
||||
problem = ValueError("no response in 30s")
|
||||
with pytest.raises(ValueError) as caught:
|
||||
with OnFailure(evidence, watch, probes):
|
||||
assert probes.witness.beats >= 1 # started with the body
|
||||
_write(wire, [_row(watch.started_m + 1.0, "out", {"id": 1, "method": "Runtime.evaluate",
|
||||
"params": {"executionContextId": "c", "expression": "1"}})])
|
||||
raise problem
|
||||
assert caught.value is problem and str(problem) == "no response in 30s"
|
||||
notes = getattr(problem, "__notes__", None)
|
||||
if notes is not None: # Python 3.11 and later
|
||||
assert len(notes) == 1 and "Runtime.evaluate #1 to context c" in notes[0] and "no stall of the test process" in notes[0]
|
||||
said = [r for r in watch.records if r["event"] == "said at the failure"][0]["data"]["lines"]
|
||||
assert said[0].startswith("wire: ") and said[1].startswith("process: ")
|
||||
assert probes.stall_records.records[-1]["event"] == "the witness stopped" # stopped before the evidence was saved
|
||||
|
||||
|
||||
def test_a_body_that_passes_stops_the_probes_and_says_nothing(tmp_path):
|
||||
evidence = _Evidence(tmp_path / "wire.jsonl")
|
||||
probes = ProcessProbes(load_source=_Load())
|
||||
watch = FrameWatch()
|
||||
with OnFailure(evidence, watch, probes):
|
||||
pass
|
||||
assert evidence.saved == [] and probes.stall_records.records[-1]["event"] == "the witness stopped"
|
||||
assert not [r for r in watch.records if r["event"] == "said at the failure"]
|
||||
Reference in new issue
Block a user