Add tests for Okular.

This commit is contained in:
Lukáš Růžička 2024-04-02 12:03:53 +02:00
parent eab2732db4
commit 6fd3ff3210
47 changed files with 703 additions and 0 deletions

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 801,
"ypos": 614,
"width": 32,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"kde_button_open"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 352,
"ypos": 216,
"width": 112,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_about_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 216,
"ypos": 113,
"width": 22,
"height": 23,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_add_popup"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 18,
"ypos": 205,
"width": 147,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_annotation_added"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -0,0 +1,16 @@
{
"area": [
{
"xpos": 681,
"ypos": 589,
"width": 35,
"height": 48,
"type": "match",
"match": 90
}
],
"properties": [],
"tags": [
"okular_annotation_placed"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 671,
"ypos": 582,
"width": 46,
"height": 51,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_annotation_removed"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 534,
"ypos": 272,
"width": 53,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_button_credits"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 993,
"ypos": 118,
"width": 17,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_close_annotation"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 355,
"ypos": 339,
"width": 88,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_credits_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 448,
"ypos": 8,
"width": 127,
"height": 15,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_file_opened"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 262,
"ypos": 226,
"width": 65,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_file_select_pdf"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 416,
"ypos": 244,
"width": 89,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_menu_about"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 311,
"ypos": 516,
"width": 101,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_open_file_dialog"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 710,
"ypos": 673,
"width": 62,
"height": 15,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_remove_annotation"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 335,
"ypos": 396,
"width": 46,
"height": 54,
"type": "match"
}
],
"properties": [],
"tags": [
"okular_runs"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -2312,6 +2312,17 @@
"START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%"
}
},
"okular": {
"profiles": {
"fedora-KDE-live-iso-x86_64-*-64bit": 42
},
"settings": {
"BOOTFROM": "c",
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
"POSTINSTALL_PATH": "tests/applications/okular",
"START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%"
}
},
"mediakit_fileconflicts": {
"profiles": {
"fedora-Server-dvd-iso-aarch64-*-aarch64": 10,

View File

@ -0,0 +1,49 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script will download the test data for Okular, start the application,
# and set a milestone as a starting point for the other Okular tests.
#
sub run {
my $self = shift;
# Switch to console
$self->root_console(tty => 3);
# Perform git test
check_and_install_git();
# Download the test data
download_testdata();
# Exit the terminal
desktop_vt;
# Start the application
menu_launch_type("okular");
# Check that is started
assert_screen 'okular_runs';
# Open the test file to create a starting point for the other Okular tests.
# Click on Open button to open the File Open Dialog
assert_and_click("okular_open_file_dialog", button => "left", timeout => 30);
# Select the evince.pdf file.
assert_and_click("okular_file_select_pdf", button => "left", timeout => 30);
# Click the Open button to open the file
assert_and_click("kde_button_open", button => "left", timeout => 30);
# Fullsize the Evince window.
send_key("super-pgup");
# Check that the file has been successfully opened.
assert_screen("okular_file_opened");
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,34 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite tests if About works.
sub run {
my $self = shift;
# Open the menu by clicking on the Burger icon
assert_and_click("kde_mainmenu_help", button => "left", timeout => 30);
wait_still_screen 2;
# In the menu, select the About item.
assert_and_click("okular_menu_about", button => "left", timeout => 30);
# Check that the About section has been displayed.
assert_screen("okular_about_shown");
# Click on Credits button to see the second part of the dialogue.
assert_and_click("okular_button_credits", button => "left", timeout => 30);
# Check that Credits are accessible and visible, too.
assert_screen("okular_credits_shown");
}
sub test_flags {
# Rollback to the previous state to make space for other parts.
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,61 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite tests an annotation can be added to the displayed content.
sub run {
my $self = shift;
# Press the F6 button to open the annotation menu.
send_key("f6");
wait_still_screen(2);
# Click on Note text.
assert_and_click("okular_add_popup", button => "left", timeout => 30);
# Select location to add annotation.
assert_and_click("okular_select_annotation_place", button => "left", timeout => 30);
# Enter some text to the annotation.
type_very_safely("This is an impotant note.");
# Check that the annotation window has appeared with that text.
assert_screen("okular_annotation_added");
# Close the annotation window
send_key("esc");
# Close the annotation mode.
assert_and_click("okular_close_annotation", button => "left", timeout => 30);
# Check that the annotation is still placed in the document.
assert_screen("okular_annotation_placed");
# Reopen the annotation.
assert_and_dclick("okular_annotation_placed", button => "left", timeout => 30);
# Check that the annotation still has that text.
assert_screen("okular_annotation_added");
# Close the window again
send_key("esc");
# Open the annotation's context menu.
assert_and_click("okular_annotation_placed", button => "right", timeout => 30);
# Remove the annotation.
assert_and_click("okular_remove_annotation", button => "left", timeout => 30);
# Check that the annotation has been removed.
assert_screen("okular_annotation_removed");
}
sub test_flags {
# Rollback to the starting point.
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,27 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite tests that Evince can change the zoom of the document.
sub run {
my $self = shift;
# Click on zoom menu to open choices.
assert_and_click("okular_change_zoom", button => "left", timeout => 30);
# Select 200%.
assert_and_click("okular_select_zoom_200", button => "left", timeout => 30);
# Check that the document zoom was changed.
assert_screen("okular_document_zoom_200");
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,31 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite tests that Evince is able to display content in a two-page mode.
sub run {
my $self = shift;
# Click on the Zoom menu to change a different zoom for next steps.
assert_and_click("okular_change_zoom", button => "left", timeout => 30);
# Select the Fit Width option to be able to see the whole layout.
assert_and_click("okular_select_zoom_fitwidth", button => "left", timeout => 30);
# Enter the menu
assert_and_click("okular_view_mode", button => "left", timeout => 30);
# Select the Dual mode
assert_and_click("okular_facing_pages", button => "left", timeout => 30);
# Check that the content is displayed in dual mode.
assert_screen("okular_dual_mode", timeout => 30);
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,27 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite tests that Evince can display the Help pages.
sub run {
my $self = shift;
# Open menu with Burger icon.
assert_and_click("gnome_burger_menu", button => "left", timeout => 30);
wait_still_screen 2;
# Select the Help item in the menu.
assert_and_click("evince_menu_help", button => "left", timeout => 30);
wait_still_screen 2;
# Check that Help has been shown.
assert_screen("evince_help_shown", timeout => 30);
}
sub test_flags {
return {always_rollback => 1};
}
1;

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;

View File

@ -0,0 +1,27 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite tests that Evince can show Document Properties.
sub run {
my $self = shift;
# Open the menu.
assert_and_click("gnome_burger_menu", button => "left", timeout => 30);
wait_still_screen 2;
# Select the Properties item.
assert_and_click("evince_menu_properties", button => "left", timeout => 30);
wait_still_screen 2;
# Check that Properties are shown.
assert_screen("evince_properties_shown", timeout => 30);
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,34 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite tests that Evince can rotate the content.
sub rotate_content {
# Send the key combo to rotate the content
send_key("ctrl-right");
}
sub run {
my $self = shift;
# Rotate the content once.
rotate_content();
# Check that the window content has been rotated.
assert_screen("evince_content_rotated_once", timeout => 30);
# Rotate the content again.
rotate_content();
# Check that the window content has been rotated.
assert_screen("evince_content_rotated_twice", timeout => 30);
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,49 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite tests tests that Evince can Save the document As another document.
sub run {
my $self = shift;
# Open the menu.
assert_and_click("gnome_burger_menu", button => "left", timeout => 30);
# Select Save As
assert_and_click("evince_menu_saveas", button => "left", timeout => 30);
wait_still_screen(2);
# Type a new name.
type_very_safely("alternative");
# Click on the Save button
if (get_var("CANNED")) {
# FIXME: as of 2023-03-30 on the flatpak version of evince, the save as
# default target dir is wrong:
# https://bugzilla.redhat.com/show_bug.cgi?id=2183356
# so we need to click into Documents first
assert_and_click("evince_documents", button => "left", timeout => 30);
}
assert_and_click("gnome_button_save_blue", button => "left", timeout => 30);
# Now the document is saved under a different name. We will switch to the
# terminal console to check that it has been created.
$self->root_console(tty => 3);
my $filename = "alternative.pdf";
if (script_run("ls /home/test/Documents/${filename}")) {
$filename = "alternativeevince.pdf";
assert_script_run("ls /home/test/Documents/${filename}");
record_soft_failure("File name was not pre-selected in Save As dialog: https://gitlab.gnome.org/GNOME/gtk/-/issues/4768");
}
# Now, check that the new file does not differ from the original one.
assert_script_run("diff /home/test/Documents/evince.pdf /home/test/Documents/${filename}");
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,28 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite tests the ability to search string in the text.
sub run {
my $self = shift;
# Click on the Search button to search for text
assert_and_click("evince_search_button", button => "left", timeout => 30);
# Type *pages*.
type_very_safely("pages");
# Press Enter.
send_key("ret");
# Check that the typed text has been found.
assert_screen("evince_search_found", timeout => 30);
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,39 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite tests that Evince displays shortcuts.
sub run {
my $self = shift;
# Open the menu
assert_and_click("gnome_burger_menu", button => "left", timeout => 30);
wait_still_screen 2;
# Select the Keyboard Shortcuts item
assert_and_click("evince_menu_shortcuts", button => "left", timeout => 30);
wait_still_screen 2;
# Check that Shortcuts has been shown
assert_screen("evince_shortcuts_shown");
# Click on number 2 to arrive to the second page
assert_and_click("evince_shortcuts_second", button => "left", timeout => 30);
# Check that Shortcuts 2 has been shown
assert_screen("evince_shortcuts_second_shown");
# Click on number 3 to arrive to the second page
assert_and_click("evince_shortcuts_third", button => "left", timeout => 30);
# Check that Shortcuts 3 has been shown
assert_screen("evince_shortcuts_third_shown");
}
sub test_flags {
return {always_rollback => 1};
}
1;