diff --git a/lib/utils.pm b/lib/utils.pm index 45717190..ab028f3a 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -307,6 +307,14 @@ sub desktop_vt { assert_script_run "echo SCAN ${user}-finger-1 | socat STDIN UNIX-CONNECT:/run/fprintd-virt"; send_key "ctrl-alt-f${tty}"; } + elsif (match_has_tag "auth_required_locked") { + # When console operation takes a long time, the screen locks + # and typing password fails. If that happens, unlock + # the screen first and then type password. + send_key("ret"); + wait_still_screen(2); + type_very_safely "weakpassword\n"; + } else { # bit sloppy but in all cases where this is used, this is the # correct password @@ -1540,6 +1548,9 @@ sub check_and_install_git { # The data repository is located at https://pagure.io/fedora-qa/openqa_testdata. sub download_testdata { + # We can select which Data to copy over. + my $data = shift; + $data = 'structure' unless ($data); # Navigate to the user's home directory my $user = get_var("USER_LOGIN") // "test"; assert_script_run("cd /home/$user/"); @@ -1551,11 +1562,17 @@ sub download_testdata { # Untar it. assert_script_run("tar -zxvf repository.tar.gz"); # Copy out the files into the VMs directory structure. - assert_script_run("cp music/* /home/$user/Music"); - assert_script_run("cp documents/* /home/$user/Documents"); - assert_script_run("cp pictures/* /home/$user/Pictures"); - assert_script_run("cp video/* /home/$user/Videos"); - assert_script_run("cp reference/* /home/$user/"); + if ($data eq "structure") { + assert_script_run("cp music/* /home/$user/Music"); + assert_script_run("cp documents/* /home/$user/Documents"); + assert_script_run("cp pictures/* /home/$user/Pictures"); + assert_script_run("cp video/* /home/$user/Videos"); + assert_script_run("cp reference/* /home/$user/"); + } + else { + assert_script_run("mkdir /home/$user/$data"); + assert_script_run("cp $data/* /home/$user/$data/"); + } # Delete the temporary directory and the downloaded file. assert_script_run("cd"); assert_script_run("rm -rf /home/$user/temp"); diff --git a/needles/gnome/apps/apps_run_focuswriter.json b/needles/gnome/apps/apps_run_focuswriter.json new file mode 100644 index 00000000..d6a75678 --- /dev/null +++ b/needles/gnome/apps/apps_run_focuswriter.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 814, + "ypos": 43, + "width": 79, + "height": 99, + "type": "match" + } + ], + "properties": [], + "tags": [ + "apps_run_focuswriter" + ] +} \ No newline at end of file diff --git a/needles/gnome/apps/apps_run_focuswriter.png b/needles/gnome/apps/apps_run_focuswriter.png new file mode 100644 index 00000000..28669961 Binary files /dev/null and b/needles/gnome/apps/apps_run_focuswriter.png differ diff --git a/needles/gnome/apps/apps_run_gvim.json b/needles/gnome/apps/apps_run_gvim.json new file mode 100644 index 00000000..db3a776c --- /dev/null +++ b/needles/gnome/apps/apps_run_gvim.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 446, + "ypos": 119, + "width": 129, + "height": 19, + "type": "match" + } + ], + "properties": [], + "tags": [ + "apps_run_gvim" + ] +} \ No newline at end of file diff --git a/needles/gnome/apps/apps_run_gvim.png b/needles/gnome/apps/apps_run_gvim.png new file mode 100644 index 00000000..4265277e Binary files /dev/null and b/needles/gnome/apps/apps_run_gvim.png differ diff --git a/needles/gnome/auth_required-locked.json b/needles/gnome/auth_required-locked.json new file mode 100644 index 00000000..1eb8fec7 --- /dev/null +++ b/needles/gnome/auth_required-locked.json @@ -0,0 +1,16 @@ +{ + "area": [ + { + "type": "match", + "xpos": 415, + "ypos": 491, + "width": 194, + "height": 34 + } + ], + "properties": [], + "tags": [ + "auth_required_locked", + "auth_required" + ] +} diff --git a/needles/gnome/auth_required-locked.png b/needles/gnome/auth_required-locked.png new file mode 100644 index 00000000..dbc7686e Binary files /dev/null and b/needles/gnome/auth_required-locked.png differ diff --git a/templates.fif.json b/templates.fif.json index 31108f2b..9bafb95f 100644 --- a/templates.fif.json +++ b/templates.fif.json @@ -1154,6 +1154,18 @@ "START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%" } }, + "flatpak": { + "profiles": { + "fedora-Silverblue-dvd_ostree-iso-ppc64le-*-ppc64le": 50, + "fedora-Silverblue-dvd_ostree-iso-x86_64-*-64bit": 50 + }, + "settings": { + "BOOTFROM": "c", + "HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2", + "POSTINSTALL": "flatpak_fedora flatpak_flathub flatpak_update", + "START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%" + } + }, "gnome-panel": { "profiles": { "fedora-Silverblue-dvd_ostree-iso-ppc64le-*-ppc64le": 50, diff --git a/tests/flatpak_fedora.pm b/tests/flatpak_fedora.pm new file mode 100644 index 00000000..4c9a6144 --- /dev/null +++ b/tests/flatpak_fedora.pm @@ -0,0 +1,55 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# This script tests that the flatpak technology is correctly set up +# and that it can be used without tweaking any settings or installing +# any packages on the system. + +sub run { + + my $self = shift; + $self->root_console(tty => 3); + + # Check that that Flatpak is installed on the System. + # If the following command succeeds, we can assume that Flatpak is installed. + assert_script_run("flatpak --version"); + + # Check that at least Fedora remote repository is properly configured + validate_script_output("flatpak remotes", sub { m/fedora/ }); + + # Check that an application exists in the repository + validate_script_output("flatpak search gvim", sub { m/org.vim.Vim/ }); + + # Check that the application can be installed. + assert_script_run("flatpak -y install org.vim.Vim", timeout => 720); + + # Check that it is listed as installed + assert_script_run("flatpak list | grep GVim"); + + # Now, we will switch into the Desktop and we will try to run the application + desktop_vt(); + wait_still_screen(3); + menu_launch_type("gvim"); + assert_screen("apps_run_gvim"); + # Switch off the application + type_very_safely(":qa\n"); + + # We will switch to the CLI again + $self->root_console(tty => 3); + + ## Now, we will remove the application again. + assert_script_run("flatpak -y remove org.vim.Vim", timeout => 240); + + # Check that it the application is not listed among installed any more. + assert_script_run("! flatpak list | grep GVim"); +} + +sub test_flags { + return {fatal => 1}; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/flatpak_flathub.pm b/tests/flatpak_flathub.pm new file mode 100644 index 00000000..27eca221 --- /dev/null +++ b/tests/flatpak_flathub.pm @@ -0,0 +1,55 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# This script tests that the Flathub repository can be added and that applications +# from that repository can be installed. + +sub run { + + my $self = shift; + $self->root_console(tty => 3); + + # On Silverblue, Flathub is not set as a Flatpak remote by default, only when Third Party Repos + # are enabled. To make sure, we have it enabled, we will use the following command to + # add the Flathub repository. + assert_script_run("sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo"); + + # Check that the Flathub repository has been added into the repositories. + validate_script_output("flatpak remotes", sub { m/flathub/ }); + + # Now, we can search for an application that only exists in Flathub. + validate_script_output("flatpak search focuswriter", sub { m/org.gottcode.FocusWriter/ }); + + # And we can install it + assert_script_run("flatpak install -y org.gottcode.FocusWriter", timeout => 600); + + # Check that now the application is listed in the installed flatpaks. + assert_script_run("flatpak list | grep org.gottcode.FocusWriter"); + + + # Switch to desktop and try to run the application. + desktop_vt(); + wait_still_screen(3); + menu_launch_type("focuswriter"); + # Check that it started + assert_screen("apps_run_focuswriter"); + # Stop the application + send_key("alt-f4"); + + # Switch to console again. + $self->root_console(tty => 3); + + # Now, remove the package and test that it is not listed. + assert_script_run("flatpak remove -y org.gottcode.FocusWriter"); + assert_script_run("! flatpak list | grep org.gottcode.FocusWriter"); +} + +sub test_flags { + return {fatal => 1}; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/flatpak_update.pm b/tests/flatpak_update.pm new file mode 100644 index 00000000..8b3a0d4c --- /dev/null +++ b/tests/flatpak_update.pm @@ -0,0 +1,53 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# This script tests that we can update (and downgrade) flatpaks. We will +# use a test repository with a Dummy application. + +sub run { + + my $self = shift; + $self->root_console(tty => 3); + # We will need Flathub to pull dependencies. + # Flathub is not set as a Flatpak remote by default, only when Third Party Repos + # are enabled. To make sure, we have it enabled, we will use the following command to + # add the Flathub repository. + assert_script_run("sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo", timeout => 120); + # We will also add the test repository. + assert_script_run("flatpak remote-add --if-not-exists flatpaktest https://lruzicka.fedorapeople.org/flatpaktest/flatpaktest.flatpakrepo", timeout => 120); + + # Install the Dummy application. + assert_script_run("flatpak install -y org.flatpak.Dummy", timeout => 600); + # Check that the application has been installed + assert_script_run("flatpak list | grep org.flatpak.Dummy"); + + # The application is installed in version 2. Let's check the output. + validate_script_output("flatpak run org.flatpak.Dummy", sub { m/Dummy flatpak: version 2/ }); + + # Now, we will attempt to downgrade the application to force the previous commit + assert_script_run("flatpak update -y --commit=37be70fa26aa652379f968a7aaf7b63fa515483b9381756cd371c8174ae68626 org.flatpak.Dummy"); + + # If that was successful, the output of the application will show version 1. + validate_script_output("flatpak run org.flatpak.Dummy", sub { m/Dummy flatpak: version 1/ }); + + # Now we can update the application again, using the standard command, which will update to the + # newest version (version 2) of the application again. + assert_script_run("flatpak update -y org.flatpak.Dummy"); + # Let's check the application now provides the correct output. + validate_script_output("flatpak run org.flatpak.Dummy", sub { m/Dummy flatpak: version 2/ }); + + # Now, remove the package and test that it is not listed and that it cannot be run. + assert_script_run("flatpak remove -y org.flatpak.Dummy"); + validate_script_output("flatpak list", sub { $_ !~ m/org\.flatpak\.Dummy/ }); + assert_script_run("! flatpak run org.flatpak.Dummy", sub { $_ !~ m/Dummy flatpak: version 2/ }); +} + +sub test_flags { + return {fatal => 1}; +} + +1; + +# vim: set sw=4 et: