diff --git a/lib/desktoptools.pm b/lib/desktoptools.pm index 90847beb..adc4003a 100644 --- a/lib/desktoptools.pm +++ b/lib/desktoptools.pm @@ -8,7 +8,52 @@ use Exporter; use testapi; use utils; -our @EXPORT = qw/install_application start_application_via_packagemanager check_app_installed remove_application restart_application/; +our @EXPORT = qw/find_application install_application start_application_via_packagemanager check_app_installed remove_application restart_application/; + +# This subroutine searches for the application using the package manager's +# search method. Currently, the routine is only available for Gnome Software. +sub find_application { + my $application = shift; + assert_and_click("gnome_search_button"); + wait_still_screen(2); + type_safely($application); + # Confirm that the application has been found and shown + # in the overview, click on it to enter the installation + # tab and confirm it has opened. + assert_and_click("software_$application-found"); + wait_still_screen(2); + assert_screen("software_$application-install_pane"); +} + +# This subroutine checks that the application shows appropriate +# information. +sub check_application_information { + my $application = shift; + # The logo, the screenshot, and the description should be visible + # without any intervention needed. + assert_screen("software_logo_$application"); + assert_screen("software_screenshot_$application"); + assert_screen("software_description_$application"); + + # Other elements are placed below the visible area + # so we need to move there, if we want to see it. + # The safest option is to hit the tab key until + # we reach that element. + send_key_until_needlematch("software_download_size_$application", "tab", counter => 10); + # Now, other metadata should be visible two, so let's check them + assert_screen("software_safestatus_$application"); + assert_screen("software_usage_$application"); + assert_screen("software_rating_$application"); + + # Again, let's move a bit down + send_key_until_needlematch("software_website_$application", "tab", counter => 10); + # Let's click on the link to open the website + click_lastmatch(); + + # Check, that the webpage has opened with correct information. + assert_screen("software_weblink_$application"); + assert_screen("software_webcontent_$application"); +} # This subroutine installs an application via the # GUI application, such as Gnome Software, or Discover. @@ -26,16 +71,6 @@ sub install_application { if (check_screen("software_back_button")) { click_lastmatch(); } - # Search for the application. - assert_and_click("gnome_search_button"); - wait_still_screen(2); - type_safely($application); - # Confirm that the application has been found and shown - # in the overview, click on it to enter the installation - # tab and confirm it has opened. - assert_and_click("software_$application-found"); - wait_still_screen(2); - assert_screen("software_$application-install_pane"); # For some applications, there are more installation sources # available. Pick the desired one. diff --git a/tests/applications/software/browse_applications.pm b/tests/applications/software/browse_applications.pm new file mode 100644 index 00000000..320d51a5 --- /dev/null +++ b/tests/applications/software/browse_applications.pm @@ -0,0 +1,39 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; +use desktoptools; + +# This script tests if Software can browse through various applications. + +# As we cannot browse through all of the applications, we will only focus +# on three application, for example KTurtle, IDLE3, and Falkon. + +sub run { + my $self = shift; + + # Find KTurtle and check for its details. + find_application("kturtle"); + check_application_details("kturtle"); + assert_and_click("gnome_back_button"); + + # Find IDLE3 and check for its details. + find_application("idle3"); + check_application_details("idle3"); + assert_and_click("gnome_back_button"); + + # Find Falkon and check for its details. + find_application("falkon"); + check_application_details("falkon"); + assert_and_click("gnome_back_button"); +} + +sub test_flags { + # When finished, rollback to milestone + return {always_rollback => 1}; +} + +1; + +# vim: set sw=4 et: +