From 3b236c7a39d2f9ac4fd109f6c57e5ac033efe8c2 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 21 Feb 2019 09:49:55 -0800 Subject: [PATCH] Try and disable Firefox 'shield studies' I've seen a few tests fail lately because Firefox suddenly opened a tab with some "Privacy Study" in it and switched to it. Per https://bugzilla.mozilla.org/show_bug.cgi?id=1529626 , this should be the way to disable these... Signed-off-by: Adam Williamson --- lib/freeipa.pm | 1 + lib/utils.pm | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/freeipa.pm b/lib/freeipa.pm index bfba0b06..9f6113d0 100644 --- a/lib/freeipa.pm +++ b/lib/freeipa.pm @@ -41,6 +41,7 @@ sub start_webui { # https://bugzilla.redhat.com/show_bug.cgi?id=1439429 assert_script_run "sed -i -e 's,enable_xauth=1,enable_xauth=0,g' /usr/bin/startx"; + disable_firefox_studies; type_string "startx /usr/bin/firefox -width 1024 -height 768 https://ipa001.domain.local\n"; assert_screen ["freeipa_webui_login", $user_screen], 30; wait_still_screen 5; diff --git a/lib/utils.pm b/lib/utils.pm index 3c70827d..b9a1127d 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -7,7 +7,7 @@ use Exporter; use lockapi; use testapi; -our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut/; +our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut disable_firefox_studies/; sub run_with_error_check { my ($func, $error_screen) = @_; @@ -311,6 +311,7 @@ sub start_cockpit { my $login = shift || 0; # https://bugzilla.redhat.com/show_bug.cgi?id=1439429 assert_script_run "sed -i -e 's,enable_xauth=1,enable_xauth=0,g' /usr/bin/startx"; + disable_firefox_studies; # run firefox directly in X as root. never do this, kids! type_string "startx /usr/bin/firefox -width 1024 -height 768 http://localhost:9090\n"; assert_screen "cockpit_login", 30; @@ -763,3 +764,11 @@ sub advisory_check_nonmatching_packages { } } } + +sub disable_firefox_studies { + # create a config file that disables Firefox's dumb 'shield + # studies' so they don't break tests: + # https://bugzilla.mozilla.org/show_bug.cgi?id=1529626 + assert_script_run 'mkdir -p $(rpm --eval %_libdir)/firefox/distribution'; + assert_script_run 'printf \'{"policies": {"DisableFirefoxStudies": true}}\' > $(rpm --eval %_libdir)/firefox/distribution/distribution.ini'; +}