From f7487cad881f8323a46631d688d65ede66679b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Vidot?= Date: Mon, 20 May 2024 12:50:55 +0200 Subject: [PATCH] Add openSUSEway test https://progress.opensuse.org/issues/158700 --- products/opensuse/main.pm | 4 ++++ schedule/sway.yaml | 15 ++++++++++++ tests/console/configure_sway.pm | 34 +++++++++++++++++++++++++++ tests/console/install_sway_pattern.pm | 33 ++++++++++++++++++++++++++ tests/x11/sway_reconfigure_openqa.pm | 27 +++++++++++++++++++++ 5 files changed, 113 insertions(+) create mode 100644 schedule/sway.yaml create mode 100644 tests/console/configure_sway.pm create mode 100644 tests/console/install_sway_pattern.pm create mode 100644 tests/x11/sway_reconfigure_openqa.pm diff --git a/products/opensuse/main.pm b/products/opensuse/main.pm index 999dc5c00cdb..34c467c404bf 100644 --- a/products/opensuse/main.pm +++ b/products/opensuse/main.pm @@ -167,6 +167,7 @@ sub load_otherDE_tests { if ($de =~ /^enlightenment$/) { load_enlightenment_tests(); } if ($de =~ /^mate$/) { load_mate_tests(); } if ($de =~ /^lxqt$/) { load_lxqt_tests(); } + if ($de =~ /^sway/) { load_sway_tests(); } load_shutdown_tests; return 1; } @@ -190,6 +191,9 @@ sub load_mate_tests { loadtest "x11/mate_terminal"; } +sub load_sway_tests { +} + sub install_online_updates { return 0 unless get_var('INSTALL_ONLINE_UPDATES'); diff --git a/schedule/sway.yaml b/schedule/sway.yaml new file mode 100644 index 000000000000..0b8253b15289 --- /dev/null +++ b/schedule/sway.yaml @@ -0,0 +1,15 @@ +name: test sway +description: > + Tests sway +schedule: + - boot/boot_to_desktop + - console/system_prepare + - console/consoletest_setup + - console/hostname + - update/zypper_clear_repos + - console/install_sway_pattern + - console/consoletest_finish + - x11/sway_reconfigure_openqa + - x11/reboot_icewm + - console/configure_sway + - shutdown/shutdown diff --git a/tests/console/configure_sway.pm b/tests/console/configure_sway.pm new file mode 100644 index 000000000000..676168ba4de0 --- /dev/null +++ b/tests/console/configure_sway.pm @@ -0,0 +1,34 @@ +# SUSE's openQA tests +# +# Copyright 2012-2016 SUSE LLC +# SPDX-License-Identifier: FSFAP + +# Summary: Framework to test other Desktop Environments +# Non-Primary desktop environments are generally installed by means +# of a pattern. For those tests, we assume a minimal-X based installation +# where the pattern is being installed on top. +# Maintainer: Dominique Leuenberger + +use base "consoletest"; +use serial_terminal 'select_serial_terminal'; +use strict; +use warnings; +use testapi; +use utils; +use power_action_utils 'power_action'; + +sub run { + my ($self) = @_; + select_serial_terminal; + + script_run("mkdir -p ~/.config/sway"); + script_run("cp /etc/sway/config ~/.config/sway/"); + assert_script_run("sed -i 's/set \$menu dmenu_path/set \$menu dmenu_path | dmenu -nb \\\'#173f4f\\' -sb \\\'#35b9ab\\' -nf \\\'#73ba25\\' -sf \\\'#173f4f\\' -fn \\\'Source Sans Pro-14\\' | xargs swaymsg exec --/' ~/.config/sway/config"); + script_run('echo -e "[Desktop]\\nSession=sway" > ~/.dmrc'); + power_action('reboot', textmode => 1); + $self->wait_boot; + send_key("super-d"); + assert_screen 'sway-menu-bar'; +} + +1; diff --git a/tests/console/install_sway_pattern.pm b/tests/console/install_sway_pattern.pm new file mode 100644 index 000000000000..dba4c347b246 --- /dev/null +++ b/tests/console/install_sway_pattern.pm @@ -0,0 +1,33 @@ +# SUSE's openQA tests +# +# Copyright 2012-2016 SUSE LLC +# SPDX-License-Identifier: FSFAP + +# Summary: Framework to test other Desktop Environments +# Non-Primary desktop environments are generally installed by means +# of a pattern. For those tests, we assume a minimal-X based installation +# where the pattern is being installed on top. +# Maintainer: Dominique Leuenberger + +use base "consoletest"; +use strict; +use warnings; +use testapi; +use utils; + +sub run { + select_console 'root-console'; + + script_run("zypper lr -d | tee /dev/$serialdev"); + + zypper_call "in -t pattern sway"; + + # Reset the state of lightdm, to have the new default in use (lightdm saves what the user's last session was) + assert_script_run("rm -f ~lightdm/.cache/lightdm-gtk-greeter/state /var/lib/AccountsService/users/*"); +} + +sub test_flags { + return {milestone => 1, fatal => 1}; +} + +1; diff --git a/tests/x11/sway_reconfigure_openqa.pm b/tests/x11/sway_reconfigure_openqa.pm new file mode 100644 index 000000000000..168cfb6d64c4 --- /dev/null +++ b/tests/x11/sway_reconfigure_openqa.pm @@ -0,0 +1,27 @@ +# SUSE's openQA tests +# +# Copyright SUSE LLC +# SPDX-License-Identifier: FSFAP + +# Summary: Other Desktop Environments: sway +# Update the openQA internal configuration after the DE has been installed +# Maintainer: Dominique Leuenberger + +use base "x11test"; +use strict; +use warnings; +use testapi; +use utils; + +sub run { + my $self = shift; + + set_var('DESKTOP', 'sway'); + + set_var('DISPLAYMANAGER', 'sddm'); + set_var('DM_NEEDS_USERNAME', 0); + + $self->result('ok'); +} + +1;