diff --git a/neon/main.pm b/neon/main.pm index 58404f0..9049689 100644 --- a/neon/main.pm +++ b/neon/main.pm @@ -1,156 +1,157 @@ # 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'); } else { testapi::diag 'ERROR FAILURE BAD ERROR no clue what to run!'; exit 1; } 1; diff --git a/neon/needles/kickoff/kickoff-add-to-favorite.json b/neon/needles/kickoff/kickoff-add-to-favorite.json new file mode 100644 index 0000000..3fd2a7b --- /dev/null +++ b/neon/needles/kickoff/kickoff-add-to-favorite.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "height": 29, + "match": 95, + "type": "match", + "width": 189, + "xpos": 238, + "ypos": 369 + } + ], + "properties": [], + "tags": [ + "kickoff-add-to-favorite" + ] +} + diff --git a/neon/needles/kickoff/kickoff-add-to-favorite.png b/neon/needles/kickoff/kickoff-add-to-favorite.png new file mode 100644 index 0000000..eb0f4ce Binary files /dev/null and b/neon/needles/kickoff/kickoff-add-to-favorite.png differ diff --git a/neon/needles/kickoff/kickoff-application.json b/neon/needles/kickoff/kickoff-application.json new file mode 100644 index 0000000..299e67f --- /dev/null +++ b/neon/needles/kickoff/kickoff-application.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "height": 64, + "match": 95, + "type": "match", + "width": 64, + "xpos": 114, + "ypos": 644 + } + ], + "properties": [], + "tags": [ + "kickoff-application" + ] +} + diff --git a/neon/needles/kickoff/kickoff-application.png b/neon/needles/kickoff/kickoff-application.png new file mode 120000 index 0000000..31b60ee --- /dev/null +++ b/neon/needles/kickoff/kickoff-application.png @@ -0,0 +1 @@ +kickoff-popup.png \ No newline at end of file diff --git a/neon/needles/kickoff/kickoff-favorite.json b/neon/needles/kickoff/kickoff-favorite.json new file mode 100644 index 0000000..950e417 --- /dev/null +++ b/neon/needles/kickoff/kickoff-favorite.json @@ -0,0 +1,25 @@ +{ + "area": [ + { + "height": 64, + "match": 95, + "type": "match", + "width": 445, + "xpos": 19, + "ypos": 406 + }, + { + "height": 101, + "match": 95, + "type": "match", + "width": 107, + "xpos": 4, + "ypos": 616 + } + ], + "properties": [], + "tags": [ + "kickoff-favorite" + ] +} + diff --git a/neon/needles/kickoff/kickoff-favorite.png b/neon/needles/kickoff/kickoff-favorite.png new file mode 100644 index 0000000..d457f6a Binary files /dev/null and b/neon/needles/kickoff/kickoff-favorite.png differ diff --git a/neon/needles/kickoff/kickoff-office.json b/neon/needles/kickoff/kickoff-office.json new file mode 100644 index 0000000..243233c --- /dev/null +++ b/neon/needles/kickoff/kickoff-office.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "height": 45, + "match": 95, + "type": "match", + "width": 427, + "xpos": 28, + "ypos": 353 + } + ], + "properties": [], + "tags": [ + "kickoff-office" + ] +} + diff --git a/neon/needles/kickoff/kickoff-office.png b/neon/needles/kickoff/kickoff-office.png new file mode 100644 index 0000000..1f67067 Binary files /dev/null and b/neon/needles/kickoff/kickoff-office.png differ diff --git a/neon/needles/kickoff/kickoff-okular.json b/neon/needles/kickoff/kickoff-okular.json new file mode 100644 index 0000000..02128c7 --- /dev/null +++ b/neon/needles/kickoff/kickoff-okular.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "height": 40, + "match": 95, + "type": "match", + "width": 431, + "xpos": 23, + "ypos": 234 + } + ], + "properties": [], + "tags": [ + "kickoff-okular" + ] +} + diff --git a/neon/needles/kickoff/kickoff-okular.png b/neon/needles/kickoff/kickoff-okular.png new file mode 100644 index 0000000..c402145 Binary files /dev/null and b/neon/needles/kickoff/kickoff-okular.png differ diff --git a/neon/tests/plasma/plasma_favorite.pm b/neon/tests/plasma/plasma_favorite.pm new file mode 100644 index 0000000..d4f5f66 --- /dev/null +++ b/neon/tests/plasma/plasma_favorite.pm @@ -0,0 +1,47 @@ +# 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', 30; + + # Starts the Application Launcher + assert_and_click 'kickoff'; + wait_still_screen; + # Switches to the Application Tab + assert_and_click 'kickoff-application', 30; + assert_and_click 'kickoff-office'; + # Adds Okular in the favorites tab + assert_and_click 'kickoff-okular', "right", 20; + assert_and_click 'kickoff-add-to-favorite'; + assert_screen 'kickoff-favorite', 30; +} + +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;