diff --git a/neon/main.pm b/neon/main.pm index 9049689..27b7605 100644 --- a/neon/main.pm +++ b/neon/main.pm @@ -1,157 +1,158 @@ # Copyright (C) 2016-2018 Harald Sitter # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . use warnings; use testapi; use autotest; use File::Basename; use List::Util qw[min]; BEGIN { unshift @INC, dirname(__FILE__) . '/../../lib'; } $testapi::username = 'user'; $testapi::password = 'password'; testapi::set_var('OEM_USERNAME', 'oem'); testapi::set_var('OEM_PASSWORD', 'oem'); # Special var to check if run in the cloud. This enables tests to only run # certain set up bits when run in the cloud rather than a local docker # container. testapi::set_var('OPENQA_IN_CLOUD', defined $ENV{'NODE_NAME'}); my $dist = testapi::get_var("CASEDIR") . '/lib/distribution_neon.pm'; require $dist; testapi::set_distribution(distribution_neon->new()); sub unregister_needle_tags { my ($tag) = @_; my @a = @{needle::tags($tag)}; for my $n (@a) { $n->unregister($tag); } } sub cleanup_needles { if (!testapi::get_var('SECUREBOOT')) { unregister_needle_tags('ENV-SECUREBOOT'); } else { unregister_needle_tags('ENV-NO-SECUREBOOT'); } if (testapi::get_var('UEFI')) { unregister_needle_tags('ENV-BIOS'); } else { # BIOS mode unregister_needle_tags('ENV-UEFI'); } unless (testapi::get_var('OPENQA_INSTALLATION_OFFLINE')) { unregister_needle_tags('ENV-OFFLINE'); } unless (testapi::get_var('OPENQA_INSTALLATION_NONENGLISH')) { unregister_needle_tags('ENV-NONENGLISH'); } # Drop needles tagged with a different TYPE. # This is a bit inflexible right now but the best to be done at short # notice. my $good_tag = "ENV-TYPE-$ENV{TYPE}"; for my $tag (keys %needle::tags) { if ($tag !~ /ENV-TYPE-/) { next; } if ($tag eq $good_tag) { next; } # We've found a disqualified tag. Drop all needles that have it. # UNLESS that needle has a qualifier tag (i.e. ENV-TYPE-$TYPE). # qualification > disqualification my @needles = @{needle::tags($tag)}; for my $needle (@needles) { if ($needle->has_tag($good_tag)) { next; } $needle->unregister($tag); } } # FIXME: workaround for bionic # to get bionic tests quickly off the ground we lower all match limits to # 70% . this should give reasonable leeway with most font differences. # additionally TTY is also bugging around and sometimes using wrong colors # we'll want to gradually increase this to 100% and sort out failures # as they pop up. if (testapi::get_var('OPENQA_SERIES') eq 'bionic') { for my $needle (needle::all) { # use Data::Dumper; # print Dumper($needle); my @areas = $needle->{area}; for my $area (@{$needle->{area}}) { $area->{match} = min($area->{match}, 70); } } } # TODO: implement exclusion of newer needles on older systems # Now that we dropped all unsuitable needles. We should restirct the match. # For all needles with our good tag we'll drop all needles that have the # other tags but not our good tag # e.g. n1 [ENV-TYPE-stable, dolphin] # n2 [dolphin] # -> we unregister n2 as it is less suitable than n1 } $needle::cleanuphandler = \&cleanup_needles; if (testapi::get_var("INSTALLATION")) { my %test = ( 'devedition-gitunstable' => "tests/install_calamares.pm", '' => "tests/install_ubiquity.pm" ); if (testapi::get_var("INSTALLATION_OEM")) { autotest::loadtest('tests/install/ubiquity_oem.pm'); } else { autotest::loadtest($test{$ENV{TYPE}} || $test{''}); } autotest::loadtest('tests/install/first_start.pm'); } elsif (testapi::get_var('OPENQA_SNAP_NAME')) { print("Running a snap test...\n"); my $snap_name = testapi::get_var('OPENQA_SNAP_NAME'); my $script = "tests/snap/$snap_name.pm"; if (-f join('/', testapi::get_var('CASEDIR'), $script)) { print("Found specific test for snap $script\n"); autotest::loadtest($script); } else { print("Using generic test for snap $snap_name\n"); autotest::loadtest("tests/snap/generic.pm"); } } elsif (testapi::get_var("TESTS_TO_RUN")) { my $testpaths = testapi::get_var("TESTS_TO_RUN"); for my $testpath (@$testpaths) { autotest::loadtest $testpath; } } elsif (testapi::get_var("PLASMA_DESKTOP")) { autotest::loadtest('tests/plasma/plasma_folder.pm'); autotest::loadtest('tests/plasma/plasma_lockscreen.pm'); autotest::loadtest('tests/plasma/plasma_favorite.pm'); + autotest::loadtest('tests/plasma/plasma_alternatives.pm'); } else { testapi::diag 'ERROR FAILURE BAD ERROR no clue what to run!'; exit 1; } 1; diff --git a/neon/needles/kicker/plasma-kicker.json b/neon/needles/kicker/plasma-kicker.json new file mode 100644 index 0000000..240a2ed --- /dev/null +++ b/neon/needles/kicker/plasma-kicker.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "height": 398, + "match": 95, + "type": "match", + "width": 314, + "xpos": 0, + "ypos": 370 + } + ], + "properties": [], + "tags": [ + "plasma-kicker" + ] +} + diff --git a/neon/needles/kicker/plasma-kicker.png b/neon/needles/kicker/plasma-kicker.png new file mode 100644 index 0000000..8cb296b Binary files /dev/null and b/neon/needles/kicker/plasma-kicker.png differ diff --git a/neon/needles/kickoff/kickoff-alternatives-launcher.json b/neon/needles/kickoff/kickoff-alternatives-launcher.json new file mode 100644 index 0000000..5e82fb1 --- /dev/null +++ b/neon/needles/kickoff/kickoff-alternatives-launcher.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "height": 64, + "match": 95, + "type": "match", + "width": 277, + "xpos": 12, + "ypos": 537 + } + ], + "properties": [], + "tags": [ + "kickoff-alternatives-launcher" + ] +} + diff --git a/neon/needles/kickoff/kickoff-alternatives-launcher.png b/neon/needles/kickoff/kickoff-alternatives-launcher.png new file mode 100644 index 0000000..fc2ac4c Binary files /dev/null and b/neon/needles/kickoff/kickoff-alternatives-launcher.png differ diff --git a/neon/needles/kickoff/kickoff-alternatives-popup.json b/neon/needles/kickoff/kickoff-alternatives-popup.json new file mode 100644 index 0000000..4ffa689 --- /dev/null +++ b/neon/needles/kickoff/kickoff-alternatives-popup.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "height": 64, + "match": 95, + "type": "match", + "width": 358, + "xpos": 11, + "ypos": 613 + } + ], + "properties": [], + "tags": [ + "kickoff-alternatives-popup" + ] +} + diff --git a/neon/needles/kickoff/kickoff-alternatives-popup.png b/neon/needles/kickoff/kickoff-alternatives-popup.png new file mode 100644 index 0000000..68341a5 Binary files /dev/null and b/neon/needles/kickoff/kickoff-alternatives-popup.png differ diff --git a/neon/needles/kickoff/kickoff-alternatives.json b/neon/needles/kickoff/kickoff-alternatives.json new file mode 100644 index 0000000..9fa8079 --- /dev/null +++ b/neon/needles/kickoff/kickoff-alternatives.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "height": 29, + "match": 95, + "type": "match", + "width": 116, + "xpos": 32, + "ypos": 682 + } + ], + "properties": [], + "tags": [ + "kickoff-alternatives" + ] +} + diff --git a/neon/needles/kickoff/kickoff-alternatives.png b/neon/needles/kickoff/kickoff-alternatives.png new file mode 100644 index 0000000..bd2729a Binary files /dev/null and b/neon/needles/kickoff/kickoff-alternatives.png differ diff --git a/neon/needles/kickoff/kickoff-dismiss.json b/neon/needles/kickoff/kickoff-dismiss.json new file mode 100644 index 0000000..820c61c --- /dev/null +++ b/neon/needles/kickoff/kickoff-dismiss.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "height": 36, + "match": 95, + "type": "match", + "width": 41, + "xpos": 0, + "ypos": 732 + } + ], + "properties": [], + "tags": [ + "kickoff-dismiss" + ] +} + diff --git a/neon/needles/kickoff/kickoff-dismiss.png b/neon/needles/kickoff/kickoff-dismiss.png new file mode 100644 index 0000000..a4acf6b Binary files /dev/null and b/neon/needles/kickoff/kickoff-dismiss.png differ diff --git a/neon/needles/kickoff/kickoff.json b/neon/needles/kickoff/kickoff.json deleted file mode 100644 index 6173281..0000000 --- a/neon/needles/kickoff/kickoff.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "area": [ - { - "height": 30.22222222222223, - "match": 95, - "type": "match", - "width": 31.93333333333335, - "xpos": 1.6666666666666643, - "ypos": 733.9999999999998 - } - ], - "properties": [], - "tags": [ - "kickoff" - ] -} diff --git a/neon/needles/plasma_folder/plasma-alternatives-switch.json b/neon/needles/plasma_folder/plasma-alternatives-switch.json new file mode 100644 index 0000000..3a5ca86 --- /dev/null +++ b/neon/needles/plasma_folder/plasma-alternatives-switch.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "height": 31, + "match": 95, + "type": "match", + "width": 178, + "xpos": 6, + "ypos": 696 + } + ], + "properties": [], + "tags": [ + "plasma-alternatives-switch" + ] +} + diff --git a/neon/needles/plasma_folder/plasma-alternatives-switch.png b/neon/needles/plasma_folder/plasma-alternatives-switch.png new file mode 100644 index 0000000..070525d Binary files /dev/null and b/neon/needles/plasma_folder/plasma-alternatives-switch.png differ diff --git a/neon/needles/plasma_folder/plasma-launcher.json b/neon/needles/plasma_folder/plasma-launcher.json new file mode 100644 index 0000000..dabb777 --- /dev/null +++ b/neon/needles/plasma_folder/plasma-launcher.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "height": 30, + "match": 95, + "type": "match", + "width": 32, + "xpos": 2, + "ypos": 734 + } + ], + "properties": [], + "tags": [ + "plasma-launcher" + ] +} + diff --git a/neon/needles/kickoff/kickoff.png b/neon/needles/plasma_folder/plasma-launcher.png similarity index 100% rename from neon/needles/kickoff/kickoff.png rename to neon/needles/plasma_folder/plasma-launcher.png diff --git a/neon/tests/plasma/plasma_favorite.pm b/neon/tests/plasma/plasma_alternatives.pm similarity index 60% copy from neon/tests/plasma/plasma_favorite.pm copy to neon/tests/plasma/plasma_alternatives.pm index 8c940d1..152aa41 100644 --- a/neon/tests/plasma/plasma_favorite.pm +++ b/neon/tests/plasma/plasma_alternatives.pm @@ -1,55 +1,66 @@ # Copyright (C) 2018 Bhavisha Dhruve # Copyright (C) 2016-2018 Harald Sitter # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . use base "basetest_neon"; use strict; use testapi; sub run { assert_screen 'folder-desktop'; - - # Starts the Application Launcher - assert_and_click 'kickoff'; + + # Starts the Alternative Menu + assert_and_click 'plasma-launcher', 'right'; + + # Selects the Application Menu + assert_and_click 'kickoff-alternatives'; + assert_and_click 'kickoff-alternatives-popup'; + + # Switches to Application Menu + assert_and_click 'plasma-alternatives-switch'; + assert_screen 'folder-desktop'; + + # Check if kicker opens instead of kickoff + assert_and_click 'plasma-launcher'; + assert_screen 'plasma-kicker'; + send_key 'esc'; + + # Roll back to kickoff + assert_and_click 'plasma-launcher', 'right'; + assert_and_click 'kickoff-alternatives'; + assert_and_click 'kickoff-alternatives-launcher'; + assert_and_click 'plasma-alternatives-switch'; + assert_screen 'folder-desktop'; + assert_and_click 'plasma-launcher'; + assert_screen 'kickoff-popup'; wait_still_screen; - # Switches to the Application Tab - assert_screen 'kickoff-favorite'; - assert_and_click 'kickoff-application'; - assert_and_click 'kickoff-office'; - # Adds Okular in the favorites tab - assert_and_click 'kickoff-okular', 'right'; - assert_and_click 'kickoff-add-to-favorite'; - assert_screen 'kickoff-favorite-okular'; - # Removes Okular from the favorites tab - assert_and_click 'kickoff-favorite-okular', 'right'; - assert_and_click 'kickoff-remove-from-favorite'; - assert_screen ['kickoff-favorite-okular', 'kickoff-favorite'], 60; - if (match_has_tag('kickoff-favorite-okular')) { - die 'Okular should not be visible on the favorite tab' - } + send_key 'esc'; + wait_still_screen; + assert_screen 'folder-desktop'; } sub test_flags { # without anything - rollback to 'lastgood' snapshot if failed # 'fatal' - whole test suite is in danger if this fails # 'milestone' - after this test succeeds, update 'lastgood' # 'important' - if this fails, set the overall state to 'fail' return { important => 1 }; } 1; + diff --git a/neon/tests/plasma/plasma_favorite.pm b/neon/tests/plasma/plasma_favorite.pm index 8c940d1..759af30 100644 --- a/neon/tests/plasma/plasma_favorite.pm +++ b/neon/tests/plasma/plasma_favorite.pm @@ -1,55 +1,57 @@ # Copyright (C) 2018 Bhavisha Dhruve # Copyright (C) 2016-2018 Harald Sitter # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . use base "basetest_neon"; use strict; use testapi; sub run { assert_screen 'folder-desktop'; - + # Starts the Application Launcher - assert_and_click 'kickoff'; + assert_and_click 'plasma-launcher'; wait_still_screen; # Switches to the Application Tab assert_screen 'kickoff-favorite'; assert_and_click 'kickoff-application'; assert_and_click 'kickoff-office'; # Adds Okular in the favorites tab assert_and_click 'kickoff-okular', 'right'; assert_and_click 'kickoff-add-to-favorite'; assert_screen 'kickoff-favorite-okular'; # Removes Okular from the favorites tab assert_and_click 'kickoff-favorite-okular', 'right'; assert_and_click 'kickoff-remove-from-favorite'; assert_screen ['kickoff-favorite-okular', 'kickoff-favorite'], 60; if (match_has_tag('kickoff-favorite-okular')) { die 'Okular should not be visible on the favorite tab' } + # Close the kickoff otherwise next test will fail + assert_and_click 'kickoff-dismiss'; } sub test_flags { # without anything - rollback to 'lastgood' snapshot if failed # 'fatal' - whole test suite is in danger if this fails # 'milestone' - after this test succeeds, update 'lastgood' # 'important' - if this fails, set the overall state to 'fail' return { important => 1 }; } 1; diff --git a/neon/tests/plasma/plasma_lockscreen.pm b/neon/tests/plasma/plasma_lockscreen.pm index 788d572..274a211 100644 --- a/neon/tests/plasma/plasma_lockscreen.pm +++ b/neon/tests/plasma/plasma_lockscreen.pm @@ -1,118 +1,118 @@ # Copyright (C) 2016-2017 Harald Sitter # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . use base "basetest_neon"; use strict; use testapi; sub lock_screen { hold_key('ctrl'); hold_key('alt'); hold_key('l'); assert_screen('plasma-locked'); release_key('l'); release_key('alt'); release_key('ctrl'); } sub run { # Before we start the lock screen test make sure we aren't logged in on # our terminal. # Otherwise the tty6 session would show up in the switch and make results # unreliable. select_console 'log-console'; script_run 'exit', 0; reset_consoles; select_console 'x11'; # TODO: move to first_start.pm we want static colors. probably not necessary # to assert the default appearance? x11_start_program 'kcmshell5 screenlocker' ; assert_screen 'kcm-screenlocker'; assert_and_click 'kcm-screenlocker-appearance'; assert_and_click 'kcm-screenlocker-appearance-type'; assert_and_click 'kcm-screenlocker-appearance-type-color'; # Should the deafault ever become undesirable: #1d99f3 is the lovely color. assert_and_click 'kcm-ok'; lock_screen; # simple unlock type_password $testapi::password; send_key 'ret'; assert_screen 'folder-desktop', 60; lock_screen; assert_screen('plasma-locked-idle'); mouse_set(1, 1); mouse_hide; # virtual keyboard assert_and_click 'plasma-locked-keyboard-icon'; assert_screen 'plasma-locked-keyboard'; assert_and_click 'plasma-locked-keyboard-q'; assert_and_click 'plasma-locked-keyboard-q'; # qq in password field assert_screen 'plasma-locked-keyboard-qq', no_wait => 1; send_key 'backspace'; send_key 'backspace'; assert_and_click 'plasma-locked-keyboard-icon-active'; assert_screen 'plasma-locked'; # switch user assert_and_click 'plasma-locked-switch-icon'; assert_and_click 'plasma-locked-switch'; assert_screen 'sddm'; type_password $testapi::password; send_key 'ret'; # ugh, sddm has no way to get us back, start a new session? wait_still_screen; - assert_and_click 'kickoff', undef, 60; # 60 seconds since we don't assert desktop + assert_and_click 'plasma-launcher', undef, 60; # 60 seconds since we don't assert desktop assert_and_click 'kickoff-leave'; assert_and_click 'kickoff-leave-logout'; assert_and_click 'ksmserver-logout'; wait_still_screen; # we are back in our regular session, unlock and be happy # done unless (get_var("QEMUVGA") eq 'qxl') { # This is confirmed to not be a problem on qxl. Should we switch to # other VGAs in the future we'll know if they are exhibiting the # problem too as we only skip qxl. record_soft_failure 'kscreenlocker comes back with vkbd bug 387270'; assert_and_click 'plasma-locked-keyboard-icon-active'; } type_password $testapi::password; send_key 'ret'; assert_screen 'folder-desktop', 60; } sub test_flags { # without anything - rollback to 'lastgood' snapshot if failed # 'fatal' - whole test suite is in danger if this fails # 'milestone' - after this test succeeds, update 'lastgood' # 'important' - if this fails, set the overall state to 'fail' return { important => 1 }; } 1;