Create a test suite for KWrite

This commit is contained in:
Lukáš Růžička 2024-03-25 11:34:00 +01:00 committed by Lukas Ruzicka
parent abe551596d
commit eab2732db4
78 changed files with 874 additions and 1 deletions

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 218,
"ypos": 159,
"width": 333,
"height": 26,
"type": "match"
}
],
"properties": [],
"tags": [
"anaconda_select_install_lang_filtered"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 253,
"ypos": 60,
"width": 110,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_about_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 212,
"ypos": 393,
"width": 60,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_button_new_file"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 46,
"ypos": 107,
"width": 151,
"height": 85,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_code_highlighted"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 436,
"ypos": 115,
"width": 52,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_credits"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 258,
"ypos": 185,
"width": 132,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_credits_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 100,
"ypos": 251,
"width": 126,
"height": 15,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_display_line_numbers"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 459,
"ypos": 4,
"width": 108,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_file_saved"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 80,
"ypos": 194,
"width": 64,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_found_text"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 385,
"ypos": 170,
"width": 167,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_help_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 48,
"ypos": 196,
"width": 222,
"height": 31,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_line_deleted"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 47,
"ypos": 106,
"width": 150,
"height": 14,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_line_title"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 221,
"ypos": 197,
"width": 35,
"height": 14,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_line_word"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 3,
"ypos": 106,
"width": 78,
"height": 34,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_lines_numbered"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 2,
"ypos": 105,
"width": 54,
"height": 34,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_lines_numbered_off"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 757,
"ypos": 693,
"width": 69,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_markdown_selected"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 310,
"ypos": 36,
"width": 53,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_menu_settings"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 256,
"ypos": 33,
"width": 38,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_menu_tools"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 454,
"ypos": 5,
"width": 114,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_new_document_opened"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 286,
"ypos": 253,
"width": 188,
"height": 13,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_newwindow_shortcut_found"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 230,
"ypos": 152,
"width": 51,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_search_bar"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 262,
"ypos": 248,
"width": 75,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_select_documents"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 387,
"ypos": 112,
"width": 189,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_shortcuts_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 403,
"ypos": 242,
"width": 86,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_submenu_about"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 304,
"ypos": 93,
"width": 82,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_submenu_highlight"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 608,
"ypos": 251,
"width": 52,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_submenu_markup"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 421,
"ypos": 315,
"width": 134,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_submenu_shorcuts"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 48,
"ypos": 193,
"width": 220,
"height": 36,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_text_added"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"width": 123,
"xpos": 449,
"height": 21,
"type": "match",
"ypos": 4
}
],
"properties": [],
"tags": [
"kcalc_text_file_opened"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 453,
"ypos": 6,
"width": 120,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_text_file_opened"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 49,
"ypos": 193,
"width": 301,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_text_replaced"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 262,
"ypos": 271,
"width": 59,
"height": 15,
"type": "match"
}
],
"properties": [],
"tags": [
"kwrite_txt_file"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 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": 806,
"ypos": 94,
"width": 15,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"kde_window_maximize"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 KiB

View File

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

View File

@ -11,7 +11,7 @@ sub run {
# before we start testing.
sleep 5;
# Open the menu and click on the About item.
assert_and_click("kcalc_mainmenu_help");
assert_and_click("kde_mainmenu_help");
wait_still_screen(2);
assert_and_click("kcalc_submenu_about");
# Check that it is shown.

View File

@ -0,0 +1,57 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part of the suite prepares downloads the test data and sets up the environment.
sub run {
my $self = shift;
# Go to the root console to set up the test data and necessary stuff.
$self->root_console(tty => 3);
# Get the test data from the test data repository.
check_and_install_git();
download_testdata();
# Remove gedit on upgraded systems so we don't launch it by accident
script_run("dnf -y remove gedit") if (get_var("IMAGETYPE") eq "upgrade");
# Return to Desktop
desktop_vt();
# Start the application
menu_launch_type("kwrite");
# Check that it started
assert_screen("kwrite_runs");
# Hit key-combo to open the file
send_key("ctrl-o");
wait_still_screen(2);
# Select the Documents directory and press Enter.
assert_and_click("kwrite_select_documents");
wait_still_screen(1);
send_key("ret");
# Choose the file
assert_and_click("kwrite_txt_file");
# Open it
send_key("ret");
wait_still_screen(3);
# Make the application fullscreen
assert_and_click("kde_window_maximize");
wait_still_screen(3);
# Check that the document has been opened
assert_screen("kwrite_text_file_opened");
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,35 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests that About can be displayed.
sub run {
my $self = shift;
# Open the menu.
assert_and_click("kde_mainmenu_help");
wait_still_screen(2);
# Choose the About item.
assert_and_click "kwrite_submenu_about";
wait_still_screen(2);
# Check that the About dialogue was opened.
assert_screen "kwrite_about_shown";
# Click on Credits to move to another screen.
assert_and_click "kwrite_credits";
wait_still_screen(2);
# Check that Credits were shown.
assert_screen "kwrite_credits_shown";
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,41 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests that a line of text can be deleted
# and the deletion reverted.
sub run {
my $self = shift;
# Click on a word on the line.
assert_and_click("kwrite_line_word", clicktime => 0.3);
wait_still_screen(2);
# Delete the line
send_key("home");
sleep 1;
send_key("shift-end");
sleep 1;
send_key("delete");
sleep 1;
# Move cursor out of the way.
send_key("ctrl-end");
# Check that the line was deleted.
assert_screen "kwrite_line_deleted";
# Use combo to revert the action.
send_key "ctrl-z";
sleep 1;
# Move cursor out of the way.
send_key "ctrl-end";
# Check that the line was re-added.
assert_screen "kwrite_text_added";
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,65 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests that a piece of test can be found, that highlighting can be removed again,
# that search and replace can be used, that misspelt words can be highlighted, and
# that spelling control can be used to find and replace spelling mistakes.
sub run {
my $self = shift;
# Search the text for specific string.
# At first, Wait 1 second for the test to get ready, as the control character was not properly recognized
# when the test started immediately after the rollback.
sleep 5;
# Click into the application to get focus.
assert_and_click("kwrite_line_word");
# Invoke the Find dialogue
send_key "ctrl-f";
wait_still_screen(2);
# Type string
type_very_safely "sweetest";
# Confirm
send_key "ret";
sleep 2;
send_key "esc";
# Check that correct word is highlighted.
assert_screen "kwrite_found_text";
# This tests that a highlight can be removed from a search result.
# Use combo for removing the highlighting.
send_key "ctrl-end";
# Check that the highlighting was removed.
assert_screen "kwrite_text_added";
# We will continue to search and replace a piece of text.
# Open Switch and replace
send_key "ctrl-r";
sleep 1;
# Type string.
type_very_safely "Gale";
# Press enter to find that word.
send_key("ret");
sleep(1);
send_key("tab");
# Type replacement string. We purposefully produce a typo.
type_very_safely "Wiend";
# Press enter to replace the string.
send_key("ret");
# Get rid of the screen.
send_key("esc");
# Move the cursor away
send_key("ctrl-end");
sleep 1;
# Check that the string was replaced.
assert_screen "kwrite_text_replaced";
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,27 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests that we can do line numbering,
# otherwise the rest of the Gnome things are not
# supported. However, we may add more in the future.
sub run {
my $self = shift;
# Switches off line numbering (numbered by default).
assert_and_click("kwrite_lines_numbered", button => "right");
wait_still_screen(1);
assert_and_click "kwrite_display_line_numbers";
assert_screen "kwrite_lines_numbered_off";
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,56 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests that we can create a new file that
# opens in a new panel, that we can add text, display
# text statistics and highlight code and save the file.
sub run {
my $self = shift;
# First we will use key combo to open the new document window.
sleep 5;
# Click into the text to regain focus.
assert_and_click("kwrite_line_word");
send_key("ctrl-shift-n");
assert_and_click("kwrite_button_new_file");
assert_screen "kwrite_new_document_opened";
# Now let us produce some text
type_very_safely "# My shopping list.\n\n";
type_very_safely "* **Milk**\n* *Apples*\n* `Bananas`\n* Bread\n* Butter\n* Cheese\n\n";
type_very_safely "Happy shopping.";
# Switch on Markdown Highlighting.
assert_and_click("kwrite_menu_tools");
assert_and_click("kwrite_submenu_highlight");
assert_and_click("kwrite_submenu_markup");
send_key_until_needlematch("kwrite_markdown_selected", "down", 50);
send_key("ret");
assert_screen "kwrite_code_highlighted";
# Save the newly created file.
send_key("ctrl-s");
wait_still_screen(3);
# select the entire prefilled name (including extension) to overwrite it
send_key("ctrl-a");
wait_still_screen(3);
type_very_safely "list.md";
send_key("ret");
assert_screen("kwrite_file_saved");
# Check that the file has been created
$self->root_console(tty => 3);
assert_script_run("ls /home/test/Documents/list.md");
desktop_vt();
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,37 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests that Help can be shown.
sub run {
my $self = shift;
sleep(5);
# Click into the window to get focus
assert_and_click("kwrite_line_title");
# Open Help.
send_key("f1");
assert_screen "kwrite_help_shown";
# No help today.
#
#
## Navigate through several screens
#assert_and_click "kwrite_help_files";
#assert_screen "kwrite_help_open_file";
#assert_and_click "kwrite_help_bread_main";
## Another screen
#assert_and_click "kwrite_help_search";
#assert_screen("kwrite_help_search_replace");
#assert_and_click "kwrite_help_bread_main";
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,34 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This part tests that Shortcuts can be shown.
sub run {
my $self = shift;
# wait for snapshot restore to settle
sleep 5;
# Click into the text to get focus
assert_and_click("kwrite_menu_settings");
# Open Shortcuts.
assert_and_click("kwrite_submenu_shorcuts");
# Assert the screen and move to next one
assert_screen "kwrite_shortcuts_shown";
# Find a new window shortcut
assert_and_click("kwrite_search_bar");
type_very_safely("new window");
assert_screen("kwrite_newwindow_shortcut_found");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et: