#304 Add a 'navigation' test for GNOME.
Opened 5 months ago by lruzicka. Modified a month ago

file modified
+4 -1
@@ -218,7 +218,10 @@ 

  'installation_progress', 'keyboard_layout', 'language_support', 'network_host_name',

  'root_password', 'select_packages', 'installation_source', 'time_date', 'user_creation',

  'language_selection', 'language', 'summary_link'))

- 

+ # for Gnome navigation test

+ for app in ("clocks", "firefox", "fonts", "terminal", "editor"):

+     testtags.append(f"navigation_navibar_{app}")

+ testtags.append("navigation_terminal_fullscreen")

  testtags.extend(f"anaconda_main_hub_{fsys}" for fsys in ('language_support', 'selec_packages',

  'time_date', 'create_user','keyboard_layout'))

  

file modified
+19
@@ -1692,4 +1692,23 @@ 

      type_very_safely("gsettings set org.gnome.software update-notification-timestamp $ep_time\n");

  }

  

+ # This routine takes a list of applications. It will then use the terminal

+ # to start all these applications in the background and then it will exit the

+ # terminal. This is useful when we want to start multiple applications quickly.

+ sub start_applications {

+     my @applications = @_;

+     # Open the terminal

+     menu_launch_type("terminal");

+     wait_still_screen(2);

+     # Iterate over the application list

+     # and start each application from it.

+     foreach (@applications) {

+         assert_script_run("$_ &");

+         # Take some time for things to settle.

+         wait_still_screen(1);

+     }

+     # Exit the terminal.

+     enter_cmd("exit");

+ }

+ 

  1;

@@ -25,6 +25,7 @@ 

    "properties": [],

    "tags": [

      "firefox",

-     "browser"

+     "browser",

+     "apps_run_firefox"

    ]

- } 

\ No newline at end of file

+ }

@@ -12,4 +12,4 @@ 

    "tags": [

      "apps_run_clocks"

    ]

- } 

\ No newline at end of file

+ }

@@ -10,6 +10,7 @@ 

    ],

    "properties": [],

    "tags": [

-     "apps_run_texteditor"

+     "apps_run_texteditor",

+     "apps_run_editor"

    ]

- } 

\ No newline at end of file

+ }

@@ -10,6 +10,7 @@ 

    ],

    "properties": [],

    "tags": [

-     "apps_run_texteditor"

+     "apps_run_texteditor",

+     "apps_run_editor"

    ]

- } 

\ No newline at end of file

+ }

@@ -12,4 +12,4 @@ 

    "tags": [

      "panel_ctrl_networks"

    ]

- } 

\ No newline at end of file

+ }

@@ -0,0 +1,22 @@ 

