2019-09-10 12:59:57 +00:00
|
|
|
package cockpit;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use base 'Exporter';
|
|
|
|
use Exporter;
|
|
|
|
use lockapi;
|
|
|
|
use testapi;
|
|
|
|
use utils;
|
|
|
|
|
|
|
|
our @EXPORT = qw(start_cockpit select_cockpit_update check_updates);
|
|
|
|
|
|
|
|
|
|
|
|
sub start_cockpit {
|
|
|
|
# Starting from a console, get to a browser with Cockpit (running
|
|
|
|
# on localhost) shown. If $login is truth-y, also log in. Assumes
|
|
|
|
# X and Firefox are installed.
|
|
|
|
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";
|
2020-01-22 09:40:46 +00:00
|
|
|
assert_screen "cockpit_login", 60;
|
2019-09-10 12:59:57 +00:00
|
|
|
# this happened on early Modular Server composes...
|
|
|
|
record_soft_failure "Unbranded Cockpit" if (match_has_tag "cockpit_login_unbranded");
|
2020-05-06 19:58:59 +00:00
|
|
|
wait_still_screen(stilltime=>5, similarity_level=>45);
|
2019-09-10 12:59:57 +00:00
|
|
|
if ($login) {
|
|
|
|
type_safely "root";
|
|
|
|
wait_screen_change { send_key "tab"; };
|
|
|
|
type_safely get_var("ROOT_PASSWORD", "weakpassword");
|
|
|
|
send_key "ret";
|
|
|
|
assert_screen "cockpit_main";
|
|
|
|
# wait for any animation or other weirdness
|
|
|
|
# can't use wait_still_screen because of that damn graph
|
|
|
|
sleep 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub select_cockpit_update {
|
|
|
|
# This method navigates to to the updates screen
|
2020-05-30 16:33:06 +00:00
|
|
|
assert_screen ["cockpit_software_updates", "cockpit_leftbar_scroll"], 120;
|
|
|
|
click_lastmatch;
|
|
|
|
assert_and_click "cockpit_software_updates" if (match_has_tag "cockpit_leftbar_scroll");
|
2019-09-10 12:59:57 +00:00
|
|
|
# wait for the updates to download
|
|
|
|
assert_screen 'cockpit_updates_check', 300;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub check_updates {
|
|
|
|
my $logfile = shift;
|
|
|
|
sleep 2;
|
|
|
|
my $checkresult = script_run "dnf check-update > $logfile";
|
|
|
|
upload_logs "$logfile", failok=>1;
|
|
|
|
return($checkresult);
|
|
|
|
}
|