aboutsummaryrefslogtreecommitdiffstats
path: root/squishtests
diff options
context:
space:
mode:
authorSven Kroemeke <skroemeke@luxoft.com>2018-11-21 14:38:25 +0100
committerBramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>2018-11-29 09:42:14 +0000
commit797464a18cc05b4b79c83a75885305a802647e84 (patch)
treec540c8baa85d6553c86d8258c6a0b50efe31d13b /squishtests
parent351e694bfcec150588eac54e1dc6bdd83a3c713d (diff)
[squish] rework for squish attach to sub process feature
Task-number: AUTOSUITE-661 Change-Id: I49df6550a4fde7b6cfd5526e6a91ddd902686557 Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
Diffstat (limited to 'squishtests')
-rw-r--r--squishtests/suite_neptune3/extension/README.md7
-rw-r--r--squishtests/suite_neptune3/shared/scripts/bdd_hooks.py333
-rw-r--r--squishtests/suite_neptune3/shared/scripts/common/__init__.py33
-rw-r--r--squishtests/suite_neptune3/shared/scripts/common/app.py131
-rw-r--r--squishtests/suite_neptune3/shared/scripts/common/qml_names.py40
-rw-r--r--squishtests/suite_neptune3/shared/scripts/common/settings.py101
-rwxr-xr-xsquishtests/suite_neptune3/shared/scripts/generate_sqlite.py3
-rw-r--r--squishtests/suite_neptune3/shared/scripts/names.py20
-rw-r--r--squishtests/suite_neptune3/shared/steps/essential.py117
-rw-r--r--squishtests/suite_neptune3/shared/steps/steps.py3
-rw-r--r--squishtests/suite_neptune3/suite.conf4
-rw-r--r--squishtests/suite_neptune3/templates/README.md6
-rw-r--r--squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/steps/concrete_test.py33
-rw-r--r--squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/test.feature15
-rw-r--r--squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/test.py44
-rw-r--r--squishtests/suite_neptune3/tst_app_common/steps/app_settings.py106
-rw-r--r--squishtests/suite_neptune3/tst_app_common/test.feature14
-rw-r--r--squishtests/suite_neptune3/tst_app_common/test.py43
-rw-r--r--squishtests/suite_neptune3/tst_environment_info/steps/environment.py21
-rw-r--r--squishtests/suite_neptune3/tst_environment_info/test.feature2
-rw-r--r--squishtests/suite_neptune3/tst_environment_info/test.py7
-rw-r--r--squishtests/suite_neptune3/tst_launch_bar/steps/launch_bar.py158
-rw-r--r--squishtests/suite_neptune3/tst_launch_bar/test.feature37
-rw-r--r--squishtests/suite_neptune3/tst_launch_bar/test.py7
-rw-r--r--squishtests/suite_neptune3/tst_main_menu_widgets/steps/widget_operations.py101
-rw-r--r--squishtests/suite_neptune3/tst_main_menu_widgets/test.feature10
-rw-r--r--squishtests/suite_neptune3/tst_main_menu_widgets/test.py7
-rw-r--r--squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py95
-rw-r--r--squishtests/suite_neptune3/tst_popup_climate/test.feature15
-rw-r--r--squishtests/suite_neptune3/tst_popup_climate/test.py7
-rw-r--r--squishtests/suite_neptune3/tst_popup_menus/steps/go_to_menu_steps.py3
-rw-r--r--squishtests/suite_neptune3/tst_popup_menus/test.feature7
-rw-r--r--squishtests/suite_neptune3/tst_popup_menus/test.py7
33 files changed, 1266 insertions, 271 deletions
diff --git a/squishtests/suite_neptune3/extension/README.md b/squishtests/suite_neptune3/extension/README.md
new file mode 100644
index 00000000..45b9a9a9
--- /dev/null
+++ b/squishtests/suite_neptune3/extension/README.md
@@ -0,0 +1,7 @@
+# Setting up IDE
+
+## These files shall help to setup the Squish IDE
+
+#### NeptuneWidgets.qml
+This file should be put into ``SQUISH_DIR/lib/extensions/qt/qtquick``.
+Further explanation will be added.
diff --git a/squishtests/suite_neptune3/shared/scripts/bdd_hooks.py b/squishtests/suite_neptune3/shared/scripts/bdd_hooks.py
index bb2175b3..49bbced0 100644
--- a/squishtests/suite_neptune3/shared/scripts/bdd_hooks.py
+++ b/squishtests/suite_neptune3/shared/scripts/bdd_hooks.py
@@ -14,7 +14,8 @@
## 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.
+## 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
@@ -32,26 +33,21 @@
#############################################################################
-# This file contains hook functions to run as the .feature file is executed.
-#
-# A common use-case is to use the OnScenarioStart/OnScenarioEnd hooks to
-# start and stop an AUT, e.g.
-#
-# @OnScenarioStart
-# def hook(context):
-# startApplication("addressbook")
-#
-# @OnScenarioEnd
-# def hook(context):
-# currentApplicationContext().detach()
-#
-# See the section 'Performing Actions During Test Execution Via Hooks' in the Squish
-# manual for a complete reference of the available API.
+import math
+import __builtin__
+import os # needed for app identification path
+
+import common.settings as settings
+import common.app as app
+
+# squish dependent
import names
+import squish
+import test
# waiting time to let all windows to arrange at start-up
-STARTUP_ARRANGE_TIME_SEC = 1
+STARTUP_ARRANGE_TIME_SEC = 2
STARTUP_RETRIES = 0
STARTUP_RETRIES_WAIT_SEC = 2
END_DEARRANGE_TIME_SEC = 3
@@ -61,99 +57,159 @@ END_DEARRANGE_TIME_SEC = 3
def hook(context):
for ctx in applicationContextList():
ctx.detach()
- snooze(END_DEARRANGE_TIME_SEC)
-
+ squish.snooze(END_DEARRANGE_TIME_SEC)
-# unfortunately not readable by the AUT given in the project's test config of squish, those variable are not usable within the test
-AUT="neptune3-ui"
# clean up a little more
def start_neptune_ui_app_w_focus(window):
+ """ Starting hook for all tests to be started. It can be started in 2 modes
+ which selects which window of neptune should be focused (for a visible
+ experience and double check the tests' effect)
+
+ 'console' : console view focused
+ 'dashboard' : dashboard view focused
+ """
+
def repeater(tries):
- global SCREEN_HEIGHT
- global SCREEN_WIDTH
- global SCREEN_LANDSCAPE
+ """ Inside repeater function for de-coupling and allowing retries """
+
+ # DBUS MUST NOT be started from within neptune3ui otherwise
+ # squish will not start correctly with the squish attach to subprocess
+ # option.
+ command_line_options = "-r"
+ command_line = settings.G_AUT_MAIN + " " + command_line_options
+
+ test.log("command_line: " + command_line)
try:
- appman = {"type":"QtAM::ApplicationManagerWindow"}
- #obj = waitForObject(appman,1000)
+ # try to start application
+ app_context = squish.startApplication(command_line)
except Exception as e:
- test.fail("Appman not found!!:" + str(e))
- else:
- #command_line_options = "--start-session-dbus --r"
-
- #command_line_options = "--start-session-dbus -platform eglfs -plugin evdevkeyboard:grab=1"
-
- #command_line_options = "-r -c am-config.yaml --start-session-dbus -platform eglfs -plugin evdevkeyboard:grab=1 --logging-rule \"*=true\" --logging-rule \"Qt3D.*.debug=false\" --logging-rule=\"qt.*.debug=false\""
- command_line_options = "-r --start-session-dbus"
-
- command_line = AUT + " " + command_line_options
- try:
- startApplication(command_line)
- # wait for windows to arrange
- test.log("Start up application with: '" + command_line + "'!")
- snooze(STARTUP_ARRANGE_TIME_SEC)
-
- worked, window_obj = get_focus_window(window)
- if not worked:
- return False
- except Exception as e:
- if tries > 0:
- test.log("retrying to start AUT '" + AUT + "'!")
- snooze(STARTUP_RETRIES_WAIT_SEC)
- return repeater(tries-1)
- else:
- test.fail("Window not found after " + str(STARTUP_RETRIES) + " retries!!:" + str(e))
- return False
- else:
- # only for console so far
-
- test.log("Window size is : " + str(window_obj.width) + "," + str(window_obj.height))
- test.log("Window pos is : " + str(window_obj.x) + "," + str(window_obj.y))
- try:
- console_inside = waitForObject(names.neptune_3_UI_Center_Console_centerConsole_CenterConsole,500)
- except Exception:
- pass
- else:
- test.log("----------------------")
- SCREEN_WIDTH = console_inside.width
- SCREEN_HEIGHT = console_inside.height
- SCREEN_LANDSCAPE = True
- test.log("Console size : " + str(SCREEN_WIDTH) + "," + str(SCREEN_HEIGHT))
- test.log("Console offset is: " + str(console_inside.x) + "," + str(console_inside.y))
-
-
- # from https://kb.froglogic.com/display/KB/Problem+-+Bringing+window+to+foreground+%28Qt%29
- window_obj.show()
- getattr(window_obj, "raise")()
- #not needed any more??? o.activateWindow()
- return True
- # run here
- repeater(STARTUP_RETRIES)
+ test.fail("direct command line call didn't work:", str(e))
+ return False
+
+ test.log("Started applicationContext: '" + app_context.name + "' ("
+ + str(app_context.pid) + ", #" + str(app_context.port)
+ + ") is running!")
+
+ # this snooze is really needed, VERY IMPORTANT
+ squish.snooze(STARTUP_ARRANGE_TIME_SEC)
-def get_focus_window(window):
- found = True
- if window == "dashboard":
- obj_name = names.neptune_UI_Instrument_Cluster_QQuickWindowQmlImpl
- elif window == "console":
- obj_name = names.neptune_UI_Center_Console
- else:
- test.fail("The given window '" + window + "' is not known!!")
- obj = None
- found = False
- return found, obj
try:
- obj = waitForObject(obj_name,1000)
+ # update to catch all AUT instances
+ app.update_all_contexts()
+
+ app_now = squish.currentApplicationContext()
+ test.log("Current app: '" + str(app_now.commandLine) + "'")
+
+ # wait for windows to arrange
+ test.log("Started up application with: '" + command_line + "'!")
+
+ # to be able to focus window we need the neptune main app
+ app.switch_to_main_app()
+ worked, window_obj = get_focus_window(window)
+
+ if not worked:
+ return False
except Exception as e:
- test.fail("Could not find window '" + window + "'!!" + str(e))
- obj = None
- found = False
+ if tries > 0:
+ test.log("retrying to start AUT '" + settings.G_AUT_MAIN + "'!")
+ squish.snooze(STARTUP_RETRIES_WAIT_SEC)
+ return repeater(tries - 1)
+ else:
+ test.fail("Window not found after " + str(STARTUP_RETRIES)
+ + " retries!!:" + str(e))
+ return False
+ # only for console so far
+ test.log("Window size is : " + str(window_obj.width)
+ + "x" + str(window_obj.height))
+ test.log("Window pos is : " + str(window_obj.x)
+ + "," + str(window_obj.y))
+
+ # look for center console
+ try:
+ console_obj = squish.waitForObject(
+ names.neptune_3_UI_Center_Console_centerConsole_CenterConsole,
+ 500)
+ except Exception:
+ test.fail("Could not find console window!!!")
+ return False
+
+ # look also into
+ # https://doc.froglogic.com/squish/latest/rgs-squish.html#rgss-screen-object
+ test.log("----------------------")
+ settings.SCREEN_WIDTH = console_obj.width
+ settings.SCREEN_HEIGHT = console_obj.height
+
+ settings.SCREEN_LANDSCAPE = console_obj.store.centerConsole.isLandscape
+
+ test.log("Landscape" if settings.SCREEN_LANDSCAPE else "No landscape")
+
+ # I misuse it to distinguish between target and test development
+ if settings.SCREEN_LANDSCAPE:
+ settings.G_WAIT_SYSTEM_READY_SEC = 3
+
+ test.log("Console size : " + str(settings.SCREEN_WIDTH)
+ + "x" + str(settings.SCREEN_HEIGHT))
+ test.log("Console offset is: " + str(console_obj.x)
+ + "," + str(console_obj.y))
+
+ # from https://kb.froglogic.com/display/KB/Problem+-+Bringing+window+to+foreground+%28Qt%29
+ window_obj.show()
+ getattr(window_obj, "raise")()
+ #not needed any more??? o.activateWindow()
+ return True
+ # run here
+ test.log("Found dbus environment")
+ test.log("DBUS_SESSION_BUS_ADDRESS with '"
+ + os.environ.get('DBUS_SESSION_BUS_ADDRESS')
+ + "'")
+ # start dbus here
+ #start_dbus()
+ #
+ # THERE IS A BIG DBUS issue: if started from IDE, in the
+ # shell which started the IDE, a dbus session must be existent
+ # beforehand. From inside (maybe it is also a configuration issue on the
+ # test computer!) a valid dbus-session could yet not be established.
+ #
+ # To start a working and then being used dbus session from the
+ # test script here would be the best solution but yet
+ # it cannot be solved.
+ # It's either a test machine issue (configuration, permissions,
+ # dbus configuration), or dbus API must be used instead of
+ # subprocess python module. For python dbus module API squish must be
+ # extended to use not only build-in python scripts but system's
+ # python installation.
+ test.log("DBUS_SESSION_BUS_ADDRESS now is '"
+ + os.environ.get('DBUS_SESSION_BUS_ADDRESS')
+ + "'")
+ #test.log("DBUS_SESSION_BUS_PID now is '"
+ # + os.environ.get('DBUS_SESSION_BUS_PID')
+ # + "'")
- return found, obj
+ repeater(STARTUP_RETRIES)
+ test.log("leaving start_neptune_ui_app_w_focus")
-# pos = QCursor.pos()
-# test.log("Local Position is: " + str(pos.x) + "/" + str(pos.y))
+def get_focus_window(window):
+ """Return the object to the window according to dashboard/cluster"""
+ found = True
+ if window == "dashboard":
+ obj_name = names.neptune_UI_Instrument_Cluster_QQuickWindowQmlImpl
+ elif window == "console":
+ obj_name = names.neptune_UI_Center_Console
+ else:
+ test.fail("The given window '" + window + "' is not known!!")
+ obj = None
+ found = False
+ return found, obj
+ try:
+ obj = squish.waitForObject(obj_name, 1000)
+ except Exception as e:
+ test.fail("Could not find window '" + window + "'!!" + str(e))
+ obj = None
+ found = False
+ return found, obj
def get_middle_of_object(obj):
@@ -162,9 +218,10 @@ def get_middle_of_object(obj):
posy = obj.y
except Exception as e:
test.fail("Fail due to: " + str(e))
- return False, QPoint(0,0)
+ return False, QPoint(0, 0)
else:
- return True, QPoint(posx,posy)
+ return True, QPoint(posx, posy)
+
def get_info(obj):
try:
@@ -175,23 +232,45 @@ def get_info(obj):
except Exception as e:
test.fail("Fail due to: " + str(e))
else:
- test.log("(" + str(posx) + "," + str(posy) + ") size [" + str(width) + "," + str(height) + "]")
+ test.log("(" + str(posx) + "," + str(posy)
+ + ") size ["
+ + str(width) + "," + str(height) + "]")
-
-#helper
def get_midth_of_item(itemObjectOrName):
+ """Returns (success, QPoint) of the center point of the given object"""
item = waitForObject(itemObjectOrName)
if className(item) != "QQuickItem":
try:
item = object.convertTo(item, "QQuickItem")
except Exception as e:
- test.log("Positioning object could not be converted to QQuickItem: " + str(e))
- return False, QPoint(0,0)
- return True, QPoint(item.x + math.floor(item.width/2),item.y + math.floor(item.height/2))
+ test.log("Positioning object couldn't be converted to QQuickItem: "
+ + str(e))
+ return False, QPoint(0, 0)
+ return True, QPoint(item.x + math.floor(item.width / 2), item.y
+ + math.floor(item.height / 2))
+
+
+def find_object_name_recursively(obj, obj_name, max_depth):
+ """Find a given objectName string in the subtree of the given object, up
+ to max depth levels"""
+ if max_depth > 0:
+ deep_children = object.children(obj)
+ for dc in deep_children:
+ if hasattr(dc, "objectName") and dc.objectName == obj_name:
+ return dc
+ children_search = find_object_name_recursively(dc,
+ obj_name,
+ max_depth - 1)
+ if children_search:
+ return children_search
+ else:
+ return None
def get_position_item(itemObjectOrName):
+ """Gets the position of the given object in the coordinates of the
+ root object"""
def recursive_go_deep(obj):
parent = object.parent(obj)
if parent:
@@ -199,21 +278,55 @@ def get_position_item(itemObjectOrName):
if worked:
posx = obj.x + rel_pos.x
posy = obj.y + rel_pos.y
- return True, QPoint(posx,posy)
+ return True, QPoint(posx, posy)
else:
- return False, QPoint(0,0)
+ return False, QPoint(0, 0)
else:
- return True, QPoint(obj.x,obj.y)
+ return True, QPoint(obj.x, obj.y)
item = waitForObject(itemObjectOrName)
+ # from https://kb.froglogic.com/display/KB/Getting+screen+coordinates+of+QGraphicsItem%2C+QGraphicsObject
if className(item) != "QQuickItem":
try:
item = object.convertTo(item, "QQuickItem")
except Exception as e:
- test.log("Positioning object could not be converted to QQuickItem: " + str(e))
- return False, QPoint(0,0)
+ test.log("Positioning object couldn't be converted to QQuickItem: "
+ + str(e))
+ return False, QPoint(0, 0)
worked, pos = recursive_go_deep(item)
return worked, pos
-# from https://kb.froglogic.com/display/KB/Getting+screen+coordinates+of+QGraphicsItem%2C+QGraphicsObject
+# doesn't work, but I will leave it, maybe something else is terribly wrong
+def mouseMoveLinear(obj, x, y, time_sec):
+ step_size = 30
+ time_p_step = float(time_sec) / float(step_size)
+
+ dx = float(x) / step_size
+ dy = float(y) / step_size
+ sx = float(0.0)
+ sy = float(0.0)
+
+ old_x = __builtin__.int(0)
+ old_y = __builtin__.int(0)
+
+ for _ss in range(step_size):
+ draw_x = __builtin__.int(sx)
+ draw_y = __builtin__.int(sy)
+
+ step_x = draw_x - old_x
+ step_y = draw_y - old_y
+
+ if step_x != 0 or step_y != 0:
+ mouseMove(step_x, step_y)
+
+ #test.log(" (" + str(draw_x) + ":" + str(draw_y) + ") "
+ # + str(step_x) + ":" + str(step_y))
+
+ old_x = __builtin__.int(draw_x)
+ old_y = __builtin__.int(draw_y)
+
+ sx += dx
+ sy += dy
+ # wait milliseconds
+ snooze(time_p_step)
diff --git a/squishtests/suite_neptune3/shared/scripts/common/__init__.py b/squishtests/suite_neptune3/shared/scripts/common/__init__.py
new file mode 100644
index 00000000..d1e4e15a
--- /dev/null
+++ b/squishtests/suite_neptune3/shared/scripts/common/__init__.py
@@ -0,0 +1,33 @@
+# -*- 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
+##
+#############################################################################
diff --git a/squishtests/suite_neptune3/shared/scripts/common/app.py b/squishtests/suite_neptune3/shared/scripts/common/app.py
new file mode 100644
index 00000000..756935fd
--- /dev/null
+++ b/squishtests/suite_neptune3/shared/scripts/common/app.py
@@ -0,0 +1,131 @@
+# -*- 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 os # for path handling
+import settings # for global vars
+
+# squish dependent
+import test
+import squish
+
+
+def register_main(app):
+ """Register the main app, to be available from other python modules."""
+ if app is not None:
+ settings.G_APP_MAIN = app
+ else:
+ test.fail("Main app is empty!!!")
+
+
+def register_app(app):
+ """Registers an app into settings.G_APP_HANDLE, if this app is known."""
+ good = False
+ result = None
+
+ app_url = os.path.basename(os.path.normpath(app.cwd))
+ app_array = filter(lambda x, app_url=app_url: x[1] == app_url,
+ settings.G_NAME_ID)
+ app_name = None
+ if len(app_array) != 0:
+ app_name = app_array[0][0]
+
+ if app_name is not None and app_name in settings.G_APP_HANDLE.keys():
+ good = True
+ if settings.G_APP_HANDLE[app_name] is None:
+ settings.G_APP_HANDLE[app_name] = app
+ test.log("Registered the new app '"
+ + app_name
+ + "' to be usable in squish!")
+ else:
+ test.log("App '" + app_name + "' is already registered!")
+ result = app
+ else:
+ test.fail("The app with path '" + app.cwd + "' is not known!")
+ return good, result
+
+
+def switch_to_main_app():
+ """Switch context to main app, to act in its process."""
+ good = False
+ if settings.G_APP_MAIN is not None:
+ squish.snooze(settings.G_WAIT_SWITCH_APP_CONTEXT)
+ squish.setApplicationContext(settings.G_APP_MAIN)
+ good = True
+ else:
+ test.fail("Main app is not registered yet!!!")
+ return good
+
+
+def switch_to_app(app_name):
+ """Switch context to the given app, to act in its process."""
+ good = False
+ if app_name in settings.G_APP_HANDLE.keys():
+ switch_to_app = settings.G_APP_HANDLE[app_name]
+ if switch_to_app is not None:
+ squish.snooze(settings.G_WAIT_SWITCH_APP_CONTEXT)
+ squish.setApplicationContext(switch_to_app)
+ test.log("Switched to registered app '" + app_name + "'!")
+ good = True
+ else:
+ test.fail("App '" + app_name + "' is known but yet not registered")
+ else:
+ test.fail("App '" + app_name + "' is not known!")
+ return good
+
+
+def get_app_id(app_name):
+ """Get (found,app_id) from the app list"""
+ for name, value in settings.G_NAME_ID:
+ if name == app_name:
+ return True, value
+ return False, ""
+
+
+def update_all_contexts():
+ """Update application contexts, each possible app has to be registered
+ before using!"""
+ app_list = squish.applicationContextList()
+ for a in app_list:
+ # distinguish apps
+ app_name = str(a)
+ if app_name == settings.G_AUT_MAIN:
+ register_main(a)
+ elif app_name == settings.G_AUT_APPMAN:
+ register_app(a)
+ elif app_name == settings.G_AUT_REMOTE:
+ test.log("app '" + app_name + "' is found, all right!")
+ else:
+ test.warning("app '" + app_name + "' with path '"
+ + a.cwd + "' is yet not known!")
diff --git a/squishtests/suite_neptune3/shared/scripts/common/qml_names.py b/squishtests/suite_neptune3/shared/scripts/common/qml_names.py
new file mode 100644
index 00000000..b7ee6ed8
--- /dev/null
+++ b/squishtests/suite_neptune3/shared/scripts/common/qml_names.py
@@ -0,0 +1,40 @@
+# -*- 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
+##
+#############################################################################
+
+
+app_widget_close = "appWidgetClose_"
+application_widget = "applicationWidget_"
+current_inFrame_Application = "currentInFrameApplication_"
+grid_delegate = "gridDelegate_"
+home_widget = "homeWidget_"
diff --git a/squishtests/suite_neptune3/shared/scripts/common/settings.py b/squishtests/suite_neptune3/shared/scripts/common/settings.py
new file mode 100644
index 00000000..4e732a86
--- /dev/null
+++ b/squishtests/suite_neptune3/shared/scripts/common/settings.py
@@ -0,0 +1,101 @@
+# -*- 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
+##
+#############################################################################
+
+
+G_WAIT_FOR_INEXISTANCE_MS = 1000
+
+G_WAIT_SYSTEM_READY_SEC = 1
+G_WAIT_SOME_STEPS_SEC = 1
+G_WAIT_SWITCH_APP_CONTEXT = 1
+
+G_AUT_MAIN = "neptune3-ui"
+G_AUT_REMOTE = "RemoteSettingsServer"
+G_AUT_APPMAN = "appman-launcher-qml"
+
+G_HOST = "localhost"
+
+# ToDo: put all this into a class in app.py
+G_NAME_ID = [['vehicle', 'com.luxoft.vehicle'],
+ ['map', 'com.pelagicore.map'],
+ ['tuner', 'com.pelagicore.tuner'],
+ ['hud', 'com.pelagicore.hud'],
+ ['settings', 'com.pelagicore.apps.settings'],
+ ['music', 'com.pelagicore.music'],
+ ['cluster', 'com.theqtcompany.cluster'],
+ ['appstore', 'com.pelagicore.appstore'],
+ ['phone', 'com.pelagicore.phone'],
+ ['calendar', 'com.pelagicore.calendar'],
+ ['climate', 'com.pelagicore.climate'],
+ ['sheets', 'com.pelagicore.sheets']]
+
+G_APP_MAIN = None
+G_APP_HANDLE = {'vehicle': None,
+ 'map': None,
+ 'tuner': None,
+ 'hud': None,
+ 'settings': None,
+ 'music': None,
+ 'cluster': None,
+ 'appstore': None,
+ 'phone': None,
+ 'calendar': None,
+ 'climate': None,
+ 'sheets': None}
+
+# according to squisPorts in info.yaml of each app
+G_APP_PORTS = {'vehicle': 7778,
+ 'map': 7784,
+ 'tuner': 7787,
+ 'settings': 7779,
+ 'music': 7785,
+ 'cluster': 7786,
+ 'appstore': 7780,
+ 'phone': 7786,
+ 'calendar': 7781,
+ 'climate': 7782,
+ 'sheets': 7786}
+
+
+SCREEN_WIDTH = 1920
+SCREEN_HEIGHT = 1080
+
+# Landscape is ambigous: can be either rotation of
+# 90 (pi) or 270 (3/4 pi) degrees
+SCREEN_LANDSCAPE = False
+
+# rotation yet unclear, what will be the reference system
+# (test in portrait I'd suggest)
+SCREEN_ROTATION = 0.0 # from 0 to 2pi is clockwise
+SCREEN_SHIFT_X_px = 0
+SCREEN_SHIFT_Y_px = 0
diff --git a/squishtests/suite_neptune3/shared/scripts/generate_sqlite.py b/squishtests/suite_neptune3/shared/scripts/generate_sqlite.py
index 12ee6806..e080f75c 100755
--- a/squishtests/suite_neptune3/shared/scripts/generate_sqlite.py
+++ b/squishtests/suite_neptune3/shared/scripts/generate_sqlite.py
@@ -15,7 +15,8 @@
## 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.
+## 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
diff --git a/squishtests/suite_neptune3/shared/scripts/names.py b/squishtests/suite_neptune3/shared/scripts/names.py
index 9e1f6cbd..f75338df 100644
--- a/squishtests/suite_neptune3/shared/scripts/names.py
+++ b/squishtests/suite_neptune3/shared/scripts/names.py
@@ -14,7 +14,8 @@
## 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.
+## 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
@@ -36,9 +37,8 @@ from objectmaphelper import *
o_QVariant = {"type": "QVariant"}
neptune_UI_Center_Console = {"title": "Neptune 3 UI - Center Console", "type": "QQuickWindowQmlImpl", "unnamed": 1, "visible": True}
neptune_UI_Center_Console_grid_GridView = {"container": neptune_UI_Center_Console, "id": "grid", "type": "GridView", "unnamed": 1, "visible": True}
-neptune_UI_Center_Console_leftTempSlider_TemperatureSlider = {"container": neptune_UI_Center_Console, "id": "leftTempSlider", "type": "TemperatureSlider", "unnamed": 1, "visible": True}
-neptune_UI_Center_Console_rightTempSlider_TemperatureSlider = {"container": neptune_UI_Center_Console, "id": "rightTempSlider", "type": "TemperatureSlider", "unnamed": 1, "visible": True}
neptune_UI_Instrument_Cluster_QQuickWindowQmlImpl = {"title": "Neptune 3 UI - Instrument Cluster", "type": "QQuickWindowQmlImpl", "unnamed": 1, "visible": True, "window": o_QVariant}
+grid_Item = {"container": neptune_UI_Center_Console_grid_GridView, "type": "Item", "unnamed": 1, "visible": True}
neptune_UI_Center_Console_widgetListview_ListView = {"container": neptune_UI_Center_Console, "id": "widgetListview", "type": "ListView", "unnamed": 1, "visible": True}
neptune_3_UI_Center_Console_volumePopupButton_ToolButton = {"container": neptune_UI_Center_Console, "objectName": "volumePopupButton", "type": "ToolButton", "visible": True}
neptune_3_UI_Center_Console_volumePopupItem_VolumePopup = {"container": neptune_UI_Center_Console, "objectName": "volumePopupItem", "type": "VolumePopup", "visible": True}
@@ -48,9 +48,17 @@ neptune_3_UI_Center_Console_centerConsole_CenterConsole = {"container": neptune_
neptune_3_UI_Center_Console_addWidgetButton_ToolButton = {"checkable": False, "container": neptune_UI_Center_Console, "objectName": "addWidgetButton", "type": "ToolButton", "visible": True}
neptune_3_UI_Center_Console_addWidgetPopupItem_AddWidgetPopup = {"container": neptune_UI_Center_Console, "objectName": "addWidgetPopupItem", "type": "AddWidgetPopup", "visible": True}
widgetList_AddWidgets_Maps = {"checkable": False, "container": neptune_UI_Center_Console_widgetListview_ListView, "objectName": "itemAddWidget_com.pelagicore.map", "text": "Maps", "type": "ListItem", "visible": True}
-neptune_3_UI_Center_Console_homeWidget_Maps_Column = {"container": neptune_UI_Center_Console, "objectName": "homeWidget_com.pelagicore.map", "type": "Column", "visible": True}
-good_appMainMenu_WidgetClose_Map_MouseArea = {"container": neptune_UI_Center_Console, "objectName": "appWidgetClose_com.pelagicore.map", "type": "MouseArea", "visible": True}
neptune_3_UI_Center_Console_launcherCenterConsole_Launcher = {"container": neptune_UI_Center_Console, "objectName": "launcher", "type": "Launcher", "visible": True}
neptune_3_UI_Center_Console_gridButton_ToolButton = {"checkable": True, "container": neptune_UI_Center_Console, "objectName": "gridButton", "type": "ToolButton", "visible": True}
-neptune_3_UI_Center_Console_climateBarMouseArea_MouseArea = {"container": neptune_UI_Center_Console, "objectName": "climateBarMouseArea", "type": "MouseArea", "visible": True}
neptune_3_UI_Center_Console_editableLauncher_EditableGridView = {"container": neptune_UI_Center_Console, "objectName": "editableLauncher", "type": "EditableGridView", "visible": True}
+neptune_3_UI_Center_Console_activeApplicationSlot_Item = {"container": neptune_UI_Center_Console, "objectName": "activeApplicationSlot", "type": "Item", "visible": True}
+
+neptune_3_UI_Instrument_Cluster_QQuickWindowQmlImpl = {"title": "Neptune 3 UI - Instrument Cluster", "type": "QQuickWindowQmlImpl", "unnamed": 1, "visible": True}
+o_QtAM_ApplicationManagerWindow = {"type": "QtAM::ApplicationManagerWindow", "unnamed": 1, "visible": True}
+climateAreaMouseArea_MouseArea = {"container": o_QtAM_ApplicationManagerWindow, "objectName": "climateAreaMouseArea", "type": "MouseArea", "visible": True}
+leftTempSlider_TemperatureSlider = {"container": o_QtAM_ApplicationManagerWindow, "objectName": "leftTempSlider", "type": "TemperatureSlider", "visible": True}
+rightTempSlider_TemperatureSlider = {"container": o_QtAM_ApplicationManagerWindow, "objectName": "rightTempSlider", "type": "TemperatureSlider", "visible": True}
+o_ClimateView = {"container": o_QtAM_ApplicationManagerWindow, "type": "ClimateView", "unnamed": 1, "visible": True}
+o_QtAM_ApplicationManagerWindow_2 = {"type": "QtAM::ApplicationManagerWindow", "unnamed": 1, "visible": False}
+auto_Button = {"checkable": True, "container": o_QtAM_ApplicationManagerWindow_2, "id": "bigFatButton", "text": "Auto", "type": "Button", "unnamed": 1, "visible": True}
+neptune_3_UI_Center_Console_widgetGrid_homepage_WidgetGrid = {"container": neptune_UI_Center_Console, "objectName": "widgetGrid_homepage", "type": "WidgetGrid", "visible": True}
diff --git a/squishtests/suite_neptune3/shared/steps/essential.py b/squishtests/suite_neptune3/shared/steps/essential.py
index 27099f13..5464a59e 100644
--- a/squishtests/suite_neptune3/shared/steps/essential.py
+++ b/squishtests/suite_neptune3/shared/steps/essential.py
@@ -14,7 +14,8 @@
## 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.
+## 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
@@ -32,99 +33,135 @@
#############################################################################
import names
+import common.settings as settings # some test setting vars
+import common.app as app
# coordinate
-from math import sin,cos,floor
+from math import sin, cos, floor
-G_WAIT_FOR_INEXISTANCE_MS = 1000
-# waiting time for system to get ready between test scenarios todo: change somehow and distinguish between scenario and test, since no instance will appear
-G_WAIT_SYSTEM_READY_SEC = 1
+def coord_up_px(in_pix):
+ up = QPoint(0, -in_pix)
+ transf = coord_transform2DReal(up)
+ return transf
-SCREEN_WIDTH = 1920
-SCREEN_HEIGHT = 1080
-# Landscape is ambigous: can be either rotation of 90 (pi) or 270 (3/4 pi) degrees
-# rotation yet unclear, what will be the reference system (test in portrait I'd suggest)
-SCREEN_LANDSCAPE = False
-SCREEN_ROTATION = 0.0 # from 0 to 2pi is clockwise
-SCREEN_SHIFT_X_px = 0
-SCREEN_SHIFT_Y_px = 0
+def coord_down_px(in_pix):
+ return coord_up_px(-in_pix)
+
+
+def coord_right_px(in_pix):
+ right = QPoint(in_pix, 0)
+ transf = coord_transform2DReal(right)
+ return transf
+
+
+def coord_left_px(in_pix):
+ return coord_right_px(-in_pix)
+
+
+def coord_addQPoints(a, b):
+ return QPoint(a.x + b.x, a.y + b.y)
+
+
+def coord_transform2DReal(src_point):
+ ti = QPoint(src_point.x, src_point.y)
+ if settings.SCREEN_LANDSCAPE:
+ ti.x = -src_point.x
+ ti.y = src_point.y
+ return ti
def coord_transform2D(src_point):
- global G_WAIT_SYSTEM_READY_SEC # todo: put somewhere else
- ti = QPoint(0,0)
+ ti = QPoint(0, 0)
rotation = float(0)
- if not SCREEN_LANDSCAPE:
- rotation = Math.pi * 0.75
- # I misuse it to distinguish between target and test development
- G_WAIT_SYSTEM_READY_SEC = 3
+ if settings.SCREEN_LANDSCAPE:
+ rotation = math.pi * 0.75
- scale_x = float(SCREEN_WIDTH * 0.01)
- scale_y = float(SCREEN_HEIGHT * 0.01)
+ scale_x = float(settings.SCREEN_WIDTH * 0.01)
+ scale_y = float(settings.SCREEN_HEIGHT * 0.01)
r_sin_rho = sin(rotation)
r_cos_rho = cos(rotation)
# not fully tested!!!!
- tx = float((r_cos_rho * src_point.x * scale_x) - (r_sin_rho * src_point.y * scale_y))
- ty = float((r_sin_rho * src_point.x * scale_x) + (r_cos_rho * src_point.y * scale_y))
+ tx = float((r_cos_rho * src_point.x * scale_x)
+ - (r_sin_rho * src_point.y * scale_y))
+ ty = float((r_sin_rho * src_point.x * scale_x)
+ + (r_cos_rho * src_point.y * scale_y))
# do a geometric translation (after so no rotation in a point)
- ti.x = floor(tx) + SCREEN_SHIFT_X_px
- ti.y = floor(ty) + SCREEN_SHIFT_Y_px
+ ti.x = floor(tx) + settings.SCREEN_SHIFT_X_px
+ ti.y = floor(ty) + settings.SCREEN_SHIFT_Y_px
return ti
@Given("main menu is open")
def step(context):
- snooze(G_WAIT_SYSTEM_READY_SEC)
- test.compare(True,True)
+ snooze(settings.G_WAIT_SYSTEM_READY_SEC)
+ test.compare(True, True, "Main menu is open... still fake")
+
@Given("main menu is focused")
def step(context):
worked, _obj = focus_window("console")
test.compare(True, worked)
-# a dummy
+
@When("nothing")
def step(context):
- test.compare(True,True)
+ test.compare(True, True)
+
-# a dummy
@Given("nothing")
def step(context):
pass
-# a dummy
+
@Then("nothing")
def step(context):
pass
+
@Then("after some '|integer|' seconds")
-def step(context,seconds):
+def step(context, seconds):
snooze(seconds)
+
@When("after some '|integer|' seconds")
-def step(context,seconds):
+def step(context, seconds):
snooze(seconds)
# --------------------- specific not yet clear, where to put it
-@When("the popup close button is clicked")
-def step(context):
+def click_popup_close(context):
popup_close_button = waitForObject(names.neptune_3_UI_Center_Console_popupClose_ToolButton)
mouseClick(popup_close_button)
+ is_still_there = is_squish_object_there(popup_close_button, 1)
+ test.compare(True, not is_still_there, "popup should be closed by now")
+
+
+@Then("click the popup close button")
+def step(context):
+ # this button exists only in main app
+ app.switch_to_main_app()
+
+ click_popup_close(context)
+
+
+@When("the popup close button is clicked")
+def step(context):
+ click_popup_close(context)
+
-def is_squish_object_there(squish_object,seconds):
+def is_squish_object_there(object, seconds):
snooze(seconds)
+ is_there = True
try:
- waitForObjectExists(squish_object,G_WAIT_FOR_INEXISTANCE_MS)
+ waitForObjectExists(object, settings.G_WAIT_FOR_INEXISTANCE_MS)
except Exception:
- return False
- else:
- return True
+ is_there = False
+ return is_there
# -------------------------------------------------------
diff --git a/squishtests/suite_neptune3/shared/steps/steps.py b/squishtests/suite_neptune3/shared/steps/steps.py
index 31abf081..9aa30b04 100644
--- a/squishtests/suite_neptune3/shared/steps/steps.py
+++ b/squishtests/suite_neptune3/shared/steps/steps.py
@@ -14,7 +14,8 @@
## 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.
+## 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
diff --git a/squishtests/suite_neptune3/suite.conf b/squishtests/suite_neptune3/suite.conf
index beb85675..96d854f6 100644
--- a/squishtests/suite_neptune3/suite.conf
+++ b/squishtests/suite_neptune3/suite.conf
@@ -1,11 +1,11 @@
AUT=
CWD=<AUT_path>
ENVVARS=envvars
-HOOK_SUB_PROCESSES=false
+HOOK_SUB_PROCESSES=true
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAP=./shared/objects.map
OBJECTMAPSTYLE=script
-TEST_CASES=tst_environment_info tst_main_menu_widgets tst_popup_menus tst_volume_popup tst_launch_bar
+TEST_CASES=tst_environment_info tst_main_menu_widgets tst_popup_menus tst_volume_popup tst_launch_bar tst_app_common
VERSION=3
WRAPPERS=Qt
diff --git a/squishtests/suite_neptune3/templates/README.md b/squishtests/suite_neptune3/templates/README.md
new file mode 100644
index 00000000..1fd44127
--- /dev/null
+++ b/squishtests/suite_neptune3/templates/README.md
@@ -0,0 +1,6 @@
+# This is a template for a new test case
+
+Following https://doc.froglogic.com/squish/latest/rg-templates.html
+* Choose template dir to be set to here, to use it.
+Do 'Edit' -> 'Preferences' -> 'Squish' -> 'TestCreating', and changed it here.
+* It can be imported via ctrl+n and "Squish test case from Template".
diff --git a/squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/steps/concrete_test.py b/squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/steps/concrete_test.py
new file mode 100644
index 00000000..2da89c2b
--- /dev/null
+++ b/squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/steps/concrete_test.py
@@ -0,0 +1,33 @@
+# -*- 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
+##
+############################################################################
diff --git a/squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/test.feature b/squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/test.feature
new file mode 100644
index 00000000..be99f387
--- /dev/null
+++ b/squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/test.feature
@@ -0,0 +1,15 @@
+Feature: A feature description of what the following tests shall cover
+
+ Some textual description of the business value of this feature goes
+ here. The text is free-form.
+
+ The description can span multiple paragraphs.
+
+ Scenario: A qt automotive test case scenario
+
+ Given some precondition is met
+ And another precondition
+ When some action is performed
+ Then the results should be as expected
+ And some other testable outcome is achieved
+
diff --git a/squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/test.py b/squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/test.py
new file mode 100644
index 00000000..8eb355da
--- /dev/null
+++ b/squishtests/suite_neptune3/templates/test_case/tst_qtautomotive_case_to_clone_from/test.py
@@ -0,0 +1,44 @@
+# -*- 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
+##
+############################################################################
+
+source(findFile('scripts', 'python/bdd.py'))
+source(findFile('scripts', '../shared/scripts/common/__init__.py'))
+
+setupHooks('../shared/scripts/bdd_hooks.py')
+collectStepDefinitions('./steps', '../shared/steps')
+
+
+def main():
+ testSettings.throwOnFailure = True
+ runFeatureFile('test.feature')
diff --git a/squishtests/suite_neptune3/tst_app_common/steps/app_settings.py b/squishtests/suite_neptune3/tst_app_common/steps/app_settings.py
new file mode 100644
index 00000000..8de4472a
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_app_common/steps/app_settings.py
@@ -0,0 +1,106 @@
+# -*- 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 common.qml_names as qml
+
+# squish dependent
+import names
+
+
+@OnFeatureStart
+def hook(context):
+ start_neptune_ui_app_w_focus("console")
+
+
+@Given("'|word|' app from launcher tapped")
+def step(context, app_name):
+ if not context.userData:
+ context.userData = {}
+
+ found, app_idname = app.get_app_id(app_name)
+
+ if found:
+ object_name = qml.grid_delegate + app_idname
+ grid_view = waitForObject(
+ names.neptune_UI_Center_Console_grid_GridView)
+
+ app_pointer = find_object_name_recursively(grid_view, object_name, 3)
+
+ if app_pointer:
+ if app_pointer.visible:
+ tapObject(app_pointer)
+ else:
+ test.fail("'" + app_name + "' is there but not visible.")
+ else:
+ test.fail("'" + app_name + "' could not be found!")
+
+
+@Then("wait '|integer|' seconds and '|word|' app is active")
+def step(context, wait_sec, app_name):
+ if not context.userData:
+ context.userData = {}
+
+ # MUST switch to main app
+ app.switch_to_main_app()
+
+ # wait a small while to let it open
+ snooze(wait_sec)
+
+ found, app_idname = app.get_app_id(app_name)
+
+ if found:
+ object_name = qml.current_inFrame_Application + app_idname
+ active_app_slot = waitForObject(
+ names.neptune_3_UI_Center_Console_activeApplicationSlot_Item)
+
+ # 1st: look for "inFrameApplication"
+ app_pointer = find_object_name_recursively(active_app_slot,
+ object_name, 3)
+ if app_pointer is not None:
+ my_numnber = app_pointer.children.count
+ test.log("-_" + str(my_numnber))
+ test.compare(True, app_pointer.visible, "should be visible!")
+ else:
+ # 2nd try: look for "application_widget"
+ test.log("'" + app_idname + "' as inFrameApp not found,"
+ + " trying as applicationWidget")
+ object_name = qml.application_widget + app_idname
+ app_pointer = find_object_name_recursively(active_app_slot,
+ object_name, 3)
+ if app_pointer is not None:
+ test.compare(True, app_pointer.visible, " should be visible!")
+ else:
+ test.fail("'" + app_name + "' app is not known!!")
+ else:
+ test.fail("'" + app_name + "' app is not known!!")
diff --git a/squishtests/suite_neptune3/tst_app_common/test.feature b/squishtests/suite_neptune3/tst_app_common/test.feature
new file mode 100644
index 00000000..30735614
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_app_common/test.feature
@@ -0,0 +1,14 @@
+Feature: Test common app functionality
+
+ Test some common app functionalities
+ available from the main screen.
+
+ Scenario Outline: Open settings app from launcher bar
+ Given main menu is open
+ And '<launcher apps>' app from launcher tapped
+ Then wait '2' seconds and '<launcher apps>' app is active
+
+ Examples:
+ | launcher apps |
+ | settings |
+ | calendar |
diff --git a/squishtests/suite_neptune3/tst_app_common/test.py b/squishtests/suite_neptune3/tst_app_common/test.py
new file mode 100644
index 00000000..f0c00bcc
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_app_common/test.py
@@ -0,0 +1,43 @@
+# -*- 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
+##
+############################################################################
+source(findFile('scripts', 'python/bdd.py'))
+source(findFile('scripts', '../shared/scripts/common/__init__.py'))
+
+setupHooks('../shared/scripts/bdd_hooks.py')
+collectStepDefinitions('./steps', '../shared/steps')
+
+
+def main():
+ testSettings.throwOnFailure = True
+ runFeatureFile('test.feature')
diff --git a/squishtests/suite_neptune3/tst_environment_info/steps/environment.py b/squishtests/suite_neptune3/tst_environment_info/steps/environment.py
index 558f13d6..8c3ef879 100644
--- a/squishtests/suite_neptune3/tst_environment_info/steps/environment.py
+++ b/squishtests/suite_neptune3/tst_environment_info/steps/environment.py
@@ -14,7 +14,8 @@
## 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.
+## 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
@@ -34,10 +35,10 @@
import os
import sys
+
@OnFeatureStart
def hook(context):
pass
- #start_neptune_ui_app_w_focus("console")
@Then("return python info")
@@ -57,7 +58,6 @@ def step(context):
for el in sys.path:
test.log(" '" + str(el) + "'")
-
test.log(" 'sys.path_importer_cache' is:")
for el in sys.path_importer_cache:
test.log(" '" + str(el) + "'")
@@ -65,13 +65,11 @@ def step(context):
test.log(" 'sys.path_hooks' are:")
for el in sys.path_hooks:
try:
- test.log(" '" + str(el)+ "'")
+ test.log(" '" + str(el) + "'")
except ImportError as e:
test.log(str(e))
-
-
'''
Reads the given environment variable provided.
If the 2nd argument is
@@ -83,12 +81,13 @@ def step(context):
https://stackoverflow.com/questions/4906977/how-do-i-access-environment-variables-from-python
'''
@Given("show the environment var '|word|' which might be '|word|'")
-def step(context,path,state):
+def step(context, path, state):
try:
os_path = os.environ.get(path)
#os_path = os.getenv(path)
except KeyError as e:
- test.fail(str(e) + " but needs to be in the list here: " + str(os.environ))
+ test.fail(str(e) + " but needs to be in the list here: "
+ + str(os.environ))
else:
if state == 'set':
if os_path:
@@ -97,7 +96,8 @@ def step(context,path,state):
test.fail("Bad '" + path + "' it is not set!")
elif state == 'empty':
if os_path:
- test.fail("Bad '" + path + "' is '" + str(os_path) + "' but should not be empty!")
+ test.fail("Bad '" + path + "' is '" + str(os_path)
+ + "' but should not be empty!")
else:
test.log("Good '" + path + "' is not set!")
elif state == 'info':
@@ -106,4 +106,5 @@ def step(context,path,state):
if os_path == state:
test.log("Good '" + path + "' it is '" + str(os_path) + "'!")
else:
- test.fail("Bad '" + path + "' it is '" + str(os_path) + "' instead of '" + state + "'!")
+ test.fail("Bad '" + path + "' it is '" + str(os_path)
+ + "' instead of '" + state + "'!")
diff --git a/squishtests/suite_neptune3/tst_environment_info/test.feature b/squishtests/suite_neptune3/tst_environment_info/test.feature
index 4a571ea8..6dc4208a 100644
--- a/squishtests/suite_neptune3/tst_environment_info/test.feature
+++ b/squishtests/suite_neptune3/tst_environment_info/test.feature
@@ -26,7 +26,7 @@ Feature: A small introspection into the testing environment
| QT_IM_MODULE | info |
| LD_LIBRARY_PATH | set |
| PATH | set |
- | SQUISH_PREFIX | info |
+ | PREFIX | info |
| SQUISHRUNNER_PORT | info |
| LC_ADDRESS | info |
| LC_NAME | info |
diff --git a/squishtests/suite_neptune3/tst_environment_info/test.py b/squishtests/suite_neptune3/tst_environment_info/test.py
index 07c9da36..ef8c8127 100644
--- a/squishtests/suite_neptune3/tst_environment_info/test.py
+++ b/squishtests/suite_neptune3/tst_environment_info/test.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
############################################################################
##
## Copyright (C) 2018 Luxoft GmbH
@@ -12,7 +14,8 @@
## 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.
+## 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
@@ -30,10 +33,12 @@
#############################################################################
source(findFile('scripts', 'python/bdd.py'))
+source(findFile('scripts', '../shared/scripts/common/__init__.py'))
setupHooks('../shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps')
+
def main():
testSettings.throwOnFailure = True
runFeatureFile('test.feature')
diff --git a/squishtests/suite_neptune3/tst_launch_bar/steps/launch_bar.py b/squishtests/suite_neptune3/tst_launch_bar/steps/launch_bar.py
index 36dadb2c..9adb1e33 100644
--- a/squishtests/suite_neptune3/tst_launch_bar/steps/launch_bar.py
+++ b/squishtests/suite_neptune3/tst_launch_bar/steps/launch_bar.py
@@ -14,7 +14,8 @@
## 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.
+## 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
@@ -31,24 +32,167 @@
##
#############################################################################
+import common.app as app # find id, get context
+import common.settings as settings # settings
+import common.qml_names as qml
+
import names
+import __builtin__
@OnFeatureStart
def hook(context):
start_neptune_ui_app_w_focus("console")
+
@Given("the launch bar is shown")
def step(context):
- test.compare(waitForObjectExists(names.neptune_3_UI_Center_Console_launcherCenterConsole_Launcher).enabled, True)
- test.compare(waitForObjectExists(names.neptune_3_UI_Center_Console_launcherCenterConsole_Launcher).visible, True)
+ test.compare(waitForObjectExists(names.neptune_3_UI_Center_Console_launcherCenterConsole_Launcher).enabled
+ , True, "launch bar exists")
+ test.compare(waitForObjectExists(names.neptune_3_UI_Center_Console_launcherCenterConsole_Launcher).visible
+ , True, "launch bar is visible")
+
-@When("the grid icon is clicked")
+@When("the grid icon is tapped")
def step(context):
grid_button = waitForObject(names.neptune_3_UI_Center_Console_gridButton_ToolButton)
- mouseClick(grid_button)
+ tapObject(grid_button)
+
@Then("the grid should be '|word|'")
-def step(context,string_open):
+def step(context, string_open):
open_status = string_open == 'opened'
- test.compare(waitForObjectExists(names.neptune_3_UI_Center_Console_editableLauncher_EditableGridView).gridOpen, open_status)
+ test.compare(waitForObjectExists(names.neptune_3_UI_Center_Console_editableLauncher_EditableGridView).gridOpen
+ , open_status
+ , "open status shall be open" if open_status else "open status shall be closed")
+
+
+@When("grid item '|word|' is tabbed and move index '|integer|' up and '|integer|' right")
+def step(context, app_name, delta_up, delta_right):
+ if not context.userData:
+ context.userData = {}
+
+ found, app_idname = app.get_app_id(app_name)
+
+ if found:
+ object_name = qml.grid_delegate + app_idname
+ grid_view = waitForObject(names.neptune_UI_Center_Console_grid_GridView)
+
+ object_pointer = find_object_name_recursively(grid_view, object_name, 3)
+
+ if object_pointer is not None:
+ if object_pointer.visible:
+ grid_index = object_pointer.visualIndex
+
+ grid_width = __builtin__.int(object_pointer.width)
+ grid_height = __builtin__.int(object_pointer.height)
+
+ # 0.8 is because of better grab/press of a tile
+ delta_int_up = __builtin__.int(delta_up) * 0.8
+ delta_int_right = __builtin__.int(delta_right) * 0.8
+
+ test.log("found '" + app_idname + "' at index: " + str(grid_index))
+ test.log("is landscape" if settings.SCREEN_LANDSCAPE else "is not landscape")
+ app_index_string = 'launcher_grid_visible_"' + app_name + '_index'
+ context.userData[app_index_string] = grid_index
+
+ mid_x = __builtin__.int(grid_width * 0.5)
+ mid_y = __builtin__.int(grid_height * 0.5)
+ mousePress(object_pointer, mid_x, mid_y, MouseButton.LeftButton)
+
+ _good, sp = get_position_item(object_pointer)
+ test.log("Midth of it : " + str(sp.x) + "," + str(sp.y))
+
+ # wait for long press
+ snooze(3.5)
+
+ # in real coordinates, up right is different
+ coord_move_up = __builtin__.int(grid_height * delta_int_up) # coord_up_px(grid_height * delta_int_up)
+ coord_move_right = __builtin__.int(grid_width * delta_int_right) # coord_right_px(grid_width * delta_int_right)
+ #coord_move = coord_addQPoints(coord_move_up,coord_move_right)
+
+ #test.log("coord up : " + str(coord_move_up.x) + "," +str(-coord_move_up.y))
+ #test.log("coord right: " + str(coord_move_right.x) + "," +str(-coord_move_right.y))
+
+ # sorry, squish has a very uncommon coordinate system
+
+ mouseMove(object_pointer, -coord_move_right, coord_move_up)
+
+ #test.log("coord: " + str(-coord_move.x) + "," + str(-coord_move.y))
+
+ mouseRelease(object_pointer)
+ snooze(5)
+ else:
+ test.fail("'" + object_name + "' found but not visible!")
+ else:
+ test.log("could not find object '" + object_name + "' in grid!!!")
+ else:
+ test.fail("that app is not known")
+
+
+@When("the '|word|' app index has increased by '|integer|'")
+def step(context, app_name, index_diff):
+ if not context.userData:
+ context.userData = {}
+ found, app_idname = app.get_app_id(app_name)
+
+ if found:
+ object_name = qml.grid_delegate + app_idname
+ grid_view = waitForObject(names.neptune_UI_Center_Console_grid_GridView)
+
+ object_pointer = find_object_name_recursively(grid_view, object_name, 3)
+
+ if object_pointer:
+ app_index_string = 'launcher_grid_visible_"' + app_name + '_index'
+ old_index = context.userData[app_index_string]
+ ## if
+ new_index = object_pointer.visualIndex
+ test.compare(new_index, old_index + index_diff, "index from '"
+ + app_name + "' should change by "
+ + str(index_diff) + " from " + str(old_index)
+ + " to " + str(old_index + index_diff)
+ + ", it is " + str(new_index))
+ else:
+ test.fail("'" + app_name + "' app is known but could not be found!")
+ else:
+ test.fail("'" + app_name + "' app is not known!")
+
+
+@Given("memorize visible launchers index")
+def step(context):
+ if not context.userData:
+ context.userData = {}
+
+ # search in grid
+ grid_view = waitForObject(names.neptune_UI_Center_Console_grid_GridView)
+
+ for name, value in settings.G_NAME_ID:
+ object_name = qml.grid_delegate + value
+
+ check_app = find_object_name_recursively(grid_view, object_name, 3)
+ if check_app is not None:
+ found_idx = check_app.visualIndex
+ app_index_string = 'launcher_grid_visible_"' + name + '_index'
+ context.userData[app_index_string] = found_idx
+
+
+@Then("visible launcher of '|word|' should have changed to index '|integer|'")
+def step(context, app_name, index):
+ if not context.userData:
+ context.userData = {}
+
+ app_index_string = 'launcher_grid_visible_"' + app_name + '_index'
+ app_idx = context.userData[app_index_string]
+
+ # search in grid
+ grid_view = waitForObject(names.neptune_UI_Center_Console_grid_GridView)
+
+ found, app_idname = app.get_app_id(app_name)
+ object_name = qml.grid_delegate + app_idname
+ if found:
+ check_app = find_object_name_recursively(grid_view, object_name, 3)
+ if check_app is not None:
+ found_idx = check_app.visualIndex
+ test.compare(found_idx, index, "shall have same index, had " + str(app_idx) + ".")
+ else:
+ test.fail("'" + app_idname + "' not found!!")
diff --git a/squishtests/suite_neptune3/tst_launch_bar/test.feature b/squishtests/suite_neptune3/tst_launch_bar/test.feature
index 4e288044..5c67ae9b 100644
--- a/squishtests/suite_neptune3/tst_launch_bar/test.feature
+++ b/squishtests/suite_neptune3/tst_launch_bar/test.feature
@@ -1,20 +1,45 @@
Feature: The launch bar is configurable
- The launch is highly configurable.
+ The launch bar is highly configurable.
Sorted in a natural way the first items are
- visible, later icons are only visible in the
- grid, which is one of the items.
+ visible.
In the grid it is possible by drag and drop to
move the items and change the order
-
Scenario: Open the grid
Given main menu is open
And the launch bar is shown
- When the grid icon is clicked
+ When the grid icon is tapped
Then the grid should be 'opened'
- When the grid icon is clicked
+ When the grid icon is tapped
Then the grid should be 'closed'
+
+ Scenario Outline: Change order of several launcher icons in launcher grid
+
+ Given main menu is open
+ And the launch bar is shown
+ When the grid icon is tapped
+ Then the grid should be 'opened'
+ When grid item '<launcher apps>' is tabbed and move index '<up>' up and '<right>' right
+ And the '<launcher apps>' app index has increased by '<increase>'
+ And the grid icon is tapped
+
+ Examples:
+ | launcher apps | up | right | increase |
+ | music | 0 | 1 | 1 |
+# | map | 0 | 1 | 1 |
+# | phone | 0 | 1 | 1 |
+# | vehicle | 0 | 1 | 1 |
+# | settings | 0 | 1 | 1 |
+
+ Scenario: Test if launcher order in launcher bar changes due to edits
+
+ Given main menu is open
+ And memorize visible launchers index
+ When the grid icon is tapped
+ And grid item 'vehicle' is tabbed and move index '0' up and '1' right
+ And the grid icon is tapped
+ Then visible launcher of 'vehicle' should have changed to index '1'
diff --git a/squishtests/suite_neptune3/tst_launch_bar/test.py b/squishtests/suite_neptune3/tst_launch_bar/test.py
index 07c9da36..ef8c8127 100644
--- a/squishtests/suite_neptune3/tst_launch_bar/test.py
+++ b/squishtests/suite_neptune3/tst_launch_bar/test.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
############################################################################
##
## Copyright (C) 2018 Luxoft GmbH
@@ -12,7 +14,8 @@
## 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.
+## 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
@@ -30,10 +33,12 @@
#############################################################################
source(findFile('scripts', 'python/bdd.py'))
+source(findFile('scripts', '../shared/scripts/common/__init__.py'))
setupHooks('../shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps')
+
def main():
testSettings.throwOnFailure = True
runFeatureFile('test.feature')
diff --git a/squishtests/suite_neptune3/tst_main_menu_widgets/steps/widget_operations.py b/squishtests/suite_neptune3/tst_main_menu_widgets/steps/widget_operations.py
index ac2c2b0e..099abae3 100644
--- a/squishtests/suite_neptune3/tst_main_menu_widgets/steps/widget_operations.py
+++ b/squishtests/suite_neptune3/tst_main_menu_widgets/steps/widget_operations.py
@@ -14,7 +14,8 @@
## 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.
+## 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
@@ -31,6 +32,12 @@
##
#############################################################################
+
+import common.settings as settings
+import common.app as app
+import common.qml_names as qml
+
+# squish dependent
import names
@@ -39,46 +46,100 @@ def hook(context):
start_neptune_ui_app_w_focus("console")
+def find_homeWidgetGrid_app(app_name):
+ """helper function"""
+ good = False
+ result = None
+
+ found, app_idname = app.get_app_id(app_name)
+
+ if found:
+ object_name = qml.home_widget + app_idname
+ grid_view = waitForObject(
+ names.neptune_3_UI_Center_Console_widgetGrid_homepage_WidgetGrid)
+
+ grid_entry = find_object_name_recursively(grid_view, object_name, 3)
+
+ if grid_entry is not None:
+ good = True
+ result = grid_entry
+ return good, (result, app_idname)
+
+
@Then("add widget was tapped")
def step(context):
tapObject(waitForObject(names.neptune_3_UI_Center_Console_addWidgetButton_ToolButton))
+
@Then("the new widget dialogue appeared")
def step(context):
test.compare(waitForObjectExists(names.neptune_3_UI_Center_Console_addWidgetPopupItem_AddWidgetPopup).enabled, True)
test.compare(waitForObjectExists(names.neptune_3_UI_Center_Console_addWidgetPopupItem_AddWidgetPopup).visible, True)
+
@Then("the add widget popup should not be there after '|integer|' seconds of closing animation")
-def step(context,seconds):
+def step(context, seconds):
snooze(seconds)
addWidget_popup = names.neptune_3_UI_Center_Console_addWidgetPopupItem_AddWidgetPopup
# test.compare(volume_popup.exists) something funny??
try:
- waitForObjectExists(addWidget_popup,G_WAIT_FOR_INEXISTANCE_MS)
+ waitForObjectExists(addWidget_popup, settings.G_WAIT_FOR_INEXISTANCE_MS)
except Exception:
- test.compare(True,True,"add widget popup closed!")
+ test.compare(True, True, "add widget popup closed!")
else:
- test.compare(True,False," add widget popup is still there!")
+ test.compare(True, False, "add widget popup is still there!")
+
+
+@Then("the '|word|' widget is visible in the home screen")
+def step(context, app_name):
+ good, result = find_homeWidgetGrid_app(app_name)
+ if good:
+ widget, _id = result
+ test.compare(widget.enabled, True)
+ test.compare(widget.visible, True)
+ else:
+ test.fail("grid widget item of '" + app_name + "' not found!")
-@Then("the maps widget is visible in the home screen")
-def step(context):
- test.compare(waitForObjectExists(names.neptune_3_UI_Center_Console_homeWidget_Maps_Column).enabled, True)
- test.compare(waitForObjectExists(names.neptune_3_UI_Center_Console_homeWidget_Maps_Column).visible, True)
@When("add map is tapped")
def step(context):
addWidgetItem_maps = waitForObject(names.widgetList_AddWidgets_Maps)
tapObject(addWidgetItem_maps)
-@When("tapping to remove the map widget")
-def step(context):
- closeWidgetItem_maps = waitForObject(names.good_appMainMenu_WidgetClose_Map_MouseArea)
- tapObject(closeWidgetItem_maps)
-
-@Then("the maps widget disappeared in the home screen after '|integer|' seconds of animation")
-def step(context,seconds):
- exists = is_squish_object_there(names.neptune_3_UI_Center_Console_homeWidget_Maps_Column,seconds)
- if exists:
- test.compare(True,False," volume popup is still there!")
+
+@Then("tapping close '|word|' widget")
+def step(context, app_name):
+ # update context, because map is now if not before loaded
+ squish.snooze(1)
+ app.update_all_contexts()
+
+ # must switch to main_app
+ app.switch_to_main_app()
+
+ found, result = find_homeWidgetGrid_app(app_name)
+ if found:
+ grid_entry, app_idname = result
+ close_name = qml.app_widget_close + app_idname
+ close_obj = find_object_name_recursively(grid_entry, close_name, 3)
+
+ if close_obj is not None and close_obj.visible:
+ tapObject(close_obj)
+
+
+@Then("the '|word|' widget disappeared in the home screen after '|integer|' seconds of animation")
+def step(context, app_name, seconds):
+ squish.snooze(seconds)
+ found, result = find_homeWidgetGrid_app(app_name)
+ if found:
+ grid_entry, _id = result
+ try:
+ is_enabled = grid_entry.enabled
+ is_visible = grid_entry.visible
+ except Exception as e:
+ test.fail("Something strange with the grid object: " + str(e))
+ else:
+ test.compare(False, not is_enabled or not is_visible,
+ "'" + app_name + "' widget not enabled or visible!")
else:
- test.compare(True,True,"volume popup closed!")
+ test.compare(True, True,
+ "'" + app_name + "' widget closed!")
diff --git a/squishtests/suite_neptune3/tst_main_menu_widgets/test.feature b/squishtests/suite_neptune3/tst_main_menu_widgets/test.feature
index 8ef8fd67..1d53deec 100644
--- a/squishtests/suite_neptune3/tst_main_menu_widgets/test.feature
+++ b/squishtests/suite_neptune3/tst_main_menu_widgets/test.feature
@@ -17,11 +17,7 @@ Feature: Main menu widget changes
Then add widget was tapped
And the new widget dialogue appeared
When add map is tapped
- Then the maps widget is visible in the home screen
+ Then the 'map' widget is visible in the home screen
+ And tapping close 'map' widget
+ And the 'map' widget disappeared in the home screen after '1' seconds of animation
- Scenario: Remove map widget
-
- Given main menu is open
- Then the maps widget is visible in the home screen
- When tapping to remove the map widget
- Then the maps widget disappeared in the home screen after '1' seconds of animation
diff --git a/squishtests/suite_neptune3/tst_main_menu_widgets/test.py b/squishtests/suite_neptune3/tst_main_menu_widgets/test.py
index 07c9da36..ef8c8127 100644
--- a/squishtests/suite_neptune3/tst_main_menu_widgets/test.py
+++ b/squishtests/suite_neptune3/tst_main_menu_widgets/test.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
############################################################################
##
## Copyright (C) 2018 Luxoft GmbH
@@ -12,7 +14,8 @@
## 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.
+## 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
@@ -30,10 +33,12 @@
#############################################################################
source(findFile('scripts', 'python/bdd.py'))
+source(findFile('scripts', '../shared/scripts/common/__init__.py'))
setupHooks('../shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps')
+
def main():
testSettings.throwOnFailure = True
runFeatureFile('test.feature')
diff --git a/squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py b/squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py
index 4a65d4f3..787ab097 100644
--- a/squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py
+++ b/squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py
@@ -14,7 +14,8 @@
## 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.
+## 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
@@ -31,6 +32,10 @@
##
#############################################################################
+import common.app as app # to switch context
+import common.settings as settings # waiting duration
+
+# squish
import names
@@ -39,63 +44,75 @@ def hook(context):
start_neptune_ui_app_w_focus("console")
-
-def get_left_temperature_slider_Value():
- return waitForObjectExists(names.neptune_UI_Center_Console_leftTempSlider_TemperatureSlider).value
-
-def get_right_temperature_slider_Value():
- return waitForObjectExists(names.neptune_UI_Center_Console_rightTempSlider_TemperatureSlider).value
-
-
@Given("the climate area is tapped")
def step(context):
- climateMouseArea = waitForObjectExists(names.neptune_3_UI_Center_Console_climateBarMouseArea_MouseArea)
- tapObject(climateMouseArea)
+ app.switch_to_app('climate')
+ climateMouseArea = squish.waitForObjectExists(
+ names.climateAreaMouseArea_MouseArea)
+ squish.tapObject(climateMouseArea)
-
-@When("the left climate slider is moved downwards")
-def step(context):
+@When("the '|word|' climate slider is moved '|word|'")
+def step(context, leftRight, change):
if not context.userData:
context.userData = {}
- context.userData['leftSliderValue'] = get_left_temperature_slider_Value()
- toggle_left = waitForObject(names.neptune_UI_Center_Console_handle_Image)
- good, midth = get_middle_of_object(toggle_left)
- if good:
- downwards_delta = QPoint(3, -235)
- touchAndDrag(toggle_left, midth.x, midth.y, downwards_delta.x, downwards_delta.y)
+ climate_slider_handle = {}
+ if leftRight == 'left':
+ climate_slider_left = squish.waitForObjectExists(
+ names.leftTempSlider_TemperatureSlider)
+ context.userData['leftSliderValue'] = climate_slider_left.value
+ climate_slider_handle = squish.waitForObjectExists(
+ names.leftTempSlider_TemperatureSlider)
+ else:
+ climate_slider_right = squish.waitForObjectExists(
+ names.rightTempSlider_TemperatureSlider)
+ context.userData['rightSliderValue'] = climate_slider_right.value
+ climate_slider_handle = squish.waitForObjectExists(
+ names.rightTempSlider_TemperatureSlider)
+
+ mousePress(climate_slider_handle, Qt.LeftButton)
+ squish.snooze(settings.G_WAIT_SOME_STEPS_SEC)
+ move = QPoint(0, 0)
+ if change == 'upwards':
+ move = QPoint(0, -40)
+ else:
+ move = QPoint(0, 40)
+ ts_movement = coord_transform2D(move)
+ mouseMove(climate_slider_handle, ts_movement.x, ts_movement.y)
+ snooze(settings.G_WAIT_SOME_STEPS_SEC)
+ mouseRelease(Qt.LeftButton)
-@When("the right climate slider is moved upwards")
-def step(context):
+
+@Then("the climate slider value on the '|word|' should '|word|'")
+def step(context, leftRight, change):
if not context.userData:
context.userData = {}
- context.userData['rightSliderValue'] = get_right_temperature_slider_Value()
- toggle_right = waitForObject(names.neptune_UI_Center_Console_handle_Image_3)
- good, midth = get_middle_of_object(toggle_right)
-
- if good:
- upwards_delta = QPoint(0, -300)
- touchAndDrag(toggle_right, midth.x, midth.y, upwards_delta.x, upwards_delta.y)
-
-
-@Then("the climate slider value on the '|word|' should '|word|'")
-def step(context,leftRight,change):
+ before_value = 0
+ current_value = 0
if leftRight == 'left':
before_value = context.userData['leftSliderValue']
- current_value = get_left_temperature_slider_Value()
+ climate_slider_left = squish.waitForObjectExists(
+ names.leftTempSlider_TemperatureSlider)
+ current_value = climate_slider_left.value
else:
before_value = context.userData['rightSliderValue']
- current_value = get_right_temperature_slider_Value()
+ climate_slider_right = squish.waitForObjectExists(
+ names.rightTempSlider_TemperatureSlider)
+ current_value = climate_slider_right.value
test.log("Before: " + str(before_value) + " now: " + str(current_value))
is_now_smaller = (current_value < before_value)
- is_equal = (current_value == before_value)
+ is_equal = (current_value == before_value)
if change == 'increase':
- 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")
+ test.compare(not is_now_smaller and not is_equal, True,
+ "has greater value")
+ 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_climate/test.feature b/squishtests/suite_neptune3/tst_popup_climate/test.feature
index 4371eb9e..88eb9e3b 100644
--- a/squishtests/suite_neptune3/tst_popup_climate/test.feature
+++ b/squishtests/suite_neptune3/tst_popup_climate/test.feature
@@ -3,17 +3,10 @@ Feature: Test the climate popup features
The climate popup has certain functionality.
This will be tested here.
- Scenario: test the climate slider left slide downward
+ Scenario: test the climate slider left slide upwards
Given main menu is open
And the climate area is tapped
- When the left climate slider is moved downwards2
- Then the climate slider value on the 'left' should 'decrease'
-
- Scenario: test the climate slider right slide downwards
-
- Given main menu is open
- And the climate icon is tapped
-
- When the right climate slider is moved upwards
- Then the climate slider value on the 'right' should 'increase'
+ When the 'left' climate slider is moved 'upwards'
+ Then the climate slider value on the 'left' should 'increase'
+ And click the popup close button
diff --git a/squishtests/suite_neptune3/tst_popup_climate/test.py b/squishtests/suite_neptune3/tst_popup_climate/test.py
index 07c9da36..ef8c8127 100644
--- a/squishtests/suite_neptune3/tst_popup_climate/test.py
+++ b/squishtests/suite_neptune3/tst_popup_climate/test.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
############################################################################
##
## Copyright (C) 2018 Luxoft GmbH
@@ -12,7 +14,8 @@
## 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.
+## 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
@@ -30,10 +33,12 @@
#############################################################################
source(findFile('scripts', 'python/bdd.py'))
+source(findFile('scripts', '../shared/scripts/common/__init__.py'))
setupHooks('../shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps')
+
def main():
testSettings.throwOnFailure = True
runFeatureFile('test.feature')
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
index 0a3a11bd..dd08d124 100644
--- 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
@@ -14,7 +14,8 @@
## 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.
+## 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
diff --git a/squishtests/suite_neptune3/tst_popup_menus/test.feature b/squishtests/suite_neptune3/tst_popup_menus/test.feature
index ffe32f88..532256ca 100644
--- a/squishtests/suite_neptune3/tst_popup_menus/test.feature
+++ b/squishtests/suite_neptune3/tst_popup_menus/test.feature
@@ -6,8 +6,7 @@ Feature: Test the popups
Scenario: Open and close the volume popup
Given main menu is open
- When after some '5' seconds
- And the volume button is tapped
+ When 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
@@ -15,8 +14,8 @@ Feature: Test the popups
Scenario: Change the volume
Given main menu is open
- When after some '5' seconds
- And the volume button is tapped
+ When 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'
+ When the popup close button is clicked
diff --git a/squishtests/suite_neptune3/tst_popup_menus/test.py b/squishtests/suite_neptune3/tst_popup_menus/test.py
index 07c9da36..ef8c8127 100644
--- a/squishtests/suite_neptune3/tst_popup_menus/test.py
+++ b/squishtests/suite_neptune3/tst_popup_menus/test.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
############################################################################
##
## Copyright (C) 2018 Luxoft GmbH
@@ -12,7 +14,8 @@
## 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.
+## 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
@@ -30,10 +33,12 @@
#############################################################################
source(findFile('scripts', 'python/bdd.py'))
+source(findFile('scripts', '../shared/scripts/common/__init__.py'))
setupHooks('../shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps')
+
def main():
testSettings.throwOnFailure = True
runFeatureFile('test.feature')