+ {

+   "area": [

+     {

+       "xpos": 480,

+       "ypos": 561,

+       "width": 103,

+       "height": 138,

+       "type": "match"

+     },

+     {

+       "xpos": 557,

+       "ypos": 424,

+       "width": 51,

+       "height": 34,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "navigation_details_shown"

+   ]

+ } 

\ No newline at end of file

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

+ {

+   "area": [

+     {

+       "ypos": 1,

+       "type": "match",

+       "xpos": 6,

+       "height": 67,

+       "width": 82

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "navigation_editor_fullscreen"

+   ]

+ } 

\ No newline at end of file

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

+ {

+   "area": [

+     {

+       "xpos": 6,

+       "height": 67,

+       "width": 82,

+       "type": "match",

+       "ypos": 1

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "navigation_editor_fullscreen"

+   ]

+ } 

\ No newline at end of file

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

+ {

+   "properties": [],

+   "tags": [

+     "navigation_editor_fullscreen"

+   ],

+   "area": [

+     {

+       "xpos": 6,

+       "ypos": 1,

+       "width": 82,

+       "height": 67,

+       "type": "match"

+     }

+   ]

+ } 

\ No newline at end of file

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

+ {

+   "properties": [],

+   "tags": [

+     "navigation_firefox_fullscreen"

+   ],

+   "area": [

+     {

+       "xpos": 101,

+       "ypos": 11,

+       "width": 108,

+       "height": 56,

+       "type": "match"

+     }

+   ]

+ } 

\ No newline at end of file

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

+ {

+   "area": [

+     {

+       "xpos": 449,

+       "ypos": 352,

+       "width": 125,

+       "height": 32,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "navigation_navibar_clocks"

+   ]

+ } 

\ No newline at end of file

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

+ {

+   "area": [

+     {

+       "xpos": 736,

+       "ypos": 353,

+       "width": 121,

+       "height": 50,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "navigation_navibar_editor"

+   ]

+ } 

\ No newline at end of file

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

+ {

+   "area": [

+     {

+       "xpos": 737,

+       "ypos": 341,

+       "width": 121,

+       "height": 34,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "navigation_navibar_firefox"

+   ]

+ } 

\ No newline at end of file

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

+ {

+   "area": [

+     {

+       "xpos": 594,

+       "ypos": 341,

+       "width": 122,

+       "height": 34,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "navigation_navibar_terminal"

+   ]

+ } 

\ No newline at end of file

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

+ {

+   "area": [

+     {

+       "width": 77,

+       "ypos": 0,

+       "height": 22,

+       "xpos": 36,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "navigation_terminal_fullscreen"

+   ]

+ }

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

+ {

+   "area": [

+     {

+       "xpos": 448,

+       "ypos": 99,

+       "width": 127,

+       "height": 38,

+       "type": "match"

+     }

+   ],

+   "properties": [],

+   "tags": [

+     "navigation_three_workspaces"

+   ]

+ } 

\ No newline at end of file

file modified
+17
@@ -1218,6 +1218,23 @@ 

                  "START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%"

              }

          },

+         "navigation": {

+             "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/navigation",

+                 "START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%"

+             }

+         },

          "gnome_text_editor": {

              "profiles": {

                  "fedora-Silverblue-dvd_ostree-iso-ppc64le-*-ppc64le": 50,

@@ -0,0 +1,38 @@ 

+ use base "installedtest";

+ use strict;

+ use testapi;

+ use utils;

+ 

+ # We will start two applications and save the progress.

+ 

+ sub run {

+     my $self = shift;

+     # Let us wait here for a couple of seconds to give the VM time to settle.

+     # Starting right over might result in erroneous behavior.

+     sleep(5);

+     # Start Firefox

+     menu_launch_type("firefox");

+     assert_screen "apps_run_firefox", 45;

+     # firefox is quite grindy on startup, let it settle

+     wait_still_screen(stilltime => 5, similarity_level => 45);

+     send_key("super-up");

+     assert_screen("navigation_firefox_fullscreen");

+ 

+     # Start Gnome Text Editor

+     menu_launch_type("text-editor");

+     assert_screen("apps_run_editor");

+     wait_still_screen(2);

+     send_key("super-up");

+     assert_screen("navigation_editor_fullscreen");

+ }

+ 

+ sub test_flags {

+     return {fatal => 1, milestone => 1};

+ }

+ 

+ 1;

+ 

+ # vim: set sw=4 et:

+ 

+ 

+ 

@@ -0,0 +1,40 @@ 

+ use base "installedtest";

+ use strict;

+ use testapi;

+ use utils;

+ 

+ # This will test that user can trigger a detailed view of the

+ # navigation icons using the ~ key.

+ 

+ sub run {

+     my $self = shift;

+     # Let us wait here for a couple of seconds to give the VM time to settle.

+     # Starting right over might result in erroneous behavior.

+     sleep(5);

+ 

+     # If we are at Firefox switch to editor

+     if (check_screen("apps_run_firefox")) {

+         send_key("alt-tab");

+         assert_screen "apps_run_editor";

+     }

+ 

+     # Use alt-tab to navigate to the other

+     # application, but trigger the overview

+     # page as well and make sure it is shown.

+     hold_key("alt");

+     send_key("tab");

+     send_key("~");

+     assert_screen("navigation_details_shown");

+     release_key("alt");

+ }

+ 

+ sub test_flags {

+     return {always_rollback => 1};

+ }

+ 

+ 1;

+ 

+ # vim: set sw=4 et:

+ 

+ 

+ 

@@ -0,0 +1,136 @@ 

+ use base "installedtest";

+ use strict;

+ use testapi;

+ use utils;

+ 

+ # This will test that user can switch between two applications

+ # using the navigation combo Alt-tab.

+ 

+ sub start_maxed {

+     my $app = shift;

+     menu_launch_type($app);

+     assert_screen ["apps_run_$app", "grant_access"];

+     # give access rights if asked

+     if (match_has_tag "grant_access") {

+         click_lastmatch;

+         assert_screen "apps_run_$app";

+     }

+     wait_still_screen(3);

+     wait_screen_change { send_key("super-up"); };

+     wait_still_screen(2);

+ }

+ 

+ sub switch_to_app {

+     # This will use Alt-tab to switch to the desired application.

+     # Use the name of the application and the direction in which

+     # the search should be performed, either forward or backward.

+     my ($application, $dir, $fullscreen) = @_;

+     # If we want to search backwards, we will hold the shift key.

+     if ($dir eq "backward") {

+         hold_key("shift");

+     }

+     # Then we hold the alt key to either form shift-alt or just alt

+     # key combo.

+     hold_key("alt");

+     # We will send tab, until we have arrived at the correct icon

+     send_key_until_needlematch("navigation_navibar_$application", "tab", 10);

+     # We will release the alt key.

+     release_key("alt");

+     #

+     if ($dir eq "backward") {

+         release_key("shift");

+     }

+     my $needle = $fullscreen ? "navigation_${application}_fullscreen" : "apps_run_${application}";

+     assert_screen($needle);

+     if ($fullscreen) {

+         die "Not fullscreen!" if (check_screen("apps_menu_button"));

+     }

+ }

+ 

+ sub check_hidden {

+     # This function checks that the application

+     # is no longer fully displayed on the screen,

+     # because it has been hidden (minimized).

+     my $app = shift;

+     # First, let us wait until the screen settles.

+     wait_still_screen(3);

+     # If the application is still shown, let's die.

+     die("The application seems not to have been minimized.") if (check_screen("apps_run_$app"));

+ }

+ 

+ sub run {

+     my $self = shift;

+ 

+     ### Switch between two applications

+     # From the setup script, we should be seeing the editor

+     # window.

+     # Switch to the other application.

+     send_key("alt-tab");

+     assert_screen("apps_run_firefox");

+ 

+     # Switch back

+     send_key("alt-tab");

+     assert_screen("apps_run_editor");

+ 

+     ### Switch between more applications

+ 

+     # Start more applications.

+     start_maxed("clocks");

+     start_maxed("calculator");

+     start_maxed("terminal");

+ 

+     ## Going forwards

+     # Switch to Calculator using alt-tab

+     switch_to_app("calculator", "forward");

+     # Switch to Clocks using alt-tab

+     switch_to_app("clocks", "forward");

+ 

+     ## Going backwards

+     # Switch to Firefox using shift-alt-tab

+     switch_to_app("firefox", "backward");

+     # Switch to Terminal using shift-alt-tab

+     switch_to_app("terminal", "backward");

+ 

+     ### Switch to and from a full screen application

+     # We will make Terminal to full screen

+     send_key("f11");

+ 

+     # Switch to Editor

+     switch_to_app("editor", "forward");

+ 

+     # Switch to Terminal (fullscreen)

+     switch_to_app("terminal", "backward", 1);

+ 

+     # Switch to Editor

+     switch_to_app("editor", "forward");

+ 

+     ### Switch between minimised apps.

+     # Minimise Editor

+     send_key("super-h");

+     # Check that the application has minimised.

+     check_hidden("editor");

+ 

+     # Switch to Clocks

+     switch_to_app("clocks", "forward");

+     # Minimise Clocks

+     send_key("super-h");

+     # Check that the application has minimised.

+     check_hidden("clocks");

+ 

+     # Switch to Editor

+     switch_to_app("editor", "forward");

+ 

+     # Switch to Clocks

+     switch_to_app("clocks", "forward");

+ }

+ 

+ sub test_flags {

+     return {always_rollback => 1};

+ }

+ 

+ 1;

+ 

+ # vim: set sw=4 et:

+ 

+ 

+ 

@@ -0,0 +1,65 @@ 

+ use base "installedtest";

+ use strict;

+ use testapi;

+ use utils;

+ 

+ # This will test that user can switch between two workspaces,

+ # that we can move an application to another workspace.

+ 

+ sub move_to_workspace {

+     # This will use Shift-Ctrl-Alt to move the focused app to

+     # the $direction (left or right).

+     my $direction = shift;

+     wait_screen_change { send_key("shift-ctrl-alt-$direction"); };

+     wait_still_screen 5;

+ }

+ 

+ sub switch_to_workspace {

+     # This will use Ctrl-Alt to switch to another workspace

+     # using the $direction (left, right)

+     my $direction = shift;

+     wait_screen_change { send_key("ctrl-alt-$direction"); };

+     wait_still_screen 5;

+ }

+ 

+ sub run {

+     my $self = shift;

+     # Let us wait here for a couple of seconds to give the VM time to settle.

+     # Starting right over might result in erroneous behavior.

+     sleep(5);

+ 

+     # The focused application should be the Editor, so let's check it is

+     # visible on the beginning screen. Then switch to another workplace.

+     # This one should be empty, therefore checking for the Editor should fail.

+     # The opposite will be true, when we switch back

+     assert_screen("apps_run_editor");

+     switch_to_workspace("right");

+     die("The workspaces were not switched!") if (check_screen("apps_run_editor"));

+ 

+     switch_to_workspace("left");

+     die("The workspaces were not switched") unless (check_screen("apps_run_editor"));

+ 

+     # Now, we will move the focused application (Editor) to the second workspace.

+     # The application will be still visible there. When we switch back, the application

+     # will no longer be visible on the first workspace and will uncover Firefox and

+     # we check that it is there. We will also enter the Activitities mode and will check

+     # that currently three workspaces can be used (top bar of the screen).

+     move_to_workspace("right");

+     die("The application was not moved!") unless (check_screen("apps_run_editor"));

+     switch_to_workspace("left");

+     die("The workspaces were not switched") unless (check_screen("apps_run_firefox"));

+     send_key("super");

+     wait_still_screen(2);

+     assert_screen("navigation_three_workspaces");

+ }

+ 

+ sub test_flags {

+     return {always_rollback => 1};

+ }

+ 

+ 1;

+ 

+ # vim: set sw=4 et:

+ 

+ 

+ 

This PR partly solves the issue #301 when it adds the navigation
testing for Gnome. It uses the keyboard combinations to cycle through
running applications and checks that applications could be switched
accordingly. It also tests that you can switch between workspaces
and that you can move an applications to another workspace.

rebased onto 36bac07

5 months ago

rebased onto 39e46c5

5 months ago

rebased onto 0190fe6

5 months ago

rebased onto 9d45125

5 months ago

rebased onto db2787d

5 months ago

maybe use send_key_until_needlematch here? seems safer and simpler.

I feel like it might be better to use send_key_until_needlematch in aaa_setup, as I suggested above, with conservative settings, then if you want do a sleep after that and assert that we're still on the right screen, instead of having every test module start with a sleep(5) and maybe an attempt to make sure we're at the editor...

this and all the other comments etc. say "alt tab", but the function actually uses alt-shift-tab (which goes backwards). I guess it's good to test that too, but it should be consistent. Maybe this sub should take an argument for whether to use shift or not, and half the calls to it could use shift and half could not use shift, so we test both ways?

Switching from reading inline - as I read through, I feel like maybe all the switcher tests could be combined into one. That would avoid duplication of the switch_to_app sub and some of the app launch setup steps. The test could be kinda progressive: first just switch between the two initially launched apps, then launch some more apps and do the other tests - testing the navibar, forwards and backwards, minimizing and maximizing. It just feels like it could all be done more efficiently within a single test rather than split up.

I think this needs a bit more safety to avoid failures if the switch happens to take a second or two. Maybe wrap the switch_to_workspace call in wait_screen_change, and maybe a short wait_still_screen after? ditto the similar calls below, of course.

1 new commit added

  • Put everything into one single script.
5 months ago

yeah, I feel like this flows nicer now. It looks like you need to run tidy, though :)

yeah, I feel like this flows nicer now. It looks like you need to run tidy, though :)

Yeah, and I still want to test this. I haven't run after I finished it on Friday.

2 new commits added

  • Tidy the new file.
  • Add needles to support new version.
5 months ago

rebased onto f69c174

5 months ago

rebased onto b4074d4

5 months ago

rebased onto a23bcec

5 months ago

rebased onto 5340fbe

5 months ago

rebased onto cbb5db7

5 months ago

rebased onto 23960a1

5 months ago

So, looking at staging...this run failed because maximizing text editor failed in aaa_setup. I guess we need to be more paranoid there. Maybe after launching it, assert the navigation_editor needle to ensure it's launched, wait_still_screen a couple of seconds, then do super-up, then maybe assert on top-left corner of the screen to be sure it's maximized? it's a drag but might be necessary.

the test also seems to completely fail on silverblue because running "gnome-text-editor" doesn't work there. In the gnome-text-editor test, we just type "text-editor", not "gnome-text-editor" - I guess we should do the same here.

rebased onto 78ee88a

5 months ago

okay, I'm about to fiddle with this a lot, so for reference, lruzicka's last version was commit 78ee88a .

rebased onto d152170

5 months ago

rebased onto 6c4d906

5 months ago

rebased onto 4a1db10

5 months ago

rebased onto 4bc1fe5

5 months ago

rebased onto 82dcfd1

5 months ago

rebased onto 9b3a0a7

5 months ago

rebased onto 4923b86

5 months ago

rebased onto 22456eb

5 months ago

rebased onto 82303ea

5 months ago

rebased onto 96d7df4

5 months ago

OK, I fiddled with this quite a bit so it passes on Silverblue now. I swapped out Fonts for Calculator because Fonts commonly crashes on Silverblue. I rejigged things so we use the existing apps_run_* needles instead of creating new needles with the same purpose. And I added various safety valves and checks and stuff.

It's still not entirely done - I added a couple of FIXMEs.

rebased onto cd22ee1

4 months ago

rebased onto cf0a639

3 months ago

@lruzicka rebased. so do you want to pick this up and work on the FIXMEs or should I?

@lruzicka rebased. so do you want to pick this up and work on the FIXMEs or should I?

Yeah, I will work on the FIXMEs.

1 new commit added

  • Deal with the FIXMEs.
a month ago

This (and the one later on) are the only FIXMEs in the code. Is it correct?

rebased onto f695a72

a month ago
Metadata
Changes Summary 34
+4 -1
file changed
check-needles.py
+19 -0
file changed
lib/utils.pm
+3 -2
file changed
needles/firefox/firefox-20210607.json
+1 -1
file changed
needles/gnome/apps/apps_run_clocks-20220818.json
+3 -2
file changed
needles/gnome/apps/apps_run_texteditor-20220818.json
+3 -2
file changed
needles/gnome/apps/apps_run_texteditor-20230703.json
+1 -1
file changed
needles/gnome/apps/gnome-panel/panel_ctrl_networks_inactive-20240110.json
+22
file added
needles/gnome/apps/navigation/navigation_details_shown.json
+0
file added
needles/gnome/apps/navigation/navigation_details_shown.png
+15
file added
needles/gnome/apps/navigation/navigation_editor_fullscreen-20230929.json
+0
file added
needles/gnome/apps/navigation/navigation_editor_fullscreen-20230929.png
+15
file added
needles/gnome/apps/navigation/navigation_editor_fullscreen-silverblue-20230929.json
+0
file added
needles/gnome/apps/navigation/navigation_editor_fullscreen-silverblue-20230929.png
+15
file added
needles/gnome/apps/navigation/navigation_editor_fullscreen.json
+0
file added
needles/gnome/apps/navigation/navigation_editor_fullscreen.png
+15
file added
needles/gnome/apps/navigation/navigation_firefox_fullscreen.json
+0
file added
needles/gnome/apps/navigation/navigation_firefox_fullscreen.png
+15
file added
needles/gnome/apps/navigation/navigation_navibar_clocks.json
+0
file added
needles/gnome/apps/navigation/navigation_navibar_clocks.png
+15
file added
needles/gnome/apps/navigation/navigation_navibar_editor.json
+0
file added
needles/gnome/apps/navigation/navigation_navibar_editor.png
+15
file added
needles/gnome/apps/navigation/navigation_navibar_firefox.json
+0
file added
needles/gnome/apps/navigation/navigation_navibar_firefox.png
+15
file added
needles/gnome/apps/navigation/navigation_navibar_terminal.json
+0
file added
needles/gnome/apps/navigation/navigation_navibar_terminal.png
+15
file added
needles/gnome/apps/navigation/navigation_terminal_fullscreen-20230929.json
+0
file added
needles/gnome/apps/navigation/navigation_terminal_fullscreen-20230929.png
+15
file added
needles/gnome/apps/navigation/navigation_three_workspaces.json
+0
file added
needles/gnome/apps/navigation/navigation_three_workspaces.png
+17 -0
file changed
templates.fif.json
+38
file added
tests/applications/navigation/aaa_setup.pm
+40
file added
tests/applications/navigation/navigation_details.pm
+136
file added
tests/applications/navigation/switch_application.pm
+65
file added
tests/applications/navigation/switch_workplaces.pm