1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-21 21:43:08 +00:00

Add a new test for Calculator.

This commit is contained in:
Lukáš Růžička 2022-07-13 13:11:18 +02:00 committed by Adam Williamson
parent fcbcaaf59a
commit c40a35ea62
88 changed files with 837 additions and 0 deletions

View File

@ -105,6 +105,14 @@ for section in ("desktop", "networking", "sound", "files", "user", "hardware",
"accessibility", "tipstricks", "morehelp"): "accessibility", "tipstricks", "morehelp"):
testliterals.append(f"help_section_{section}") testliterals.append(f"help_section_{section}")
testliterals.append(f"help_section_content_{section}") testliterals.append(f"help_section_content_{section}")
# Needles for Calculator
for button in ("div", "divider", "zero", "one", "two", "three", "four", "five",
"six","seven", "eight", "nine", "mod", "percent", "pi", "root",
"square", "sub"):
testliterals.append(f"calc_button_{button}")
for result in ("BokZw", "Czo4s", "O9qsL", "WIxiR", "b5y2B", "h7MfO", "qxuBK",
"tWshx", "uC8Ul", "3LAG3"):
testliterals.append(f"calc_result_{result}")
# variable-y in custom_change_device but we only have one value # variable-y in custom_change_device but we only have one value
testliterals.append("anaconda_part_device_sda") testliterals.append("anaconda_part_device_sda")
# for Anaconda help related needles. # for Anaconda help related needles.

View File

