Create test suite for Fedora Media Writer #462

Merged
adamwill merged 16 commits from newtest/fedora-media-writer into main 2026-06-08 04:02:55 +00:00
5 changed files with 28 additions and 25 deletions
Showing only changes of commit e19cff13b8 - Show all commits

Move the authenticate subroutine to utils.pm
Some checks failed
CI via Tox and perl / tox (pull_request) Successful in 4m43s
CI via Tox and perl / perl (pull_request) Has been cancelled

Also, the subroutine now uses arguments to set some parametres.
First, you need to provide a password to authenticate - previously
it was hardwired and could not handle differences between root and
user passwords.
By default, it waits 15 seconds to see the auth dialogue and 5
seconds after the authentication. You can set these times.
Example: authenticate($password, timeout => 20, stillscreen => 10);
Lukáš Růžička 2026-01-28 12:13:54 +01:00

View file

@ -8,19 +8,7 @@ use lockapi;
use testapi;
use utils;
our @EXPORT = qw(add_partitions delete_partition create_partition format_partition edit_partition edit_filesystem authenticate mount_partition resize_partition wipe_disk);
# This routine handles the authentication dialogue when it
# pops out. It provides the admin user (not root) password
# so that system change could be performed on regular
# Workstation.
sub authenticate {
if (check_screen("auth_required", 2)) {
my $password = get_var("USER_PASSWORD") // "weakpassword";
type_very_safely($password);
send_key("ret");
}
}
our @EXPORT = qw(add_partitions delete_partition create_partition format_partition edit_partition edit_filesystem mount_partition resize_partition wipe_disk);
# This routine adds two partitions. This layout is used in
# several testing scripts.

View file

@ -6,7 +6,7 @@ use base 'Exporter';
use Exporter;
use lockapi;
use testapi qw(is_serial_terminal :DEFAULT);
our @EXPORT = qw/run_with_error_check type_safely type_very_safely script_retry 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 prepare_update_mount setup_repos repo_setup get_workarounds disable_updates_repos cleanup_workaround_repo console_initial_setup handle_welcome_screen gnome_initial_setup plasma_setup check_desktop quit_firefox advisory_get_installed_packages acnp_handle_output advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log repos_mirrorlist register_application get_registered_applications desktop_launch_terminal solidify_wallpaper check_and_install_git download_testdata make_serial_writable set_update_notification_timestamp kde_doublek_workaround dm_perform_login check_software_start reboot_system connections_connect toolbox/;
our @EXPORT = qw/run_with_error_check type_safely type_very_safely script_retry 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 prepare_update_mount setup_repos repo_setup get_workarounds disable_updates_repos cleanup_workaround_repo console_initial_setup handle_welcome_screen gnome_initial_setup plasma_setup check_desktop quit_firefox advisory_get_installed_packages acnp_handle_output advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log repos_mirrorlist register_application get_registered_applications desktop_launch_terminal solidify_wallpaper check_and_install_git download_testdata make_serial_writable set_update_notification_timestamp kde_doublek_workaround dm_perform_login check_software_start reboot_system connections_connect toolbox authenticate/;
# We introduce this global variable to hold the list of applications that have
# registered during the apps_startstop_test when they have sucessfully run.
@ -2033,4 +2033,26 @@ sub toolbox {
}
}
# This routine handles the authentication dialogue when it
# pops out. It provides the admin user (not root) password
# so that system change could be performed on regular
# Workstation. The routine always needs a $password (first argument).
# Optionally, you can use $timeout and $stillscreen as named args
# to specify how long to wait for the auth dialogue and how long
# to wait after we have authenticated.
sub authenticate {
# Use default values.
my %defaults = (timeout => 15, stillscreen => 5);
my ($password, %kwargs) = @_;
my %args = (%defaults, %kwargs);
if (check_screen("auth_required", timeout => $args{timeout})) {
type_very_safely($password);
send_key("ret");
wait_still_screen($args{stillscreen});
}
}
1;

View file

@ -19,6 +19,7 @@ sub switch_network {
sub run {
my $self = shift;
my $password = get_var("USER_PASSWORD", "weakpassword");
# Toggle network
switch_network();
@ -35,11 +36,7 @@ sub run {
# Sometimes, we can see an authentication dialogue which
# prevents the test from continuing. Authenticate,
# if that is the case.
my $pass = get_var("USER_PASSWORD", "weakpassword");
if (check_screen("auth_required", timeout => 30)) {
type_very_safely("$pass\n");
}
sleep(3);
authenticate($password);
# Toggle network
switch_network();

View file

@ -13,11 +13,7 @@ sub run {
menu_launch_type 'firewall';
# Firewall requires password to be entered and confirmed to start.
# View password
assert_screen "auth_required", timeout => 60;
wait_still_screen 3;
type_safely $password;
send_key 'ret';
wait_still_screen 3;
authenticate($password, timeout => 60, stillscreen => 3);
# Check that it is started
assert_screen 'apps_run_firewall';

View file

@ -119,7 +119,7 @@ sub run {
while (check_screen 'desktop_package_tool_import_key', 30 && $limit) {
click_lastmatch;
my $pass = get_var("USER_PASSWORD", "weakpassword");
type_very_safely("$pass\n") if (check_screen("auth_required", 10));
authenticate($pass, timeout => 10);
$limit--;
}
}