tests: the twins open their page before they ask Marionette for a session
The wrapper launches the engine with -silent, so there is no window at start-up, and Marionette's WebDriver:NewSession is answered only when the browser's start-up ends, which only a window ends. run_retail_twin and _on_ours created Chrome() before browser.new_page(), so the session never got its answer and the socket timed out after 300 s (every retail twin and every stock twin of the engine candidate). Chrome now takes the page of the launch as a required argument, so the wrong order cannot be written, and both twins open the page first. scales() reads that page. Regression test (red on the old files, 4 of 9 fail): an ast scan of every test and script refuses a function that asks for a session before its first new_page; the scan is itself proved on the old order; a fake Marionette that answers NewSession only once a window exists shows _on_ours and run_retail_twin get their answer. In the two unit rows: 4196 -> 4205 on Linux, 4208 -> 4217 on Windows (9 tests, not OS-specific).
This commit is contained in:
1 parent
aaf5863598
commit
3366497f7d
7 files changed
+299
-15
No files matched your search
@@ -18,8 +18,8 @@
|
||||
{"id": "wrapper.e2e.stock_twin.intersection", "giro": "G2", "os": ["linux", "windows"], "min_tests": 8, "exact": true, "tests": ["tests/test_intersection_and_lazy_loading_in_a_frame_of_another_site_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Split from the row wrapper.e2e.stock_twin, which ran past the 25-minute limit of a leg: one file, one leg. The twin of what the IntersectionObserver of a scrolled frame of another site reads (8 steps, 4 scales) and of when a lazy frame is requested (4 distances, 4 scales): the same steps first on Playwright's own Firefox (stock_firefox), headed, driven by the stock Playwright client, and second on ours; the verdict is 'the same as the reference' (tests/_stock_twin.py). Each record keeps the page's and the chrome's devicePixelRatio and the real scale of the screen. The file is in no whole-suite row: the references are installed only for this row's legs.", "stock_firefox": true},
|
||||
{"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": 4196, "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_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.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_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_ab_oracle_declared_differences.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.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_host_gate_ab.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_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.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_windows_temp_is_on_d.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_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.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_every_wLine truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 4208, "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_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.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_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_ab_oracle_declared_differences.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.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_host_gate_ab.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_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.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_windows_temp_is_on_d.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_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.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_pytest_process_clears_the_gp_fault_error_box_on_windows.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fLine truncated
|
||||
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 4205, "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_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.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_marionette_session_is_asked_after_the_first_window.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_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_ab_oracle_declared_differences.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.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_host_gate_ab.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_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.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_windows_temp_is_on_d.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_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.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", "tesLine truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 4217, "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_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.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_marionette_session_is_asked_after_the_first_window.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_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_ab_oracle_declared_differences.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.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_host_gate_ab.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_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.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_windows_temp_is_on_d.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_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.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_pytest_process_clears_the_gp_fault_error_box_on_windows.py", "tests/test_every_refuLine 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).", "core_dumps": "invpw-cores"},
|
||||
{"id": "wrapper.e2e.suite.linux.1", "giro": "G2", "os": ["linux"], "min_tests": 447, "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_held_ice_port_blinds_the_loopback_checks_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_screenshot_honours_its_scale_e2e.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page_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_throuLine truncated
|
||||
{"id": "wrapper.e2e.suite.linux.2", "giro": "G2", "os": ["linux"], "min_tests": 414, "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
|
||||
|
||||
@@ -54,5 +54,5 @@ def install(monkeypatch, events: List[str] = None, fail: bool = False) -> List[D
|
||||
launches: List[Dict[str, Any]] = []
|
||||
events = [] if events is None else events
|
||||
monkeypatch.setattr(_stock_twin, "stock_client", lambda: (lambda: _Playwright(launches, events, fail)))
|
||||
monkeypatch.setattr(_stock_twin, "Chrome", type("FakeChrome", (), {"close": lambda self: None}))
|
||||
monkeypatch.setattr(_stock_twin, "Chrome", type("FakeChrome", (), {"__init__": lambda self, page: None, "close": lambda self: None}))
|
||||
return launches
|
||||
@@ -259,9 +259,10 @@ def run_retail_twin(case: str, firefox_binary: str, measure: Callable[[Driver],
|
||||
not a finding about ours. Both sizes are in each record (``scales.chrome_outer``, ``scales.chrome_inner``), with the size the retail window was asked (``scales.window_asked_outer``)."""
|
||||
executable = retail_executable()
|
||||
with launch_case(firefox_binary, case, extra_args=MARIONETTE_ARGS, extra_prefs={"marionette.port": 0}) as browser:
|
||||
chrome = Chrome()
|
||||
page = browser.new_page() # first: the window the session below waits for
|
||||
chrome = Chrome(page)
|
||||
try:
|
||||
ours = measure(PlaywrightDriver(browser.new_page(), chrome))
|
||||
ours = measure(PlaywrightDriver(page, chrome))
|
||||
finally:
|
||||
chrome.close()
|
||||
asked = ours["scales"]["chrome_outer"]
|
||||
|
||||
+16
-7
@@ -91,11 +91,19 @@ class BrokenControl(AssertionError):
|
||||
|
||||
|
||||
class Chrome:
|
||||
"""Chrome scope of the browser below this process, through Marionette (the route of ``test_software_compositing_is_declared_e2e.py``)."""
|
||||
"""Chrome scope of the browser below this process, through Marionette (the route of ``test_software_compositing_is_declared_e2e.py``).
|
||||
|
||||
def __init__(self) -> None:
|
||||
``page`` is the page the browser of this launch already opened, and it is required on purpose: ``WebDriver:NewSession`` waits for the end of the browser's start-up, which only a window
|
||||
ends, and the wrapper launches with ``-silent`` (no window at start-up). A session asked before the first page never gets its answer (the socket times out after 300 s). With the page
|
||||
as an argument the wrong order cannot be written."""
|
||||
|
||||
def __init__(self, page) -> None:
|
||||
if page is None:
|
||||
raise TypeError("Chrome needs the page this launch opened first: Marionette's NewSession is answered only once a window exists")
|
||||
import webfont_probe
|
||||
|
||||
self._page = page
|
||||
|
||||
self._m = webfont_probe._Marionette(webfont_probe.marionette_active_port())
|
||||
self._m.call("WebDriver:NewSession", {"capabilities": {"alwaysMatch": {}}})
|
||||
self._m.call("Marionette:SetContext", {"value": "chrome"})
|
||||
@@ -103,9 +111,9 @@ class Chrome:
|
||||
def script(self, script: str, args: Tuple[Any, ...] = ()) -> Dict[str, Any]:
|
||||
return json.loads(self._m.call("WebDriver:ExecuteScript", {"script": script, "args": list(args)})["value"])
|
||||
|
||||
def scales(self, page) -> Dict[str, Any]:
|
||||
def scales(self) -> Dict[str, Any]:
|
||||
"""The record of the scales: the page's (declared) and the chrome's, with the real ones of the screen."""
|
||||
out = {"page": page.evaluate(PAGE_SCALES)}
|
||||
out = {"page": self._page.evaluate(PAGE_SCALES)}
|
||||
out.update(self.script(SCALES_JS))
|
||||
return out
|
||||
|
||||
@@ -143,7 +151,7 @@ def _on_stock(case: str, measure: Callable[[Any, Chrome], Dict[str, Any]]) -> Di
|
||||
chrome = None
|
||||
try:
|
||||
page = browser.new_context(viewport=viewport(case)).new_page()
|
||||
chrome = Chrome()
|
||||
chrome = Chrome(page)
|
||||
return measure(page, chrome)
|
||||
finally:
|
||||
if chrome is not None:
|
||||
@@ -161,9 +169,10 @@ def _on_stock(case: str, measure: Callable[[Any, Chrome], Dict[str, Any]]) -> Di
|
||||
|
||||
def _on_ours(case: str, firefox_binary: str, measure: Callable[[Any, Chrome], Dict[str, Any]]) -> Dict[str, Any]:
|
||||
with launch_case(firefox_binary, case, extra_args=MARIONETTE_ARGS, extra_prefs={"marionette.port": 0}) as browser:
|
||||
chrome = Chrome()
|
||||
page = browser.new_page() # first: the window the session below waits for
|
||||
chrome = Chrome(page)
|
||||
try:
|
||||
return measure(browser.new_page(), chrome)
|
||||
return measure(page, chrome)
|
||||
finally:
|
||||
chrome.close()
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ def _steps(sites, page, chrome: Chrome) -> Dict[str, Any]:
|
||||
wait_for(page, lambda: frame.evaluate("() => document.readyState") == "complete")
|
||||
origin = page.evaluate("() => { const r = document.getElementById('f').getBoundingClientRect(); return [r.left, r.top]; }")
|
||||
assert tuple(origin) == FRAME_AT, "the frame is at %r in the top document, the test placed it at %r" % (origin, FRAME_AT)
|
||||
scales = chrome.scales(page)
|
||||
scales = chrome.scales()
|
||||
|
||||
_drag(page)
|
||||
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
"""A Marionette session is asked for only after the launch has a window: the twins no longer wait 300 s for an answer that cannot come.
|
||||
|
||||
The wrapper launches the engine with ``-silent``: there is no window at start-up. Marionette's ``WebDriver:NewSession`` waits for the end of the browser's start-up, which only a window ends,
|
||||
so a test that asked for the session before its first ``new_page()`` never got its answer and the socket gave up after 300 s (the twins ``run_retail_twin`` and ``_on_ours``: every
|
||||
stock twin and every retail twin of the engine candidate, both systems). Two checks, no browser:
|
||||
|
||||
1. The order is written in the signature and the call sites. ``Chrome`` takes the page of the launch as a required argument, and a scan of every test and script (ast) refuses a function that
|
||||
makes a session (``_Marionette(...)``, ``marionette_active_port(...)``, ``WebDriver:NewSession``, or a helper or class that does, found by name across the files) before the
|
||||
first ``new_page()`` of the same function, or a ``Popen`` that opens ``about:blank``. A helper that opens no window of its own is checked at its callers.
|
||||
2. The behaviour, on a Marionette that answers ``NewSession`` only once a window exists, as the engine does: ``_on_ours`` and ``run_retail_twin`` get their answer, and the same fake
|
||||
times out for a session asked first.
|
||||
|
||||
Known-bad input: ``chrome = Chrome()`` before ``browser.new_page()`` (both twins, the old files), and the synthetic old order below. Green: the page first, then ``Chrome(page)``.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import ast
|
||||
import contextlib
|
||||
import inspect
|
||||
import pathlib
|
||||
from typing import Dict, List, Optional, Set, Tuple
|
||||
|
||||
import pytest
|
||||
|
||||
import _retail_reference
|
||||
import _stock_twin
|
||||
import webfont_probe
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
HERE = pathlib.Path(__file__).resolve().parent
|
||||
ROOT = HERE.parent
|
||||
|
||||
NEW_SESSION = "WebDriver:NewSession"
|
||||
#: The names that open a Marionette connection; a function that calls one is a session helper or a launcher with a session, and the names it carries join the set.
|
||||
PRIMITIVES = {"_Marionette", "marionette_active_port"}
|
||||
#: What starts a browser: a function that calls one of these is a launcher, and every session it asks for needs a window before it.
|
||||
LAUNCHERS = {"InvisiblePlaywright", "launch_case", "launch", "Popen"}
|
||||
|
||||
|
||||
def _name(call: ast.Call) -> Optional[str]:
|
||||
target = call.func
|
||||
return target.id if isinstance(target, ast.Name) else target.attr if isinstance(target, ast.Attribute) else None
|
||||
|
||||
|
||||
def _own_calls(function: ast.AST) -> List[ast.Call]:
|
||||
"""The calls in the body of ``function`` itself, not in a function, lambda or class defined inside it."""
|
||||
calls: List[ast.Call] = []
|
||||
stack = list(function.body)
|
||||
while stack:
|
||||
node = stack.pop()
|
||||
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.Lambda, ast.ClassDef)):
|
||||
continue
|
||||
if isinstance(node, ast.Call):
|
||||
calls.append(node)
|
||||
stack.extend(ast.iter_child_nodes(node))
|
||||
return calls
|
||||
|
||||
|
||||
def _opens_a_window(call: ast.Call) -> bool:
|
||||
if _name(call) == "new_page":
|
||||
return True
|
||||
if _name(call) == "Popen":
|
||||
return any(isinstance(x, ast.Constant) and x.value == "about:blank" for arg in call.args for x in ast.walk(arg))
|
||||
return False
|
||||
|
||||
|
||||
def _functions(tree: ast.AST) -> List[Tuple[ast.AST, Optional[str]]]:
|
||||
"""Every function with the class it is a method of (None for the others), nested ones too."""
|
||||
found: List[Tuple[ast.AST, Optional[str]]] = []
|
||||
|
||||
def visit(node: ast.AST, owner: Optional[str]) -> None:
|
||||
for child in ast.iter_child_nodes(node):
|
||||
if isinstance(child, (ast.FunctionDef, ast.AsyncFunctionDef)):
|
||||
found.append((child, owner))
|
||||
visit(child, None)
|
||||
elif isinstance(child, ast.ClassDef):
|
||||
visit(child, child.name)
|
||||
else:
|
||||
visit(child, owner)
|
||||
|
||||
visit(tree, None)
|
||||
return found
|
||||
|
||||
|
||||
def sessions_before_a_window(sources: Dict[str, str]) -> List[str]:
|
||||
"""Where a session is asked for before the first window of its function: one line per place, ``file:line``, what and how to correct it."""
|
||||
functions = [(path, function, owner, _own_calls(function)) for path, source in sources.items() for function, owner in _functions(ast.parse(source))]
|
||||
creators: Set[str] = set(PRIMITIVES)
|
||||
|
||||
def asks(call: ast.Call) -> bool:
|
||||
return _name(call) in creators or (bool(call.args) and isinstance(call.args[0], ast.Constant) and call.args[0].value == NEW_SESSION)
|
||||
|
||||
helpers: Set[int] = set()
|
||||
grew = True
|
||||
while grew:
|
||||
grew = False
|
||||
for index, (_, function, owner, calls) in enumerate(functions):
|
||||
if index in helpers or not any(asks(c) for c in calls):
|
||||
continue
|
||||
if not any(_opens_a_window(c) or _name(c) in LAUNCHERS for c in calls):
|
||||
helpers.add(index)
|
||||
creators.add(owner if function.name == "__init__" and owner else function.name)
|
||||
grew = True
|
||||
out: List[str] = []
|
||||
for index, (path, function, _, calls) in enumerate(functions):
|
||||
if index in helpers:
|
||||
continue
|
||||
windows = [(c.lineno, c.col_offset) for c in calls if _opens_a_window(c)]
|
||||
for call in calls:
|
||||
if asks(call) and not any(at < (call.lineno, call.col_offset) for at in windows):
|
||||
out.append("%s:%d: %s asks for a Marionette session before any page of %s() is open (NewSession is answered only once a window exists, and the wrapper launches "
|
||||
"with -silent: the socket times out after 300 s); open the page first (page = browser.new_page()), then ask for the session" % (path, call.lineno, _name(call) or NEW_SESSION, function.name))
|
||||
return out
|
||||
|
||||
|
||||
def _sources() -> Dict[str, str]:
|
||||
files: Dict[str, str] = {}
|
||||
for folder in ("tests", "scripts"):
|
||||
for path in sorted((ROOT / folder).rglob("*.py")):
|
||||
if "vendor" in path.parts or "__pycache__" in path.parts:
|
||||
continue
|
||||
files[path.relative_to(ROOT).as_posix()] = path.read_text(encoding="utf-8")
|
||||
return files
|
||||
|
||||
|
||||
def test_no_test_or_script_asks_for_a_session_before_its_first_page():
|
||||
found = sessions_before_a_window(_sources())
|
||||
assert not found, "\n".join(found)
|
||||
|
||||
|
||||
OLD_ORDER = """
|
||||
def run(firefox_binary, case):
|
||||
with launch_case(firefox_binary, case) as browser:
|
||||
chrome = Chrome()
|
||||
return measure(browser.new_page(), chrome)
|
||||
"""
|
||||
OLD_ORDER_THROUGH_A_HELPER = """
|
||||
def open_chrome(port):
|
||||
m = _Marionette(port)
|
||||
m.call("WebDriver:NewSession", {})
|
||||
return m
|
||||
|
||||
def test_it(firefox_binary):
|
||||
with InvisiblePlaywright(binary_path=firefox_binary) as browser:
|
||||
m = open_chrome(1)
|
||||
browser.new_page()
|
||||
"""
|
||||
OLD_ORDER_RAW = """
|
||||
def test_it(firefox_binary):
|
||||
with InvisiblePlaywright(binary_path=firefox_binary) as browser:
|
||||
m = _Marionette(marionette_active_port())
|
||||
m.call("WebDriver:NewSession", {})
|
||||
page = browser.new_page()
|
||||
"""
|
||||
NEW_ORDER = """
|
||||
class Chrome:
|
||||
def __init__(self, page):
|
||||
self._m = _Marionette(marionette_active_port())
|
||||
|
||||
def run(firefox_binary, case):
|
||||
with launch_case(firefox_binary, case) as browser:
|
||||
page = browser.new_page()
|
||||
chrome = Chrome(page)
|
||||
return measure(page, chrome)
|
||||
|
||||
def retail():
|
||||
process = subprocess.Popen([exe, "-no-remote", "about:blank"])
|
||||
m = _Marionette(marionette_active_port())
|
||||
m.call("WebDriver:NewSession", {})
|
||||
"""
|
||||
|
||||
|
||||
@pytest.mark.parametrize("source", [OLD_ORDER, OLD_ORDER_THROUGH_A_HELPER, OLD_ORDER_RAW], ids=["class", "helper", "raw"])
|
||||
def test_the_scan_sees_the_old_order(source):
|
||||
sources = {"synthetic.py": source + "\nclass Chrome:\n def __init__(self):\n self._m = _Marionette(marionette_active_port())\n"}
|
||||
assert sessions_before_a_window(sources), "the scan does not see a session asked for before the first page:\n" + source
|
||||
|
||||
|
||||
def test_the_scan_lets_the_page_first_through():
|
||||
assert sessions_before_a_window({"synthetic.py": NEW_ORDER}) == []
|
||||
|
||||
|
||||
def test_chrome_takes_the_page_and_nothing_makes_it_without():
|
||||
parameters = list(inspect.signature(_stock_twin.Chrome).parameters.values())
|
||||
assert [p.name for p in parameters] == ["page"] and parameters[0].default is inspect.Parameter.empty, (
|
||||
"Chrome must take the page of the launch as its one required argument (found %r): without it the session can be asked before the window exists" % (parameters,))
|
||||
with pytest.raises(TypeError):
|
||||
_stock_twin.Chrome(None)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------- the behaviour, on a Marionette that waits for a window
|
||||
|
||||
class World:
|
||||
"""The engine started with ``-silent``: no window until a page is opened. ``NewSession`` is answered then, and times out as the socket does before it."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.window = False
|
||||
self.sessions = 0
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def world(monkeypatch):
|
||||
state = World()
|
||||
|
||||
class FakeMarionette:
|
||||
def __init__(self, port, timeout=120.0):
|
||||
self.closed = False
|
||||
|
||||
def call(self, name, params=None):
|
||||
if name == NEW_SESSION:
|
||||
if not state.window:
|
||||
raise TimeoutError("timed out: no answer to WebDriver:NewSession (the engine has no window)")
|
||||
state.sessions += 1
|
||||
return {"value": "{}"}
|
||||
|
||||
def close(self):
|
||||
self.closed = True
|
||||
|
||||
class FakePage:
|
||||
def evaluate(self, expression):
|
||||
return {}
|
||||
|
||||
class FakeBrowser:
|
||||
def new_page(self):
|
||||
state.window = True
|
||||
return FakePage()
|
||||
|
||||
@contextlib.contextmanager
|
||||
def launch_case(binary, case, **kwargs):
|
||||
state.window = False
|
||||
yield FakeBrowser()
|
||||
|
||||
monkeypatch.setattr(webfont_probe, "_Marionette", FakeMarionette)
|
||||
monkeypatch.setattr(webfont_probe, "marionette_active_port", lambda *a, **k: 1)
|
||||
monkeypatch.setattr(_stock_twin, "launch_case", launch_case)
|
||||
monkeypatch.setattr(_retail_reference, "launch_case", launch_case)
|
||||
return state
|
||||
|
||||
|
||||
def test_the_fake_engine_does_not_answer_a_session_asked_before_its_first_page(world):
|
||||
marionette = webfont_probe._Marionette(webfont_probe.marionette_active_port())
|
||||
with pytest.raises(TimeoutError):
|
||||
marionette.call(NEW_SESSION, {"capabilities": {"alwaysMatch": {}}})
|
||||
|
||||
|
||||
def test_ours_gets_the_answer_of_its_session_in_a_twin(world):
|
||||
record = _stock_twin._on_ours("1920x1080-dpr1.0", "not-launched", lambda page, chrome: {"scales": chrome.scales()})
|
||||
assert world.sessions == 1
|
||||
assert record["scales"]["page"] == {}
|
||||
|
||||
|
||||
def test_ours_gets_the_answer_of_its_session_in_a_retail_twin(world, monkeypatch):
|
||||
scales = {"scales": {"chrome_outer": [800, 600], "chrome_inner": [790, 500]}}
|
||||
|
||||
class FakeRetail:
|
||||
def __init__(self, executable, dpr):
|
||||
pass
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc):
|
||||
return False
|
||||
|
||||
def set_window_size(self, outer):
|
||||
return {"outer": [800, 600], "inner": [790, 500]}
|
||||
|
||||
monkeypatch.setattr(_retail_reference, "retail_executable", lambda: "retail")
|
||||
monkeypatch.setattr(_retail_reference, "RetailSession", FakeRetail)
|
||||
monkeypatch.setattr(_retail_reference, "RetailDriver", lambda session: object())
|
||||
retail, ours = _retail_reference.run_retail_twin("1920x1080-dpr1.0", "not-launched", lambda driver: {"scales": dict(scales["scales"])})
|
||||
assert world.sessions == 1
|
||||
assert ours["scales"]["chrome_outer"] == [800, 600] and retail["scales"]["window_asked_outer"] == [800, 600]
|
||||
@@ -95,7 +95,7 @@ def _intersection(sites, page, chrome: Chrome, tag: str) -> Dict[str, Any]:
|
||||
page.goto(sites.url("A", "/io-" + tag), wait_until="load", timeout=30000)
|
||||
frame = wait_frame(page, sites.origin["B"], "/io", seconds=DEADLINE_S)
|
||||
wait_for(page, lambda: frame.evaluate("() => document.readyState") == "complete")
|
||||
scales = chrome.scales(page)
|
||||
scales = chrome.scales()
|
||||
vh = page.evaluate(TOP_BOX)["vh"]
|
||||
steps: Dict[str, Any] = {}
|
||||
for name, step_top in _steps_of(vh):
|
||||
@@ -112,7 +112,7 @@ def _lazy(sites, page, chrome: Chrome, tag: str) -> Dict[str, Any]:
|
||||
"""Whether each lazy frame was requested at each distance. The requests of one browser have a path with its tag, so the other's do not count."""
|
||||
measured: Dict[str, Any] = {}
|
||||
page.goto(sites.url("A", "/lazy-top-" + tag), wait_until="load", timeout=30000)
|
||||
scales = chrome.scales(page)
|
||||
scales = chrome.scales()
|
||||
vh = page.evaluate(TOP_BOX)["vh"]
|
||||
|
||||
def requested_top() -> int:
|
||||
|
||||
Reference in new issue
Block a user