[gnome-sound-recorder/testing: 11/49] Add more tests.
- From: Margaret Ford <megford src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder/testing: 11/49] Add more tests.
- Date: Wed, 29 Nov 2017 02:50:28 +0000 (UTC)
commit 3f4c87dfec76404a7e197544788c8026e509fbbd
Author: Meg Ford <megford gnome org>
Date: Sun Feb 26 16:45:42 2017 -0600
Add more tests.
data/org.gnome.gnome-sound-recorder.gschema.xml | 2 +-
tests/app_test.feature | 24 +++++++++-
tests/steps/app_test.py | 59 ++++++++++++++++-------
3 files changed, 65 insertions(+), 20 deletions(-)
---
diff --git a/data/org.gnome.gnome-sound-recorder.gschema.xml b/data/org.gnome.gnome-sound-recorder.gschema.xml
index c644150..2caf4db 100644
--- a/data/org.gnome.gnome-sound-recorder.gschema.xml
+++ b/data/org.gnome.gnome-sound-recorder.gschema.xml
@@ -16,7 +16,7 @@
<description>Maps media types to audio encoder preset names. If there is no mapping set, the default
encoder settings will be used.</description>
</key>
<key name="channel" type="i">
- <default>1</default>
+ <default>2</default>
<summary>Available channels</summary>
<description>Maps available channels. If there is not no mapping set, stereo channel will be used by
default.</description>
</key>
diff --git a/tests/app_test.feature b/tests/app_test.feature
index 3a2aa3a..2948bc4 100644
--- a/tests/app_test.feature
+++ b/tests/app_test.feature
@@ -6,4 +6,26 @@ Feature: Smoke tests
@about
Scenario: About dialog
* Open About dialog
- Then About UI is displayed
\ No newline at end of file
+ Then About UI is displayed
+ Then Press Credits
+
+ @preferences
+ Scenario: Preferences dialog
+ * Open Preferences dialog
+ Then Preferences UI is displayed
+ Then set the volume
+
+ @quit_via_app_menu
+ Scenario: Quit via app menu
+ * Select "Quit" from the app menu
+ Then gnome-sound-recorder is not running
+
+ @quit_via_shortcut
+ Scenario: Quit via shortcut
+ * Press the quit shortcut
+ Then gnome-sound-recorder is not running
+
+ @no_recordings
+ Scenario: No recordings in the Recordings folder
+ Then the main window is shown
+ Then the Recordings folder is present
\ No newline at end of file
diff --git a/tests/steps/app_test.py b/tests/steps/app_test.py
index 03035a4..6c8271c 100644
--- a/tests/steps/app_test.py
+++ b/tests/steps/app_test.py
@@ -13,9 +13,14 @@ from dogtail import utils
from dogtail.procedural import *
from common_steps import *
+def display_err(err_str):
+ return '{} is not displayed'.format(err_str)
+# channel_err = 'incorrect channels displayed'
+
@step(u'Open About dialog')
def open_about_dialog(context):
+ print(context.app)
context.execute_steps(u'* Select "About" in GApplication menu')
dialog_name = 'About Sound Recorder'
context.about_dialog = context.app.dialog(translate(dialog_name))
@@ -29,25 +34,43 @@ def open_and_close_about_dialog(context):
@then(u'About UI is displayed')
def about_ui_is_displayed(context):
- dialog_elem = context.about_dialog.child
+ ui = context.about_dialog.child
+ assert is_displayed(ui, 'label', 'Sound Recorder'), display_err('App name')
+ assert is_displayed(ui, 'label', 'Website'), display_err('Website link')
+ assert is_displayed(ui,
+ 'label',
+ 'This program comes with absolutely no warranty.\n'
+ 'See the GNU General Public License,'
+ ' version 2 or later for details.'), display_err('License link')
+ assert is_displayed(ui, 'radio button', 'About'), display_err('About tab')
+ assert not is_displayed(ui, 'radio button', 'Credits'), display_err('Credits tab')
- def is_displayed(role, ui_string):
- if role == 'radio button':
- return dialog_elem(translate(ui_string), role).checked
- return dialog_elem(translate(ui_string), role).showing
+@then(u'Press Credits')
+def press_credits(context):
+ ui = context.about_dialog.child
+ pressKey('Right')
+ pressKey('Enter')
- name_err = 'App name is not displayed'
- website_err = 'Website link is not displayed'
- lic_err = 'License link is not displayed'
- about_err = 'About tab is not selected'
- credit_err = 'Credits tab is selected'
+ assert is_displayed(ui, 'radio button', 'Credits'), display_err('Credits tab')
- assert is_displayed('label', 'Sound Recorder'), name_err
- assert is_displayed('label', 'Website'), website_err
- assert is_displayed('label',
- 'This program comes with absolutely no warranty.\n'
- 'See the GNU General Public License,'
- ' version 2 or later for details.'), lic_err
- assert is_displayed('radio button', 'About'), about_err
- assert not is_displayed('radio button', 'Credits'), credit_err
+
+@step(u'Open Preferences dialog')
+def open_pref_dialog(context):
+ context.execute_steps(u'* Select "Preferences" in GApplication menu')
+ dialog_name = 'Preferences'
+ context.pref_dialog = context.app.dialog(translate(dialog_name))
+
+
+@then(u'Preferences UI is displayed')
+def pref_ui_is_displayed(context):
+ ui = context.pref_dialog.child
+
+ assert is_displayed(ui, 'ComboBoxText', 'Ogg Vorbis'), codec_err
+ assert is_displayed(ui, 'label', 'Stereo'), channel_err
+ assert is_displayed(ui, '0.7'), volume_err
+ assert is_displayed(ui, '0.7'), mic_err
+
+@step(u'Select "Quit" from the app menu')
+def quit_is(context):
+ context.execute_steps(u'* Select "Quit" in GApplication menu')
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]