Create test suite for Desktop Keyring

This adds both the Gnome and the KDE tests to test the
Desktop Keyring. After a discussion with the Brno team,
how this could be tested without the need to rely on
external servers to log into, we set up a local FTP server,
we will log into it and remember the credentials and verify
that the credentials will be stored in the keyring correctly.
This commit is contained in:
Lukas Ruzicka 2024-04-04 18:44:06 +02:00 committed by Lukáš Růžička
parent 5cd9c83e73
commit fbaf1652d8
68 changed files with 807 additions and 0 deletions

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 271,
"ypos": 113,
"width": 142,
"height": 24,
"type": "match"
}
],
"properties": [],
"tags": [
"apps_run_seahorse"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 746,
"ypos": 41,
"width": 126,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_add_network_folder"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 599,
"ypos": 201,
"width": 66,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_button_connect"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 607,
"ypos": 734,
"width": 66,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_button_connect"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 60,
"ypos": 331,
"width": 131,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_ftp_localhost"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 253,
"ypos": 163,
"width": 87,
"height": 67,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_test_file"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 521,
"ypos": 304,
"width": 195,
"height": 47,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_keys_values"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 217,
"ypos": 736,
"width": 82,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_location_line"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 39,
"ypos": 307,
"width": 40,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_maps_unfold"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"ypos": 106,
"height": 61,
"type": "match",
"width": 71,
"xpos": 572
}
],
"properties": [],
"tags": [
"keyring_open_location"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 605,
"ypos": 106,
"width": 71,
"height": 61,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_open_location"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 6,
"ypos": 188,
"width": 82,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_open_network"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 40,
"ypos": 498,
"width": 112,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_other_location"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 43,
"ypos": 258,
"width": 69,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_passwords_unfold"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 428,
"ypos": 565,
"width": 125,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_remember_forever"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 404,
"ypos": 468,
"width": 132,
"height": 15,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_remember_password"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 689,
"ypos": 436,
"width": 21,
"height": 14,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_reveal_password"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

View File

@ -0,0 +1,16 @@
{
"area": [
{
"xpos": 668,
"ypos": 578,
"width": 100,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_save_connect",
"keyring_save_next"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 384,
"ypos": 122,
"width": 130,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_seahorse_details"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 648,
"ypos": 424,
"width": 65,
"height": 79,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_seahorse_details_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 35,
"ypos": 121,
"width": 38,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_seahorse_login"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 33,
"ypos": 121,
"width": 40,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_seahorse_login"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 440,
"ypos": 262,
"width": 111,
"height": 22,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_seahorse_password_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 615,
"ypos": 260,
"width": 27,
"height": 26,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_seahorse_show_password"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 189,
"ypos": 261,
"width": 27,
"height": 15,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_select_ftp"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 508,
"ypos": 356,
"width": 76,
"height": 23,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_select_registered"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 446,
"ypos": 236,
"width": 105,
"height": 22,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_show_values"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 286,
"ypos": 117,
"width": 77,
"height": 50,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_test_file"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 459,
"ypos": 96,
"width": 104,
"height": 23,
"type": "match"
}
],
"properties": [],
"tags": [
"kwalletmanager_runs"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 707,
"ypos": 577,
"width": 46,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"kde_button_next"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 563,
"ypos": 502,
"width": 42,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"kde_button_ok"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

View File

@ -1353,6 +1353,20 @@
"START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%"
}
},
"desktop_keyring": {
"profiles": {
"fedora-Workstation-live-iso-ppc64le-*-ppc64le": 20,
"fedora-Workstation-live-iso-x86_64-*-64bit": 20,
"fedora-KDE-live-iso-x86_64-*-64bit": 30,
"fedora-Workstation-raw_xz-raw.xz-aarch64-*-aarch64": 22
},
"settings": {
"BOOTFROM": "c",
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
"POSTINSTALL_PATH": "tests/applications/keyring",
"START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%"
}
},
"desktop_update_graphical": {
"profiles": {
"fedora-KDE-live-iso-x86_64-*-64bit": 32,

View File

@ -0,0 +1,95 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script will install the necessary things to test the Desktop Keyring on Gnome
# and KDE, i.e.:
# - we will install an FTP server.
# - we will set it up so that logins can be made.
# - we will log into the FTP server and make the system to remember the credentials.
# - we will restart the machine and check that the credentials are still remembered.
# - we will open SeaHorse or KDE Wallet to check that the credentials are stored.
sub run {
my $self = shift;
my $desktop = get_var("DESKTOP");
# Switch to console
$self->root_console(tty => 3);
# 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");
assert_script_run("mv -f /home/test/configuration/pure-ftpd.conf /etc/pure-ftpd/");
assert_script_run("chown root:root /etc/pure-ftpd/pure-ftpd.conf");
assert_script_run("chmod 644 /etc/pure-ftpd/pure-ftpd.conf");
# 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 -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");
assert_script_run("echo 'This is a test file' > /ftpdata/testfile.txt");
# Enable the FTP service in the firewall.
assert_script_run("firewall-cmd --add-service=ftp --permanent");
assert_script_run("firewall-cmd --reload");
# Set up the FTP server.
# Create a virtual FTP user called tucnak.
enter_cmd("pure-pw useradd tucnak -u ftpuser -g ftpusers -d /ftpdata");
sleep(2);
# Set its password, wait between attempts so that the system has time
# to react to the input.
type_string("weakpassword\n"); # To pass the password entry.
sleep(2);
type_string("weakpassword\n");
sleep(2);
# Create PureFTP database to the settings.
assert_script_run("pure-pw mkdb");
# Check that the settings are done correctly
assert_script_run("pure-pw list | egrep 'tucnak\\s+/ftpdata'");
assert_script_run("pure-pw show tucnak");
# Enable and start the server.
assert_script_run("systemctl enable pure-ftpd.service --now");
# Check that it is running (the assertion will fail if not)
assert_script_run("systemctl status pure-ftpd.service --no-pager");
# Return to desktop
desktop_vt();
# Start the file explorer application based on what system we are
# running, Gnome or KDE.
my $app = "nautilus";
my $key = "up";
if (get_var("DESKTOP") eq "kde") {
$app = "dolphin";
$key = "pgup";
}
menu_launch_type($app);
send_key("super-$key");
wait_still_screen(3);
# Check that it has started
if (get_var("DESKTOP") eq "kde") {
assert_screen("dolphin_runs");
}
else {
assert_screen("apps_run_files");
}
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,89 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script will
# - use the file application to log onto the localhost's
# ftp server while we will ask the system to remember the login credentials.
# - check that the credentials have been stored in the system
# - reboot the computer and check that the system still remembers them
# and that we can do the FTP again without credentials.
sub run {
my $self = shift;
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");
}
else {
# The Nautilus application is already started, so we begin
# with clicking on Other locations.
# We want to add a new connection and go through the
# password addition process.
assert_and_click("keyring_other_location");
assert_and_click("keyring_location_line");
type_very_safely("ftp://127.0.0.1");
assert_and_click("keyring_button_connect");
# We will set up the connection.
assert_and_click("keyring_select_registered");
send_key("tab");
type_very_safely("tucnak");
send_key("tab");
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_remember_forever");
assert_and_click("keyring_button_connect");
# 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 {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,54 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script will check that the password has been added
# 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;
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");
}
else {
# Start the Seahorse application and maximize it.
menu_launch_type("seahorse");
assert_screen("apps_run_seahorse");
send_key("super-up");
# Navigate to the stored entry and check
# that the credentials are stored there.
assert_and_click("keyring_seahorse_login");
assert_and_dclick("keyring_seahorse_details");
assert_screen("keyring_seahorse_details_shown");
assert_and_click("keyring_seahorse_show_password");
assert_screen("keyring_seahorse_password_shown");
}
# Reboot the machine.
$self->root_console(tty => 3);
enter_cmd("reboot");
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,59 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script will open the File application and attempt
# to reconnect to the FTP server, this time without
# having to put credentials into the process.
sub run {
my $self = shift;
my $pw = get_var("USER_PASSWORD") // "weakpassword";
my $desktop = get_var("DESKTOP");
# 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);
if ($desktop eq "kde") {
# Start the file exploring application
menu_launch_type("dolphin");
send_key("super-pgup");
# 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");
}
else {
# Start the file exploring application
send_key("esc");
menu_launch_type("nautilus");
send_key("super-up");
# Open the network location and check
# that the FTP content is accessible.
assert_and_click("keyring_other_location");
assert_and_click("keyring_location_line");
type_very_safely("ftp://127.0.0.1");
assert_and_click("keyring_button_connect");
# Check that we have opened the location and that
# we can see the FTP content.
assert_screen("keyring_test_file");
}
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,30 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite tests that Evince can be switched into night mode.
sub run {
my $self = shift;
# Click on the Menu button.
assert_and_click("gnome_burger_menu", timeout => 30, button => "left");
# Click on the Night mode to select it.
assert_and_click("evince_toggle_night_mode", button => "left", timeout => 30);
# The menu stays opened, so hit Esc to dismiss it.
send_key("esc");
wait_still_screen 2;
# Check that night mode has been activated.
assert_screen("evince_night_mode", timeout => 30);
}
sub test_flags {
return {always_rollback => 1};
}
1;