[gnome-build-meta/sam/settings-test: 2/2] openqa: Add an example test for Settings
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-build-meta/sam/settings-test: 2/2] openqa: Add an example test for Settings
- Date: Tue, 28 Sep 2021 15:08:01 +0000 (UTC)
commit 289cd5e0b2f7d5916afcafe04aa38fd7849b8b8d
Author: Sam Thursfield <sam thursfield codethink co uk>
Date: Fri Sep 24 10:39:18 2021 +0100
openqa: Add an example test for Settings
This shows how to launch Settings, save a screenshot and assert
that the expected app shows up on startup.
openqa/lib/gnomeutils.pm | 23 +++++++++++++++++++++++
openqa/main.pm | 2 ++
openqa/tests/app_settings.pm | 16 ++++++++++++++++
3 files changed, 41 insertions(+)
---
diff --git a/openqa/lib/gnomeutils.pm b/openqa/lib/gnomeutils.pm
new file mode 100644
index 000000000..64de2a236
--- /dev/null
+++ b/openqa/lib/gnomeutils.pm
@@ -0,0 +1,23 @@
+sub exit_activities_view {
+ send_key('esc');
+}
+
+sub run_command {
+ my $command = $_[0];
+ my $desktop_runner_hotkey = 'alt-f2';
+
+ exit_activities_view
+
+ type_string($command);
+ send_key 'ret';
+
+ wait_still_screen(2);
+ save_screenshot;
+}
+
+sub start_app {
+ my $command = $_[0];
+ run_command($command);
+}
+
+1;
diff --git a/openqa/main.pm b/openqa/main.pm
index b6fbf2556..ce045d958 100644
--- a/openqa/main.pm
+++ b/openqa/main.pm
@@ -2,8 +2,10 @@ use strict;
use testapi;
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";
1;
diff --git a/openqa/tests/app_settings.pm b/openqa/tests/app_settings.pm
new file mode 100644
index 000000000..96986e335
--- /dev/null
+++ b/openqa/tests/app_settings.pm
@@ -0,0 +1,16 @@
+use base 'basetest';
+use strict;
+use testapi;
+use gnomeutils;
+
+sub run {
+ start_app('gnome-control-center');
+ assert_screen('app_settings_startup', 10);
+ send_key('alt-f4');
+}
+
+sub test_flags {
+ return { fatal => 1 };
+}
+
+1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]