Compare commits

...

10 Commits

Author SHA1 Message Date
Lukáš Růžička 5f8bb47f32 Fix the KDE test for keyring_password. 2024-05-10 17:34:57 +02:00
Lukáš Růžička bea118971b Work on KDE version. 2024-05-07 08:15:36 +02:00
Lukáš Růžička e40d02656a Readd needles. 2024-05-06 10:25:48 +02:00
Lukáš Růžička 911633acad Clean unused needles. 2024-05-03 15:19:54 +02:00
Lukáš Růžička 58fa4c4da1 Add needles. 2024-05-03 15:10:20 +02:00
Lukáš Růžička cd35ae6008 Finish the tests for Gnome (no needle purge) 2024-05-03 15:07:51 +02:00
Lukáš Růžička f3175e5abc Start rewriting for SSH 2024-04-29 19:27:59 +02:00
Lukáš Růžička ee26c97cb7 Try first run. 2024-04-26 14:57:26 +02:00
Lukáš Růžička f38e22b10e Rewrite partly for SSH. 2024-04-26 14:52:36 +02:00
Lukas Ruzicka fbaf1652d8 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.
2024-04-26 11:22:25 +02:00
41 changed files with 658 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": 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,24 @@
{
"area": [
{
"xpos": 184,
"ypos": 329,
"width": 107,
"height": 13,
"type": "match",
"match": 90
},
{
"xpos": 185,
"ypos": 383,
"width": 111,
"height": 13,
"type": "match",
"match": 90
}
],
"properties": [],
"tags": [
"keyring_multiple_instances"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 383,
"ypos": 436,
"width": 133,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_open_when_logged"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 442,
"ypos": 261,
"width": 126,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_seahorse_details_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 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": 338,
"ypos": 111,
"width": 169,
"height": 26,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_seahorse_login_details"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 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": 586,
"ypos": 510,
"width": 58,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_sshkey_unlock"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 361,
"ypos": 104,
"width": 141,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"nautilus_connection_established"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 260,
"ypos": 608,
"width": 138,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"nautilus_enter_address"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 258,
"ypos": 610,
"width": 140,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"nautilus_enter_address"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 109,
"ypos": 559,
"width": 109,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"nautilus_other_locations"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 381,
"ypos": 434,
"width": 142,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"nautilus_remember_password"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 587,
"ypos": 495,
"width": 52,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"nautilus_unlock"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 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

@ -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,56 @@
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 set up the SSHd to accept connections with an SSH key
# - we will create the ssh key for the user
sub run {
my $self = shift;
my $desktop = get_var("DESKTOP");
my $user = get_var("USER") || "test";
# Switch to console to perform several setting tasks.
$self->root_console(tty => 3);
# While KWalletManager is part of KDE by default, seahorse
# have been removed from Gnome so we need to install it.
if ($desktop eq "gnome") {
assert_script_run("dnf -y install seahorse");
}
# Enable and start SSHd.
assert_script_run("systemctl enable sshd.service --now");
# Check that it is running (the assertion will fail if not)
assert_script_run("systemctl status sshd.service --no-pager");
# Create the SSH keys for the regular user.
# Switch to the user's account.
enter_cmd("su -l $user");
sleep 2;
# Create the SSH key.
enter_cmd("ssh-keygen");
sleep 2;
# Press enter to create the key in default location.
send_key("ret");
sleep 2;
# Create a password for the SSH key.
type_very_safely("sshpassword\n");
sleep 2;
type_very_safely("sshpassword\n");
sleep 2;
# Logout the regular user and return
# back to the root console.
enter_cmd("exit");
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,168 @@
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 export_kde_vars {
# On KDE, it is possible to update and reuse the keyring
# on Konsole if correct environmental variables are set.
# Set them now.
enter_cmd('export SSH_ASKPASS=/usr/bin/ksshaskpass');
sleep 2;
enter_cmd('export SSH_ASKPASS_REQUIRE=prefer');
sleep 2;
}
sub connect_localhost {
# Use some method to connect to the local host. This should
# trigger the keyring and the login credentials should
# be stored for later reuse. Pass $type eq "reconnect"
# to use this function repetitiously.
my $type = shift;
my $user = get_var("USER_LOGIN", "test");
my $pass = get_var("USER_PASSWORD", "weakpassword");
if (get_var("DESKTOP") eq "gnome") {
# On Gnome, we will use Nautilus to establish an SFTP
# connection to the localhost.
menu_launch_type("nautilus");
assert_screen("apps_run_files");
# Add a network connection - click on the icon and
# fill in the necessary fields.
assert_and_click("nautilus_other_locations");
assert_and_click("nautilus_enter_address");
type_very_safely("ssh://$user");
type_very_safely('@localhost');
send_key("ret");
# If we perform this for the first time, ergo
# we do not want to "reconnect", also perform
# extra steps to store the password.
if ($type ne "reconnect") {
wait_still_screen(3);
type_very_safely($pass);
assert_and_click("nautilus_remember_password");
assert_and_click("nautilus_unlock");
}
# When the connection has been established, let us
# confirm and close the application.
assert_screen("nautilus_connection_established");
send_key("alt-f4");
}
else {
# On KDE, Dolphin has a bug that prevents the application
# from connecting easily (as in Gnome). Manually, this is
# not a big deal, as one could react accordingly, but with
# automation, this approach is basically useless.
# Therefore, we will use a different approach - we will enable
# CLI keyring integration and perform an SFTP connection
# in Konsole.
menu_launch_type("konsole");
assert_screen("konsole_runs");
# Export the environmental variables.
export_kde_vars();
# Connect the sftp.
type_very_safely('sftp ' . $user . '@localhost' . "\n");
# If performed for the first time, also deal with the
# password storing which is a little painful on KDE.
if ($type ne "reconnect") {
# First, we check that the yes no dialogue is present.
# And type "yes" into it.
assert_screen("keyring_askpass_yesno");
type_very_safely("yes\n");
# Then check the password dialogue and fill it in.
# Also click on Remember password and confirm with
# the OK button.
assert_screen("keyring_askpass_password");
type_very_safely("$pass");
assert_and_click("keyring_askpass_remember");
assert_and_click("keyring_askpass_confirm");
}
# Check that we have logged in and exit the application.
# On "reconnect" the password storing routine will not be
# used and we should still be able to get logged in as
# the credentials are already stored.
assert_and_click("keyring_sftp_logged");
type_very_safely("bye\n");
}
}
sub check_stored {
# This subroutine will run the keyring application on either
# desktop and check that the password has been stored there.
# On KDE, we will use the KWalletManager.
if (get_var("DESKTOP") eq "kde") {
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_wallet_passwords_unfold");
assert_and_dclick("keyring_wallet_password_stored");
assert_and_click("keyring_wallet_password_details");
assert_and_click("keyring_wallet_password_reveal");
assert_screen("keyring_wallet_password");
}
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_login_details");
assert_screen("keyring_seahorse_details_shown");
assert_and_click("keyring_seahorse_show_password");
assert_screen("keyring_seahorse_password_shown");
}
}
sub run {
my $self = shift;
my $desktop = get_var("DESKTOP");
my $user = get_var("USER_LOGIN", "test");
my $pass = get_var("USER_PASSWORD", "weakpassword");
# We are still at the root console, but for the following steps,
# there is nothing we should be doing there, so we switch back
# to the graphical desktop.
desktop_vt();
# Lets connect to localhost via SSH. This should result in
# asking for a password and storing the credentials for later use.
# The following routine uses different approaches on different
# desktops.
connect_localhost("connect");
# Check that the password has been stored.
check_stored();
# Reboot the machine, log onto the session again.
$self->root_console(tty => 3);
enter_cmd("reboot");
# Boot to login screen and type in the password.
boot_to_login_screen();
if ($desktop eq "gnome") {
send_key("ret");
}
type_very_safely("$pass\n");
wait_still_screen(3);
send_key("esc");
# Repeat the connection procedure, this time we will not
# expect to be using any passwords as this should be handled
# by the keyring.
connect_localhost("reconnect");
}
sub test_flags {
return {fatal => 0, always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,111 @@
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 connect_localhost {
my $user = get_var("USER_LOGIN", "test");
my ($type) = @_;
# Start the terminal application.
if (get_var("DESKTOP") eq "gnome") {
menu_launch_type("terminal");
assert_screen("apps_run_terminal");
}
else {
menu_launch_type("konsole");
assert_screen("konsole_runs");
}
# Use SSH to log onto the localhost without needing
# a password. The log-in process should only require
# the actual command.
type_very_safely("ssh $user");
type_very_safely('@localhost');
send_key("ret");
sleep 2;
if ($type ne "reconnect") {
# Answer yes for the upcoming warning.
type_very_safely("yes\n");
wait_still_screen(2);
# Open the SSH key.
type_very_safely("sshpassword");
# Unlock the password when logged in.
assert_and_click("keyring_open_when_logged");
assert_and_click("keyring_sshkey_unlock");
wait_still_screen(2);
}
# Check that more instances are logged in.
enter_cmd("who\n");
assert_screen("keyring_multiple_instances");
# Exit the terminal app.
enter_cmd("exit");
}
sub run {
my $self = shift;
my $desktop = get_var("DESKTOP");
my $user = get_var("USER_LOGIN", "test");
my $pass = get_var("USER_PASSWORD", "weakpassword");
# We are still at the root console and for the following steps,
# we will need to perform more set up steps.
# We install the necessary packages.
if ($desktop eq "gnome") {
assert_script_run("dnf -y install seahorse");
}
# Set up the SSH daemon
# Create a drop-in configuration file.
enter_cmd("touch /etc/ssh/ssh_config.d/30-passwordless.conf");
enter_cmd('echo "Host *" >> /etc/ssh/ssh_config.d/30-passwordless.conf');
enter_cmd('echo " PasswordAuthentication no" >> /etc/ssh/ssh_config.d/30-passwordless.conf');
# Restart the SSHd.
assert_script_run("systemctl restart sshd.service");
# Check that it is running (the assertion will fail if not)
assert_script_run("systemctl status sshd.service --no-pager");
# Authorize the SSH key.
enter_cmd("su -l $user");
enter_cmd('echo $(cat ~/.ssh/id_ed25519.pub) > ~/.ssh/authorized_keys');
enter_cmd("exit");
# Return to desktop
desktop_vt();
# Use SSH to connect to the localhost.
connect_localhost("connect");
# Reboot the machine, log onto the session again.
$self->root_console(tty => 3);
enter_cmd("reboot");
boot_to_login_screen();
send_key("ret");
type_very_safely("$pass\n");
wait_still_screen(3);
send_key("esc");
# Reconnect without using password. We still should be
# able to log in.
connect_localhost("reconnect");
}
sub test_flags {
return {fatal => 0, always_rollback => 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;