@ -0,0 +1,15 @@
{
"area": [
{
"height": 102,
"type": "match",
"width": 101,
"xpos": 280,
"ypos": 292
}
],
"properties": [],
"tags": [
"calc_about_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 383,
"ypos": 567,
"width": 31,
"height": 25,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_add"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 313,
"ypos": 371,
"width": 32,
"height": 31,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_bclose"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 385,
"ypos": 422,
"width": 28,
"height": 23,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_div"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 248,
"ypos": 566,
"width": 29,
"height": 25,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_divider"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 451,
"ypos": 539,
"width": 30,
"height": 33,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_equals"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 250,
"ypos": 467,
"width": 28,
"height": 28,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_five"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 182,
"ypos": 470,
"width": 30,
"height": 22,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_four"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 382,
"ypos": 378,
"width": 37,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_mod"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 387,
"ypos": 470,
"width": 26,
"height": 23,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_multi"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 317,
"ypos": 421,
"width": 27,
"height": 24,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_nine"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 178,
"ypos": 515,
"width": 31,
"height": 28,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_one"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 317,
"ypos": 564,
"width": 27,
"height": 27,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_percent"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 452,
"ypos": 373,
"width": 32,
"height": 29,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_pi"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 453,
"ypos": 418,
"width": 31,
"height": 31,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_root"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 182,
"ypos": 421,
"width": 28,
"height": 25,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_seven"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 318,
"ypos": 471,
"width": 28,
"height": 22,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_six"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 454,
"ypos": 470,
"width": 28,
"height": 26,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_square"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 383,
"ypos": 515,
"width": 34,
"height": 26,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_sub"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 251,
"ypos": 518,
"width": 23,
"height": 26,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_two"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 181,
"ypos": 566,
"width": 28,
"height": 24,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_button_zero"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 255,
"ypos": 409,
"width": 147,
"height": 35,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_credits_shown"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 5,
"ypos": 121,
"width": 168,
"height": 44,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_help_factorial"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 7,
"ypos": 125,
"width": 317,
"height": 41,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_help_keyboard"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 9,
"ypos": 86,
"width": 106,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_help_main_view"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 6,
"ypos": 527,
"width": 92,
"height": 25,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_help_using_factorial"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 2,
"ypos": 276,
"width": 173,
"height": 29,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_help_using_keyboard"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 363,
"ypos": 487,
"width": 121,
"height": 23,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_menu_about"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 161,
"ypos": 292,
"width": 33,
"height": 30,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_result_3LAG3"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 159,
"ypos": 291,
"width": 52,
"height": 36,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_result_BokZw"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 159,
"ypos": 293,
"width": 40,
"height": 30,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_result_Czo4s"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 156,
"ypos": 292,
"width": 147,
"height": 34,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_result_O9qsL"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 158,
"ypos": 291,
"width": 40,
"height": 34,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_result_WIxiR"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 161,
"ypos": 291,
"width": 52,
"height": 33,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_result_b5y2B"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 158,
"ypos": 291,
"width": 43,
"height": 37,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_result_h7MfO"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 156,
"ypos": 293,
"width": 39,
"height": 31,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_result_qxuBK"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 159,
"ypos": 292,
"width": 35,
"height": 31,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_result_tWshx"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 159,
"ypos": 292,
"width": 43,
"height": 36,
"type": "match"
}
],
"properties": [],
"tags": [
"calc_result_uC8Ul"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 KiB

View File

@ -1052,6 +1052,23 @@
"START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%" "START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%"
} }
}, },
"calculator": {
"profiles": {
"fedora-Silverblue-dvd_ostree-iso-ppc64le-*-ppc64le": 50,
"fedora-Silverblue-dvd_ostree-iso-x86_64-*-64bit": 50,
"fedora-Workstation-live-iso-ppc64le-*-ppc64le": 20,
"fedora-Workstation-live-iso-x86_64-*-64bit": 20,
"fedora-Workstation-upgrade-x86_64-*-64bit": 40,
"fedora-Workstation-upgrade-aarch64-*-aarch64": 40,
"fedora-Workstation-raw_xz-raw.xz-aarch64-*-aarch64": 22
},
"settings": {
"BOOTFROM": "c",
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
"POSTINSTALL_PATH": "tests/applications/calculator",
"START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%"
}
},
"clocks": { "clocks": {
"profiles": { "profiles": {
"fedora-Silverblue-dvd_ostree-iso-ppc64le-*-ppc64le": 50, "fedora-Silverblue-dvd_ostree-iso-ppc64le-*-ppc64le": 50,

View File

@ -0,0 +1,25 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script starts the Calculator and stores an image.
sub run {
my $self = shift;
# Run the application
menu_launch_type("Calculator");
assert_screen("apps_run_calculator");
# Make sure that the application will be in the
# basic mode.
send_key("ctrl-alt-b");
}
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("gnome_burger_menu");
wait_still_screen(2);
assert_and_click("calc_menu_about");
# Check that it is shown.
assert_screen("calc_about_shown");
# Click on the Credits button and check that it shows.
assert_and_click("gnome_button_credits");
assert_screen("calc_credits_shown");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,108 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script checks that Gnome Calculator 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',
"p" => 'pi',
"r" => 'root',
"s" => 'square'
);
my $rewritten = $numbers{$number};
return $rewritten;
}
# This subroutine performs the clicking of simple operations
# in the Calculator.
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("calc_button_$word");
}
# Click the operation button.
assert_and_click("calc_button_$operation");
# For each digit of the second number, click on
# the corresponding button.
foreach (@second) {
my $word = rewrite($_);
assert_and_click("calc_button_$word");
}
# Click on the Equals button
assert_and_click("calc_button_equals");
# Assert the result has appeared on the screen.
my $identifier = hashed_string("$a-$operation-$b");
assert_screen("calc_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 two numbers can be divided using modulo.
calculate("28", "5", "mod");
# Check that you can count with Pi
calculate("p", "10", "multi");
# Check that you can use a root
calculate("r144", "10", "add");
# Check that you can use square
calculate("12s", "44", "sub");
# Check that you can use percents
calculate("33%", "90", "multi");
# Check that you can use brackets
assert_and_click("calc_button_three");
assert_and_click("calc_button_multi");
assert_and_click("calc_button_bopen");
assert_and_click("calc_button_two");
assert_and_click("calc_button_add");
assert_and_click("calc_button_three");
assert_and_click("calc_button_bclose");
assert_and_click("calc_button_equals");
my $identifier = hashed_string("3*(3+2)");
assert_screen("calc_result_$identifier");
send_key("esc");
}
sub test_flags {
return {fatal => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,33 @@
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);
# Browse through a couple of links and
# check they are not empty.
assert_and_click("calc_help_using_keyboard");
assert_screen("calc_help_keyboard");
assert_and_click("calc_help_main_view");
assert_and_click("calc_help_using_factorial");
assert_screen("calc_help_factorial");
assert_and_click("calc_help_main_view");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et: