diff --git a/neon/lib/basetest_neon.pm b/neon/lib/basetest_neon.pm index 6290fd6..59442fa 100644 --- a/neon/lib/basetest_neon.pm +++ b/neon/lib/basetest_neon.pm @@ -1,188 +1,193 @@ # Copyright (C) 2017-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 . package basetest_neon; use base 'basetest'; use JSON qw(decode_json); use strict; use testapi; sub new { my ($class, $args) = @_; my $self = $class->SUPER::new($args); # TODO: this maybe should be global as within a test series we still only # use the same VM and disk, so setup actually only needs to happen once # in an entire os-autoinst run. $self->{boot_setup_ran} = 0; return $self; } sub post_fail_hook { if (check_screen('drkonqi-notification', 4)) { assert_and_click('drkonqi-notification'); record_soft_failure 'not implemented drkonqi opening'; } select_console 'log-console'; # The next uploads are largely failok since we want to get as many logs # as possible evne if some are missing. upload_logs '/home/'.$testapi::username.'/.cache/xsession-errors', failok => 1; upload_logs '/home/'.$testapi::username.'/.cache/sddm/xsession-errors', failok => 1; upload_logs '/home/'.$testapi::username.'/.xsession-errors', failok => 1; upload_logs '/home/'.$testapi::username.'/.local/share/sddm/wayland-session.log', failok => 1; script_run 'journalctl --no-pager -b 0 > /tmp/journal.txt'; upload_logs '/tmp/journal.txt', failok => 1; script_run 'coredumpctl info > /tmp/dumps.txt'; upload_logs '/tmp/dumps.txt', failok => 1; return 1; } sub login { my ($self) = @_; # Short wait, we should be close to sddm if we this gets called. assert_screen 'sddm', 120; $self->maybe_login; } sub maybe_login { # Short wait, we should be close to sddm if we this gets called. if (check_screen 'sddm', 16) { type_password $testapi::password; send_key 'ret'; wait_still_screen; } } +sub logout { + testapi::x11_start_program('Logout'); + assert_and_click ('ksmserver-logout'); +} + sub boot_to_dm { my ($self, %args) = @_; $args{run_setup} //= 1; # Grub in user edition is broken as of Jan 2018 and doesn't match our needle # because it is shittyly themed. As we do not entirely care about this in # application tests we'll simply ignore it by checking for either grub or # sddm. Due to auto time out we'll eventually end up at sddm even if # we do not explicitly hit 'ret'. assert_screen [qw(grub sddm)], 60 * 3; if (match_has_tag('grub')) { send_key 'ret'; assert_screen 'sddm', 60 * 2; } # else sddm, nothing to do if ($args{run_setup} && !$self->{boot_setup_ran}) { select_console 'log-console'; { assert_script_run 'wget ' . data_url('basetest_setup.rb'), 60; assert_script_sudo 'ruby basetest_setup.rb', 60; # FIXME: copy pasta from install core.pm if (get_var('OPENQA_APT_UPGRADE')) { assert_script_sudo 'apt update', 2 * 60; my $pkgs = get_var('OPENQA_APT_UPGRADE'); if ($pkgs eq "all") { $pkgs = "dist-upgrade"; } else { $pkgs = "install " . $pkgs; } assert_script_sudo 'DEBIAN_FRONTEND=noninteractive apt -y ' . $pkgs, 30 * 60; } } select_console 'x11'; $self->{boot_setup_ran} = 1; } # Move mouse to make sure sddm isn't idle before we return. # Make sure to hide it afterwards, lest it triggers hovers. mouse_set(1, 1); mouse_hide; } # Waits for system to boot to desktop. sub boot { my ($self, $args) = @_; $self->boot_to_dm; # Should be at sddm. Short time out as this only is a VT switch. assert_screen 'sddm', 4; type_password $testapi::password; send_key 'ret'; wait_still_screen; } sub enable_snapd { my ($self, %args) = @_; $args{auto_install_snap} //= 0; select_console 'log-console'; assert_script_sudo 'systemctl enable --now snapd.service'; # When turning on snapd it may schedule a whole bunch of stuff to update. # Wait until all automatic changes are done. To establish that talk to # the API and get in-progress changes. my @changes = (); do { sleep 8; my $changes_json = script_output 'curl --unix-socket /run/snapd.socket http:/v2/changes?select=in-progress'; @changes = @{decode_json($changes_json)->{result}}; } while (@changes); my $runtime = 'kde-frameworks-5'; my $snap = get_var('OPENQA_SNAP_NAME'); my $snap_channel = get_var('OPENQA_SNAP_CHANNEL'); my $runtime_channel = get_var('OPENQA_SNAP_RUNTIME_CHANNEL'); if ($runtime_channel eq "" || !defined $runtime_channel) { $runtime_channel = get_var('OPENQA_SNAP_CHANNEL'); } if ($runtime_channel eq "" || !defined $runtime_channel) { $runtime_channel = "stable"; } assert_script_sudo "snap switch --$runtime_channel $runtime"; assert_script_sudo 'snap refresh', 30 * 60; script_run "snap info $runtime > /tmp/runtime.info"; upload_logs '/tmp/runtime.info'; assert_script_run "curl --unix-socket /run/snapd.socket http:/v2/snaps/$runtime > /tmp/runtime.json"; upload_logs '/tmp/runtime.json'; if ($args{auto_install_snap}) { assert_script_sudo "snap install --$snap_channel $snap", 15 * 60; script_run "snap info $snap > /tmp/snap.info"; upload_logs '/tmp/snap.info'; assert_script_run "curl --unix-socket /run/snapd.socket http:/v2/snaps/$snap > /tmp/snap.json"; upload_logs '/tmp/snap.json'; } assert_script_run 'curl --unix-socket /run/snapd.socket http:/v2/interfaces > /tmp/interfaces.json'; upload_logs '/tmp/interfaces.json'; select_console 'x11'; } sub enable_snapd_and_install_snap { my ($self, $args) = @_; return $self->enable_snapd(auto_install_snap => 1); } 1; diff --git a/neon/needles/kicker/plasma-kicker.json b/neon/needles/kicker/plasma-kicker.json index 8d73710..1e97a91 100644 --- a/neon/needles/kicker/plasma-kicker.json +++ b/neon/needles/kicker/plasma-kicker.json @@ -1,25 +1,17 @@ { "area": [ { - "height": 383, + "height": 347, "match": 95, "type": "match", - "width": 260, - "xpos": 48, + "width": 252, + "xpos": 52, "ypos": 379 - }, - { - "height": 117, - "match": 95, - "type": "match", - "width": 39, - "xpos": 7, - "ypos": 605 } ], "properties": [], "tags": [ "plasma-kicker" ] } diff --git a/neon/tests/plasma/plasma_alternatives.pm b/neon/tests/plasma/plasma_alternatives.pm index db1675d..df152ae 100644 --- a/neon/tests/plasma/plasma_alternatives.pm +++ b/neon/tests/plasma/plasma_alternatives.pm @@ -1,85 +1,93 @@ # 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 switch_to { my ($type) = @_; do { # Close open popup if there is any. send_key 'esc'; send_key 'esc'; send_key 'esc'; # Starts the Alternative Menu assert_and_click 'plasma-launcher', 'right'; # Selects the menu type. assert_and_click 'kickoff-alternatives'; assert_screen "kickoff-alternatives-$type"; # Repeat this entire dance if the popup has corrupted graphics. # This happens every so often and renders the popup incorrectly. If # we were to click at this point we'd be selecting an off-by-one item. # instead of the intended one. # Cause unknown. } while (match_has_tag 'kickoff-alternatives-corrupted'); # Select type. assert_and_click "kickoff-alternatives-$type"; # Apply the switch. assert_and_click 'plasma-alternatives-switch'; } sub run { + my ($self) = @_; assert_screen 'folder-desktop'; # Switch to menu (kicker) switch_to 'menu'; assert_screen 'folder-desktop'; # Check if kicker opens instead of kickoff assert_and_click 'plasma-launcher'; assert_screen 'plasma-kicker'; send_key 'esc'; + + # Starting a new session + $self->logout; + + # Back in the session + $self->login; + assert_screen 'folder-desktop'; # Roll back to launcher (kickoff) switch_to 'launcher'; assert_screen 'folder-desktop'; assert_and_click 'plasma-launcher'; assert_screen 'kickoff-popup'; wait_still_screen; send_key 'esc'; 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 759af30..6de2c0d 100644 --- a/neon/tests/plasma/plasma_favorite.pm +++ b/neon/tests/plasma/plasma_favorite.pm @@ -1,57 +1,75 @@ # 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 { + my ($self) = @_; assert_screen 'folder-desktop'; - + # Starts the Application Launcher 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'; + assert_screen 'kickoff-favorite-okular', 60; + send_key 'esc'; + wait_still_screen; + assert_and_click 'plasma-launcher'; + send_key 'esc'; + + # Logging out from the session + $self->logout; + + # Back in the session + $self->login; + assert_screen 'folder-desktop', 60; + # Removes Okular from the favorites tab + assert_and_click 'plasma-launcher'; + wait_still_screen; 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;