1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-05 23:44:25 +00:00

Create a test suite for KCalc

This commit is contained in:
Lukas Ruzicka 2024-03-21 18:57:14 +01:00 committed by Lukáš Růžička
parent c097516599
commit abe551596d
67 changed files with 667 additions and 1 deletions

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 352,
"ypos": 225,
"width": 103,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_about_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 538,
"ypos": 280,
"width": 54,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_authors"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 KiB

View File

@ -0,0 +1,22 @@
{
"area": [
{
"xpos": 400,
"ypos": 349,
"width": 92,
"height": 18,
"type": "match"
},
{
"xpos": 467,
"ypos": 417,
"width": 63,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_authors_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 712,
"ypos": 491,
"width": 18,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_bclose"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 710,
"ypos": 430,
"width": 20,
"height": 25,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_bopen"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 344,
"ypos": 319,
"width": 18,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_div"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 448,
"ypos": 551,
"width": 16,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_divider"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 345,
"ypos": 378,
"width": 17,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_eight"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 551,
"ypos": 517,
"width": 19,
"height": 23,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_equals"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 343,
"ypos": 434,
"width": 21,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_five"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 240,
"ypos": 435,
"width": 22,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_four"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 447,
"ypos": 320,
"width": 18,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_multi"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 446,
"ypos": 372,
"width": 22,
"height": 24,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_nine"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 237,
"ypos": 318,
"width": 24,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_percent"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 238,
"ypos": 375,
"width": 22,
"height": 22,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_seven"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 446,
"ypos": 434,
"width": 20,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_six"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 553,
"ypos": 321,
"width": 16,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_sub"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 443,
"ypos": 487,
"width": 26,
"height": 24,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_three"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 342,
"ypos": 490,
"width": 23,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_two"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 290,
"ypos": 547,
"width": 21,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_button_zero"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 419,
"ypos": 169,
"width": 125,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_help_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 791,
"ypos": 196,
"width": 39,
"height": 32,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_result_3LAG3"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 792,
"ypos": 193,
"width": 37,
"height": 38,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_result_Czo4s"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 768,
"ypos": 197,
"width": 60,
"height": 31,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_result_b5y2B"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 781,
"ypos": 198,
"width": 46,
"height": 28,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_result_uC8Ul"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 379,
"ypos": 326,
"width": 79,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"kcalc_submenu_about"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 KiB

View File

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

View File

@ -0,0 +1,26 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script starts the KCalc application
# and saves the milestone for the consequtive
# tests.
sub run {
my $self = shift;
# Run the application
menu_launch_type("kcalc");
assert_screen("kcalc_runs");
# wait for system to settle before snapshotting
sleep 10;
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,31 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script checks that Gnome Calculator shows About.
sub run {
my $self = shift;
# Let's wait until everything settles down properly
# before we start testing.
sleep 5;
# Open the menu and click on the About item.
assert_and_click("kcalc_mainmenu_help");
wait_still_screen(2);
assert_and_click("kcalc_submenu_about");
# Check that it is shown.
assert_screen("kcalc_about_shown");
# Click on the Credits button and check that it shows.
assert_and_click("kcalc_authors");
assert_screen("kcalc_authors_shown");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,30 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script checks that Gnome Calculator shows help.
sub run {
my $self = shift;
# Wait until everything settles.
sleep 5;
# Open Help
send_key("f1");
wait_still_screen(2);
# Check that Help opens.
assert_screen("kcalc_help_shown");
# Rest of the documentation is currently
# unavailable.
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,97 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script checks that KCalc works in Basic mode.
# This subroutine rewrites the number into a word.
sub rewrite {
my $number = shift;
my %numbers = (
0 => 'zero',
1 => 'one',
2 => 'two',
3 => 'three',
4 => 'four',
5 => 'five',
6 => 'six',
7 => 'seven',
8 => 'eight',
9 => 'nine',
"." => 'divider',
"%" => 'percent',
);
my $rewritten = $numbers{$number};
return $rewritten;
}
# This subroutine performs the clicking of simple operations
# in the KCalc.
sub calculate {
my ($a, $b, $operation) = @_;
# Create lists of the numbers.
my @first = split('', $a);
my @second = split('', $b);
# For each digit of the first number, click on
# the corresponding button.
foreach (@first) {
my $word = rewrite($_);
assert_and_click("kcalc_button_$word");
}
# Click the operation button.
assert_and_click("kcalc_button_$operation");
# For each digit of the second number, click on
# the corresponding button.
foreach (@second) {
my $word = rewrite($_);
assert_and_click("kcalc_button_$word");
}
# Click on the Equals button
assert_and_click("kcalc_button_equals");
# Assert the result has appeared on the screen.
my $identifier = hashed_string("$a-$operation-$b");
assert_screen("kcalc_result_$identifier");
# Clear the display.
send_key("esc");
}
sub run {
my $self = shift;
# Wait until everything settles.
sleep 5;
# Check that two numbers can be added.
calculate("10", "23", "add");
# Check that two numbers can be subtracted.
calculate("67", "45", "sub");
# Check that two numbers can be multiplied.
calculate("9", "0.8", "multi");
# Check that two numbers can be divided.
calculate("77", "7", "div");
# Check that you can use percents
calculate("33%", "90", "multi");
# Check that you can use brackets
assert_and_click("kcalc_button_three");
assert_and_click("kcalc_button_multi");
assert_and_click("kcalc_button_bopen");
assert_and_click("kcalc_button_two");
assert_and_click("kcalc_button_add");
assert_and_click("kcalc_button_three");
assert_and_click("kcalc_button_bclose");
assert_and_click("kcalc_button_equals");
my $identifier = hashed_string("3*(3+2)");
assert_screen("kcalc_result_$identifier");
send_key("esc");
}
sub test_flags {
return {fatal => 1};
}
1;
# vim: set sw=4 et: