1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2025-05-15 13:01:33 +00:00
os-autoinst-distri-fedora/tests/flatpak_flathub.pm
Lukáš Růžička 653fb2938f Enhance the menu_launch_type subroutine.
The previous version of menu_launch_type took the name of the
application as an argument and it started the application.
To maximize the application or to check that it has started indeed
we had to do it manually.

Now, the application also takes "maximize => 1" or "checkstart => 1"
to maximize the application or check that it has started as optional
arguments to avoid doing it manually, while it still accepts just
the name of the application and behaves like it did before.

Note that if you decide to use the checkstart argument, you
also need to update the check-needles.py script to whitelist
the application needle tag, see the example test scripts
attached to this PR.

Fixes: https://pagure.io/fedora-qa/os-autoinst-distri-fedora/issue/329
2025-03-05 19:59:40 +00:00

59 lines
2.2 KiB
Perl

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);
# Trust the SSL certificate for the proxy we use to MITM flathub
# to reduce external traffic
# https://pagure.io/fedora-infrastructure/issue/11634
assert_script_run("curl -o /etc/pki/ca-trust/source/anchors/flathub-proxy.crt https://fedorapeople.org/groups/qa/openqa-data/flathub-proxy.crt");
assert_script_run("update-ca-trust");
# 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 http_proxy=http://flatpak-cache01.iad2.fedoraproject.org:3128 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("http_proxy=http://flatpak-cache01.iad2.fedoraproject.org:3128 flatpak search focuswriter", sub { m/org.gottcode.FocusWriter/ });
# And we can install it
assert_script_run("http_proxy=http://flatpak-cache01.iad2.fedoraproject.org:3128 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", checkstart => 1);
# 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: