aboutsummaryrefslogtreecommitdiffstats
path: root/squishtests
diff options
context:
space:
mode:
authorSven Kroemeke <skroemeke@luxoft.com>2018-09-26 17:01:43 +0200
committerBramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>2018-10-18 10:03:10 +0000
commit4b160a7c6cd1d7aa3af4cc76678989126cd5f83d (patch)
tree4751387ad501c2180501e40b19c4ac4c0a70f67d /squishtests
parent56be33601e142db05bce8799e8987886e70ea3f3 (diff)
[squish] Added test for volume popup
Task-number: AUTOSUITE-660 Change-Id: Ie5b8a677734fdd9f8fa4f8f8ae46effd4a80519d Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
Diffstat (limited to 'squishtests')
-rw-r--r--squishtests/suite_neptune3/tst_popup_menus/steps/go_to_menu_steps.py99
-rw-r--r--squishtests/suite_neptune3/tst_popup_menus/test.feature22
-rw-r--r--squishtests/suite_neptune3/tst_popup_menus/test.py39
3 files changed, 160 insertions, 0 deletions
diff --git a/squishtests/suite_neptune3/tst_popup_menus/steps/go_to_menu_steps.py b/squishtests/suite_neptune3/tst_popup_menus/steps/go_to_menu_steps.py
new file mode 100644
index 00000000..0a3a11bd
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_popup_menus/steps/go_to_menu_steps.py
@@ -0,0 +1,99 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+##
+## Copyright (C) 2018 Luxoft GmbH
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the Neptune 3 IVI UI.
+##
+## $QT_BEGIN_LICENSE:GPL-QTAS$
+## Commercial License Usage
+## Licensees holding valid commercial Qt Automotive Suite licenses may use
+## this file in accordance with the commercial license agreement provided
+## with the Software or, alternatively, in accordance with the terms
+## contained in a written agreement between you and The Qt Company. For
+## licensing terms and conditions see https://www.qt.io/terms-conditions.
+## For further information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 or (at your option) any later version
+## approved by the KDE Free Qt Foundation. The licenses are as published by
+## the Free Software Foundation and appearing in the file LICENSE.GPL3
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+## SPDX-License-Identifier: GPL-3.0
+##
+#############################################################################
+
+import names
+
+@OnFeatureStart
+def hook(context):
+ start_neptune_ui_app_w_focus("console")
+
+@OnScenarioEnd
+#def hook(context):
+# currentApplicationContext().detach()
+
+
+@When("the volume button is tapped")
+def step(context):
+ volume_icon = waitForObject(names.neptune_3_UI_Center_Console_volumePopupButton_ToolButton)
+ tapObject(volume_icon)
+
+@Then("the volume popup should appear")
+def step(context):
+ volume_popup = names.neptune_3_UI_Center_Console_volumePopupItem_VolumePopup
+ is_enabled = waitForObjectExists(volume_popup).enabled
+ is_visible = waitForObjectExists(volume_popup).visible
+ test.compare( is_enabled and is_visible, True, "is both enabled and visible")
+
+
+@Then("the volume popup should not be there after '|integer|' seconds of closing animation")
+def step(context,seconds):
+ exists = is_squish_object_there(names.neptune_3_UI_Center_Console_volumePopupItem_VolumePopup,seconds)
+ if exists:
+ test.compare(True,False," volume popup is still there!")
+ else:
+ test.compare(True,True,"volume popup closed!")
+
+
+@When("the volume slider is moved 'upwards'")
+def step(context):
+ if not context.userData:
+ context.userData = {}
+
+ volumeSlider = waitForObject(names.neptune_3_UI_Center_Console_volumeSlider_Slider)
+ context.userData['VolumeSliderValue'] = volumeSlider.value
+
+ start_point = QPoint(8.13, 55.83)
+ movement = QPoint(0, -31)
+
+ ts_point = coord_transform2D(start_point)
+ ts_movement = coord_transform2D(movement)
+
+ touchAndDrag(volumeSlider, ts_point.x, ts_point.y, ts_movement.x, ts_movement.y)
+
+
+@Then("the volume slider value should be '|word|'")
+def step(context,change):
+ before_value = context.userData['VolumeSliderValue']
+
+ volumeSlider = waitForObject(names.neptune_3_UI_Center_Console_volumeSlider_Slider)
+ current_value = volumeSlider.value
+
+ test.log("Before: " + str(before_value) + " now: " + str(current_value))
+
+ is_now_smaller = (current_value < before_value)
+ is_equal = (current_value == before_value)
+
+ if change == 'increased':
+ test.compare(not is_now_smaller and not is_equal, True, "has greater value")
+ else: # decreased
+ test.compare(is_now_smaller, True, "has smaller value")
diff --git a/squishtests/suite_neptune3/tst_popup_menus/test.feature b/squishtests/suite_neptune3/tst_popup_menus/test.feature
new file mode 100644
index 00000000..ffe32f88
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_popup_menus/test.feature
@@ -0,0 +1,22 @@
+Feature: Test the popups
+
+ From main menu some popups are directly accessible.
+ Just test if they open
+
+ Scenario: Open and close the volume popup
+
+ Given main menu is open
+ When after some '5' seconds
+ And the volume button is tapped
+ Then the volume popup should appear
+ When the popup close button is clicked
+ Then the volume popup should not be there after '1' seconds of closing animation
+
+ Scenario: Change the volume
+
+ Given main menu is open
+ When after some '5' seconds
+ And the volume button is tapped
+ Then the volume popup should appear
+ When the volume slider is moved 'upwards'
+ Then the volume slider value should be 'increased'
diff --git a/squishtests/suite_neptune3/tst_popup_menus/test.py b/squishtests/suite_neptune3/tst_popup_menus/test.py
new file mode 100644
index 00000000..07c9da36
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_popup_menus/test.py
@@ -0,0 +1,39 @@
+############################################################################
+##
+## Copyright (C) 2018 Luxoft GmbH
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the Neptune 3 IVI UI.
+##
+## $QT_BEGIN_LICENSE:GPL-QTAS$
+## Commercial License Usage
+## Licensees holding valid commercial Qt Automotive Suite licenses may use
+## this file in accordance with the commercial license agreement provided
+## with the Software or, alternatively, in accordance with the terms
+## contained in a written agreement between you and The Qt Company. For
+## licensing terms and conditions see https://www.qt.io/terms-conditions.
+## For further information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 or (at your option) any later version
+## approved by the KDE Free Qt Foundation. The licenses are as published by
+## the Free Software Foundation and appearing in the file LICENSE.GPL3
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+## SPDX-License-Identifier: GPL-3.0
+##
+#############################################################################
+
+source(findFile('scripts', 'python/bdd.py'))
+
+setupHooks('../shared/scripts/bdd_hooks.py')
+collectStepDefinitions('./steps', '../shared/steps')
+
+def main():
+ testSettings.throwOnFailure = True
+ runFeatureFile('test.feature')