#434 Change subroutine to test Functions
Merged 3 months ago by adamwill. Opened 3 months ago by lruzicka.

file modified
+4 -2
@@ -176,9 +176,11 @@ 

                  "six","seven", "eight", "nine", "mod", "percent", "sub"):

      testtags.append(f"calc_button_{button}")

      testtags.append(f"kcalc_button_{button}")

- for function in ("sqrt", "arg", "cos"):

-     testtags.append(f"calc_function_{function}")

+ for function in ("sqrt", "median", "cos", "ones", "re", "round"):

+     testtags.append(f"calc_select_function_{function}")

      testtags.append(f"calc_result_{function}")

+ for category in ("complex", "programming", "rounding", "statistics", "trigonometry", "sundry"):

+     testtags.append(f"calc_functions_{category}")

  for result in ("BokZw", "Czo4s", "O9qsL", "WIxiR", "b5y2B", "h7MfO", "qxuBK",

                  "tWshx", "uC8Ul", "3LAG3"):

      testtags.append(f"calc_result_{result}")

needles/gnome/apps/calculator/calc_functions_complex-20250915.json needles/gnome/apps/calculator/calc_function_arg-20250718.json
file renamed
+5 -6
@@ -1,16 +1,15 @@ 

  {

    "area": [

      {

-       "xpos": 458,

-       "ypos": 398,

+       "xpos": 472,

+       "ypos": 394,

        "width": 65,

-       "height": 44,

-       "type": "match",

-       "match": 90

+       "height": 19,

+       "type": "match"

      }

    ],

    "properties": [],

    "tags": [

-     "calc_function_arg"

+     "calc_functions_complex"

    ]

  } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 470,

+       "ypos": 425,

+       "width": 98,

+       "height": 21,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_functions_programming"

+   ]

+ } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 470,

+       "ypos": 455,

+       "width": 73,

+       "height": 24,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_functions_rounding"

+   ]

+ } 

\ No newline at end of file

needles/gnome/apps/calculator/calc_functions_statistics-20250915.json needles/gnome/apps/calculator/calc_function_cos-20250718.json
file renamed
+6 -7
@@ -1,16 +1,15 @@ 

  {

    "area": [

      {

-       "xpos": 458,

-       "ypos": 498,

-       "width": 60,

-       "height": 40,

-       "type": "match",

-       "match": 90

+       "xpos": 467,

+       "ypos": 488,

+       "width": 72,

+       "height": 24,

+       "type": "match"

      }

    ],

    "properties": [],

    "tags": [

-     "calc_function_cos"

+     "calc_functions_statistics"

    ]

  } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 471,

+       "ypos": 519,

+       "width": 55,

+       "height": 23,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_functions_sundry"

+   ]

+ } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 470,

+       "ypos": 360,

+       "width": 98,

+       "height": 24,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_functions_trigonometry"

+   ]

+ } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 341,

+       "ypos": 389,

+       "width": 141,

+       "height": 23,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_result_cos"

+   ]

+ } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 339,

+       "ypos": 388,

+       "width": 19,

+       "height": 24,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_result_median"

+   ]

+ } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 343,

+       "ypos": 383,

+       "width": 198,

+       "height": 36,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_result_ones"

+   ]

+ } 

\ No newline at end of file

needles/gnome/apps/calculator/calc_result_re-20250915.json needles/gnome/apps/calculator/calc_result_arg-20250718.json
file renamed
+4 -4
@@ -1,15 +1,15 @@ 

  {

    "area": [

      {

-       "xpos": 347,

+       "xpos": 345,

        "ypos": 385,

-       "width": 10,

-       "height": 32,

+       "width": 25,

+       "height": 26,

        "type": "match"

      }

    ],

    "properties": [],

    "tags": [

-     "calc_result_arg"

+     "calc_result_re"

    ]

  } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 340,

+       "ypos": 387,

+       "width": 20,

+       "height": 28,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_result_round"

+   ]

+ } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 468,

+       "ypos": 380,

+       "width": 54,

+       "height": 22,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_select_function_cos"

+   ]

+ } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 470,

+       "ypos": 442,

+       "width": 59,

+       "height": 23,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_select_function_median"

+   ]

+ } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 469,

+       "ypos": 475,

+       "width": 61,

+       "height": 27,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_select_function_ones"

+   ]

+ } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 469,

+       "ypos": 575,

+       "width": 41,

+       "height": 23,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_select_function_re"

+   ]

+ } 

\ No newline at end of file

