From 67f1a6d0735ff4b818e3761f215e1e9933c3d6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20R=C5=AF=C5=BEi=C4=8Dka?= Date: Tue, 9 Apr 2024 11:24:29 +0200 Subject: [PATCH] Save progress on keyring. --- tests/applications/keyring/aaa_setup.pm | 8 ++- .../applications/keyring/keyring_initiate.pm | 56 +++++++++++++------ tests/applications/keyring/keyring_kontrol.pm | 31 +++++----- tests/applications/keyring/keyring_reuse.pm | 25 ++++++--- 4 files changed, 78 insertions(+), 42 deletions(-) diff --git a/tests/applications/keyring/aaa_setup.pm b/tests/applications/keyring/aaa_setup.pm index 1e6b1407..02f99bf3 100644 --- a/tests/applications/keyring/aaa_setup.pm +++ b/tests/applications/keyring/aaa_setup.pm @@ -13,11 +13,15 @@ use utils; sub run { my $self = shift; + my $desktop = get_var("DESKTOP"); # Switch to console $self->root_console(tty => 3); - # We install the FTP server's package. + # We install the necessary packages. assert_script_run("dnf -y install pure-ftpd"); + if ($desktop eq "gnome") { + assert_script_run("dnf -y install seahorse"); + } # Download the configuration file for FTP and unpack it. download_testdata("configuration"); @@ -28,7 +32,7 @@ sub run { # Set up the system. # Add a group for the FTP and the user that will own the FTP stuff assert_script_run("groupadd ftpusers"); - assert_script_run("useradd --system -g ftpusers -d /dev/null -s /sbin/nologin ftpuser"); + assert_script_run("useradd -g ftpusers -d /dev/null -s /sbin/nologin ftpuser"); # Create a directory to hold the FTP content, set rights and create the content. assert_script_run("mkdir /ftpdata"); assert_script_run("chown -R ftpuser:ftpusers /ftpdata"); diff --git a/tests/applications/keyring/keyring_initiate.pm b/tests/applications/keyring/keyring_initiate.pm index 6a9f705a..69d726ee 100644 --- a/tests/applications/keyring/keyring_initiate.pm +++ b/tests/applications/keyring/keyring_initiate.pm @@ -13,24 +13,44 @@ use utils; sub run { my $self = shift; - assert_and_click("keyring_open_network"); - assert_and_click("keyring_add_network_folder"); - assert_and_click("keyring_select_ftp"); - assert_and_click("kde_button_next"); - type_very_safely("FTPConnect"); - send_key("tab"); - type_very_safely("tucnak"); - send_key("tab"); - type_very_safely("127.0.0.1"); - assert_and_click("keyring_save_connect"); - type_very_safely("weakpassword"); - assert_and_click("keyring_reveal_password"); - assert_and_click("keyring_remember_password"); - assert_and_click("kde_button_ok"); - assert_and_click("keyring_open_location"); - send_key("ret"); - assert_screen("keyring_test_file"); - send_key("alt-f4"); + my $desktop = get_var("DESKTOP"); + if ($desktop eq "kde") { + # The Dolphin application is already started, so we begin + # with clicking on Network to open the network folders. + # We want to add a new connection and go through the + # password addition process. + assert_and_click("keyring_open_network"); + assert_and_click("keyring_add_network_folder"); + assert_and_click("keyring_select_ftp"); + assert_and_click("kde_button_next"); + # We will set up the connection. + type_very_safely("FTPConnect"); + send_key("tab"); + type_very_safely("tucnak"); + send_key("tab"); + type_very_safely("127.0.0.1"); + assert_and_click("keyring_save_connect"); + # Type password to connect + type_very_safely("weakpassword"); + # Reveal it so that we can check it is correctly + # written, when there are failures because of that + # (I have seen a couple of mistypes during development). + assert_and_click("keyring_reveal_password"); + assert_and_click("keyring_remember_password"); + assert_and_click("kde_button_ok"); + # We have added the network location and an icon + # has been created to access it. Click on that icon. + assert_and_click("keyring_open_location"); + # While double click would sometimes fail here, we + # want to confirm opening the icon using the + # Enter key. + send_key("ret"); + # Check that we have opened the location and that + # we can see the FTP content. + assert_screen("keyring_test_file"); + # Close the application. + send_key("alt-f4"); + } } sub test_flags { diff --git a/tests/applications/keyring/keyring_kontrol.pm b/tests/applications/keyring/keyring_kontrol.pm index ca33890d..aa1aa25a 100644 --- a/tests/applications/keyring/keyring_kontrol.pm +++ b/tests/applications/keyring/keyring_kontrol.pm @@ -4,26 +4,31 @@ use testapi; use utils; # This script will check that the password has been added -# to the system keyring. +# to the system keyring. We will start a wallet application +# and check that the password is listed in that application. sub run { my $self = shift; - menu_launch_type("kwalletmanager"); - assert_screen("kwalletmanager_runs"); - send_key("super-pgup"); - - assert_and_dclick("keyring_passwords_unfold"); - assert_and_dclick("keyring_maps_unfold"); - assert_and_click("keyring_ftp_localhost"); - assert_and_click("keyring_show_values"); - assert_screen("keyring_keys_values"); + my $desktop = get_var("DESKTOP"); + if ($desktop eq "kde") { + # Start the KDE wallet application and maximize it. + menu_launch_type("kwalletmanager"); + assert_screen("kwalletmanager_runs"); + send_key("super-pgup"); + + # Navigate to the stored entry and check that + # the credentials are stored there. + assert_and_dclick("keyring_passwords_unfold"); + assert_and_dclick("keyring_maps_unfold"); + assert_and_click("keyring_ftp_localhost"); + assert_and_click("keyring_show_values"); + assert_screen("keyring_keys_values"); + } + # Reboot the machine. $self->root_console( tty => 3 ); - enter_cmd("reboot"); - - } sub test_flags { diff --git a/tests/applications/keyring/keyring_reuse.pm b/tests/applications/keyring/keyring_reuse.pm index 07374ba3..e5a1de09 100644 --- a/tests/applications/keyring/keyring_reuse.pm +++ b/tests/applications/keyring/keyring_reuse.pm @@ -11,25 +11,32 @@ use utils; sub run { my $self = shift; my $pw = get_var("USER_PASSWORD") // "weakpassword"; + my $desktop = get_var("DESKTOP"); my $app = "files"; - if (get_var("DESKTOP") eq "kde") { + my $key = "up"; + if ($desktop eq "kde") { $app = "dolphin"; + $key = "pgup"; } + # Check that the machine has been rebooted + # and log in. boot_to_login_screen(); send_key("ret") if (get_var("DESKTOP") eq "gnome"); type_very_safely("$pw\n"); wait_still_screen(5); + # Start the file exploring application menu_launch_type($app); + send_key("super-$key"); - send_key("super-pgup"); - - - assert_and_click("keyring_open_network"); - assert_and_click("keyring_open_location"); - send_key("ret"); - assert_screen("keyring_test_file"); - send_key("alt-f4"); + if ($desktop eq "kde") { + # Open the network location and check + # that the FTP content is accessible. + assert_and_click("keyring_open_network"); + assert_and_click("keyring_open_location"); + send_key("ret"); + assert_screen("keyring_test_file"); + } } sub test_flags {