[gnome-build-meta/sam/openqa-apps-1] openqa: Add tests for 5 more apps
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-build-meta/sam/openqa-apps-1] openqa: Add tests for 5 more apps
- Date: Thu, 4 Nov 2021 17:13:12 +0000 (UTC)
commit 9270945e5f28c2a28d7f7978de258ba134d1a4f1
Author: Sam Thursfield <sam thursfield codethink co uk>
Date: Thu Nov 4 13:08:16 2021 +0100
openqa: Add tests for 5 more apps
App tests are not fatal, ensuring we test all apps even if one or
more tests don't pass.
Part of https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/431
openqa/lib/app_test.pm | 16 ++++++++++++++++
openqa/lib/gnomeutils.pm | 26 +++++++++++++++++++++++---
openqa/main.pm | 13 +++++++++----
openqa/tests/app_cheese.pm | 13 +++++++++++++
openqa/tests/app_epiphany.pm | 13 +++++++++++++
openqa/tests/app_gnome_weather.pm | 13 +++++++++++++
openqa/tests/app_nautilus.pm | 17 +++++++++++++++++
openqa/tests/app_settings.pm | 7 ++++---
openqa/tests/app_simple_scan.pm | 17 +++++++++++++++++
9 files changed, 125 insertions(+), 10 deletions(-)
---
diff --git a/openqa/lib/app_test.pm b/openqa/lib/app_test.pm
new file mode 100644
index 000000000..695ad0221
--- /dev/null
+++ b/openqa/lib/app_test.pm
@@ -0,0 +1,16 @@
+package app_test;
+use base "basetest";
+
+use strict;
+use warnings;
+use testapi;
+use gnomeutils;
+
+sub post_fail_hook {
+ # We don't know what state the app is in, but make sure it's closed
+ # to avoid breaking the next test.
+ send_key('alt-f4');
+ assert_screen('desktop_empty') unless match_has_tag('generic-desktop');
+}
+
+1;
diff --git a/openqa/lib/gnomeutils.pm b/openqa/lib/gnomeutils.pm
index 75fd7b2ef..b92caa71e 100644
--- a/openqa/lib/gnomeutils.pm
+++ b/openqa/lib/gnomeutils.pm
@@ -2,6 +2,22 @@
# `x11_start_program` function found here:
# https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/master/lib/susedistribution.pm
+package gnomeutils;
+
+use base Exporter;
+use Exporter;
+
+use strict;
+use warnings;
+
+use testapi;
+
+our @EXPORT = qw(
+ run_command
+ start_app
+ close_app
+);
+
sub run_command {
my $command = $_[0];
my $desktop_runner_hotkey = 'alt-f2';
@@ -11,12 +27,12 @@ sub run_command {
send_key('esc');
wait_still_screen(2);
- send_key($desktop_runner_hotkey, wait_screen_change => true);
+ send_key($desktop_runner_hotkey, wait_screen_change => 'true');
assert_screen('desktop_runner', $desktop_runner_timeout);
type_string($command);
- send_key 'ret';
+ send_key('ret');
}
sub start_app {
@@ -24,7 +40,11 @@ sub start_app {
run_command($command);
wait_still_screen(2);
- save_screenshot;
+}
+
+sub close_app {
+ wait_screen_change { send_key('alt-f4') };
+ assert_screen('desktop_empty') unless match_has_tag('generic-desktop');
}
1;
diff --git a/openqa/main.pm b/openqa/main.pm
index 35d09760e..39811dff5 100644
--- a/openqa/main.pm
+++ b/openqa/main.pm
@@ -5,9 +5,14 @@ use autotest;
use needle;
use File::Basename;
-autotest::loadtest "tests/gnome_install.pm";
-autotest::loadtest "tests/gnome_welcome.pm";
-autotest::loadtest "tests/gnome_desktop.pm";
-autotest::loadtest "tests/app_settings.pm";
+autotest::loadtest("tests/gnome_install.pm");
+autotest::loadtest("tests/gnome_welcome.pm");
+autotest::loadtest("tests/gnome_desktop.pm");
+autotest::loadtest("tests/app_cheese.pm");
+autotest::loadtest("tests/app_epiphany.pm");
+autotest::loadtest("tests/app_gnome_weather.pm");
+autotest::loadtest("tests/app_nautilus.pm");
+autotest::loadtest("tests/app_settings.pm");
+autotest::loadtest("tests/app_simple_scan.pm");
1;
diff --git a/openqa/tests/app_cheese.pm b/openqa/tests/app_cheese.pm
new file mode 100644
index 000000000..b89475d23
--- /dev/null
+++ b/openqa/tests/app_cheese.pm
@@ -0,0 +1,13 @@
+use base 'app_test';
+use strict;
+use warnings;
+use testapi;
+use gnomeutils;
+
+sub run {
+ start_app('cheese');
+ assert_screen('app_cheese_home', 10);
+ close_app;
+}
+
+1;
diff --git a/openqa/tests/app_epiphany.pm b/openqa/tests/app_epiphany.pm
new file mode 100644
index 000000000..90ce24fde
--- /dev/null
+++ b/openqa/tests/app_epiphany.pm
@@ -0,0 +1,13 @@
+use base 'app_test';
+use strict;
+use warnings;
+use testapi;
+use gnomeutils;
+
+sub run {
+ start_app('epiphany');
+ assert_screen('app_epiphany_home', 10);
+ close_app;
+}
+
+1;
diff --git a/openqa/tests/app_gnome_weather.pm b/openqa/tests/app_gnome_weather.pm
new file mode 100644
index 000000000..33c3b2989
--- /dev/null
+++ b/openqa/tests/app_gnome_weather.pm
@@ -0,0 +1,13 @@
+use base 'app_test';
+use strict;
+use warnings;
+use testapi;
+use gnomeutils;
+
+sub run {
+ start_app('gnome-weather');
+ assert_screen('app_gnome_weather_home', 10);
+ close_app;
+}
+
+1;
diff --git a/openqa/tests/app_nautilus.pm b/openqa/tests/app_nautilus.pm
new file mode 100644
index 000000000..1737d86d8
--- /dev/null
+++ b/openqa/tests/app_nautilus.pm
@@ -0,0 +1,17 @@
+use base 'app_test';
+use strict;
+use warnings;
+use testapi;
+use gnomeutils;
+
+sub run {
+ start_app('nautilus');
+ assert_screen('app_nautilus_home', 10);
+ close_app;
+}
+
+sub test_flags {
+ return { fatal => 0 };
+}
+
+1;
diff --git a/openqa/tests/app_settings.pm b/openqa/tests/app_settings.pm
index 96986e335..b6f79cd43 100644
--- a/openqa/tests/app_settings.pm
+++ b/openqa/tests/app_settings.pm
@@ -1,16 +1,17 @@
-use base 'basetest';
+use base 'app_test';
use strict;
+use warnings;
use testapi;
use gnomeutils;
sub run {
start_app('gnome-control-center');
assert_screen('app_settings_startup', 10);
- send_key('alt-f4');
+ close_app;
}
sub test_flags {
- return { fatal => 1 };
+ return { fatal => 0 };
}
1;
diff --git a/openqa/tests/app_simple_scan.pm b/openqa/tests/app_simple_scan.pm
new file mode 100644
index 000000000..42427f4a6
--- /dev/null
+++ b/openqa/tests/app_simple_scan.pm
@@ -0,0 +1,17 @@
+use base 'app_test';
+use strict;
+use warnings;
+use testapi;
+use gnomeutils;
+
+sub run {
+ start_app('simple-scan');
+ assert_screen('app_simple_scan_home', 10);
+ close_app;
+}
+
+sub test_flags {
+ return { fatal => 0 };
+}
+
+1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]