needles/gnome/apps/calculator/calc_select_function_round-20250915.json needles/gnome/apps/calculator/calc_function_sqrt-20250718.json
file renamed
+4 -4
@@ -1,15 +1,15 @@ 

  {

    "area": [

      {

-       "xpos": 465,

-       "ypos": 471,

-       "width": 58,

+       "xpos": 468,

+       "ypos": 476,

+       "width": 70,

        "height": 25,

        "type": "match"

      }

    ],

    "properties": [],

    "tags": [

-     "calc_function_sqrt"

+     "calc_select_function_round"

    ]

  } 

\ No newline at end of file

@@ -0,0 +1,15 @@ 

+ {

+   "area": [

+     {

+       "xpos": 469,

+       "ypos": 408,

+       "width": 54,

+       "height": 25,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "calc_select_function_sqrt"

+   ]

+ } 

\ No newline at end of file

@@ -7,24 +7,29 @@ 

  # can use pre-selected functions.

  

  sub use_function {

-     my $function = shift;

+     my ($function, $where, $expression) = @_;

      assert_and_click("calc_button_fxunified");

-     send_key_until_needlematch("calc_function_$function", "down", 50);

-     click_lastmatch();

-     assert_and_click("calc_button_five");

+     assert_and_click("calc_functions_$where");

+     assert_and_click("calc_select_function_$function");

+     type_safely($expression);

      send_key("ret");

      assert_screen("calc_result_$function");

      assert_and_click("calc_button_clear");

+     # Stop for a moment to let the Calculator clean entry field

+     sleep(1);

  }

  

  sub run {

      my $self = shift;

      # Wait until everything settles.

-     sleep 5;

- 

-     use_function("sqrt");

-     use_function("arg");

-     use_function("cos");

+     sleep(5);

+ 

+     use_function("cos", "trigonometry", "45");

+     use_function("re", "complex", "20");

+     use_function("ones", "programming", "5");

+     use_function("round", "rounding", "5.55");

+     use_function("median", "statistics", "1;2;4;5");

+     use_function("sqrt", "sundry", "5");

  }

  

  sub test_flags {

Calculator changed the way functions are organized within the
application which broke the current Calculator test.

This fixes the subroutine to test for Functions and makes the
test reliable again.

Fixes: https://pagure.io/fedora-qa/os-autoinst-distri-fedora/issue/428

rebased onto fa8e16a

3 months ago

1 new commit added

  • Comment on sleeps to make AI happy
3 months ago

Thanks. I had this deployed to lab overnight and it looks like the tests passed, so let's call it good.

Pull-Request has been merged by adamwill

3 months ago
Metadata
Changes Summary 40
+4 -2
file changed
check-needles.py
-0
file removed
needles/gnome/apps/calculator/calc_function_arg-20250718.png
-0
file removed
needles/gnome/apps/calculator/calc_function_cos-20250718.png
-0
file removed
needles/gnome/apps/calculator/calc_function_sqrt-20250718.png
+5 -6
file renamed
needles/gnome/apps/calculator/calc_function_arg-20250718.json
needles/gnome/apps/calculator/calc_functions_complex-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_functions_complex-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_functions_programming-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_functions_programming-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_functions_rounding-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_functions_rounding-20250915.png
+6 -7
file renamed
needles/gnome/apps/calculator/calc_function_cos-20250718.json
needles/gnome/apps/calculator/calc_functions_statistics-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_functions_statistics-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_functions_sundry-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_functions_sundry-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_functions_trigonometry-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_functions_trigonometry-20250915.png
-0
file removed
needles/gnome/apps/calculator/calc_result_arg-20250718.png
+15
file added
needles/gnome/apps/calculator/calc_result_cos-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_result_cos-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_result_median-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_result_median-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_result_ones-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_result_ones-20250915.png
+4 -4
file renamed
needles/gnome/apps/calculator/calc_result_arg-20250718.json
needles/gnome/apps/calculator/calc_result_re-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_result_re-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_result_round-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_result_round-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_select_function_cos-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_select_function_cos-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_select_function_median-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_select_function_median-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_select_function_ones-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_select_function_ones-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_select_function_re-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_select_function_re-20250915.png
+4 -4
file renamed
needles/gnome/apps/calculator/calc_function_sqrt-20250718.json
needles/gnome/apps/calculator/calc_select_function_round-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_select_function_round-20250915.png
+15
file added
needles/gnome/apps/calculator/calc_select_function_sqrt-20250915.json
+0
file added
needles/gnome/apps/calculator/calc_select_function_sqrt-20250915.png
+14 -9
file changed
tests/applications/calculator/functions.pm