aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Kroemeke <skroemeke@luxoft.com>2019-02-13 13:59:48 +0100
committerBramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>2019-02-14 09:51:49 +0000
commit00a63effbb97a69e1653ebcd40d2e6bec659fe35 (patch)
tree878bca9a2b318c214260047f30084c7d0c501cff
parent389be411c2464017812df01c6c3a076b809c95ed (diff)
[squish] add simple calendar app test
A simple calendar app test is added for multi-process testing with apps. It is an app test that is simple, in order to have more robust functioning app tests, because movement (tap and move) is still a problem. It switches between year, events, and next view. Changes to code is needed to receive according objectName values, to identify the buttons. Change-Id: I11ac62e7cefce7ced2fc96eb442bf205aff9ca0f Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
-rw-r--r--apps/com.pelagicore.calendar/views/CalendarView.qml6
-rw-r--r--plugins/controls/ToolsColumn.qml1
-rw-r--r--squishtests/suite_neptune3/shared/scripts/names.py3
-rw-r--r--squishtests/suite_neptune3/shared/steps/essential.py71
-rw-r--r--squishtests/suite_neptune3/suite.conf2
-rw-r--r--squishtests/suite_neptune3/tst_app_calendar/steps/app_calendar.py53
-rw-r--r--squishtests/suite_neptune3/tst_app_calendar/test.feature15
-rw-r--r--squishtests/suite_neptune3/tst_app_calendar/test.py42
-rw-r--r--squishtests/suite_neptune3/tst_app_common/steps/app_settings.py63
9 files changed, 189 insertions, 67 deletions
diff --git a/apps/com.pelagicore.calendar/views/CalendarView.qml b/apps/com.pelagicore.calendar/views/CalendarView.qml
index ffb26690..82eeaf62 100644
--- a/apps/com.pelagicore.calendar/views/CalendarView.qml
+++ b/apps/com.pelagicore.calendar/views/CalendarView.qml
@@ -113,9 +113,9 @@ Item {
translationContext: "CalendarToolsColumn"
model: ListModel {
id: toolsColumnModel
- ListElement { icon: "ic-calendar"; text: QT_TRANSLATE_NOOP("CalendarToolsColumn", "year") }
- ListElement { icon: "ic-calendar"; text: QT_TRANSLATE_NOOP("CalendarToolsColumn", "next") }
- ListElement { icon: "ic-calendar"; text: QT_TRANSLATE_NOOP("CalendarToolsColumn", "events") }
+ ListElement { icon: "ic-calendar"; text: QT_TRANSLATE_NOOP("CalendarToolsColumn", "year"); objectName: "yearViewButton" }
+ ListElement { icon: "ic-calendar"; text: QT_TRANSLATE_NOOP("CalendarToolsColumn", "next"); objectName: "nextViewButton" }
+ ListElement { icon: "ic-calendar"; text: QT_TRANSLATE_NOOP("CalendarToolsColumn", "events"); objectName: "eventsViewButton" }
}
}
}
diff --git a/plugins/controls/ToolsColumn.qml b/plugins/controls/ToolsColumn.qml
index 8c0047a2..3091276e 100644
--- a/plugins/controls/ToolsColumn.qml
+++ b/plugins/controls/ToolsColumn.qml
@@ -135,6 +135,7 @@ ColumnLayout {
Layout.preferredWidth: Sizes.dp(135)
Layout.preferredHeight: Sizes.dp(96)
Layout.alignment: Qt.AlignHCenter
+ objectName: model.objectName ? model.objectName : ""
baselineOffset: 0
checkable: true
checked: root.currentIndex === index
diff --git a/squishtests/suite_neptune3/shared/scripts/names.py b/squishtests/suite_neptune3/shared/scripts/names.py
index 7011fb84..9d885c71 100644
--- a/squishtests/suite_neptune3/shared/scripts/names.py
+++ b/squishtests/suite_neptune3/shared/scripts/names.py
@@ -62,3 +62,6 @@ o_ClimateView = {"container": o_QtAM_ApplicationManagerWindow, "type": "ClimateV
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}
+events_ToolButton = {"checkable": True, "container": o_QtAM_ApplicationManagerWindow, "objectName": "eventsViewButton", "text": "events", "type": "ToolButton", "visible": True}
+year_ToolButton = {"checkable": True, "container": o_QtAM_ApplicationManagerWindow, "objectName": "yearViewButton", "text": "year", "type": "ToolButton", "visible": True}
+next_ToolButton = {"checkable": True, "container": o_QtAM_ApplicationManagerWindow, "objectName": "nextViewButton", "text": "next", "type": "ToolButton", "visible": True}
diff --git a/squishtests/suite_neptune3/shared/steps/essential.py b/squishtests/suite_neptune3/shared/steps/essential.py
index cf6ec024..0aa4201e 100644
--- a/squishtests/suite_neptune3/shared/steps/essential.py
+++ b/squishtests/suite_neptune3/shared/steps/essential.py
@@ -35,6 +35,7 @@
import names
import common.settings as settings # some test setting vars
import common.app as app
+import common.qml_names as qml
# coordinate
from math import sin, cos, floor
@@ -164,4 +165,74 @@ def is_squish_object_there(object, seconds):
is_there = False
return is_there
+
+@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!!")
+
+
+@Then("switch app to '|word|'")
+def step(context, app_name):
+ """ Is just a thin wrapper to access directly from test """
+ app.switch_to_app(app_name)
+
+
# -------------------------------------------------------
diff --git a/squishtests/suite_neptune3/suite.conf b/squishtests/suite_neptune3/suite.conf
index 96d854f6..449a76b6 100644
--- a/squishtests/suite_neptune3/suite.conf
+++ b/squishtests/suite_neptune3/suite.conf
@@ -6,6 +6,6 @@ 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 tst_app_common
+TEST_CASES=tst_environment_info tst_main_menu_widgets tst_popup_menus tst_volume_popup tst_launch_bar tst_app_common tst_app_calendar
VERSION=3
WRAPPERS=Qt
diff --git a/squishtests/suite_neptune3/tst_app_calendar/steps/app_calendar.py b/squishtests/suite_neptune3/tst_app_calendar/steps/app_calendar.py
new file mode 100644
index 00000000..8cf9f4f8
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_app_calendar/steps/app_calendar.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+##
+## Copyright (C) 2019 Luxoft Sweden AB
+## 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
+##
+############################################################################
+
+# squish dependent
+import names
+
+
+@OnFeatureStart
+def hook(context):
+ start_neptune_ui_app_w_focus("console")
+
+
+@Then("click '|word|' view")
+def step(context, view_name):
+ if view_name == "events":
+ view_object_name = names.events_ToolButton
+ elif view_name == "year":
+ view_object_name = names.year_ToolButton
+ else:
+ view_object_name = names.next_ToolButton
+
+ events_button = waitForObject(view_object_name)
+ tapObject(events_button)
diff --git a/squishtests/suite_neptune3/tst_app_calendar/test.feature b/squishtests/suite_neptune3/tst_app_calendar/test.feature
new file mode 100644
index 00000000..e9624d3b
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_app_calendar/test.feature
@@ -0,0 +1,15 @@
+Feature: Test calendar app functionality
+
+ Test some features of calendar app.
+
+ Scenario: Open calendar app from launcher bar and switch
+ to all calendar views
+ Given main menu is open
+ And 'calendar' app from launcher tapped
+ Then wait '2' seconds and 'calendar' app is active
+ And switch app to 'calendar'
+ And click 'events' view
+ And after some '1' seconds
+ And click 'next' view
+ And after some '1' seconds
+ And click 'year' view
diff --git a/squishtests/suite_neptune3/tst_app_calendar/test.py b/squishtests/suite_neptune3/tst_app_calendar/test.py
new file mode 100644
index 00000000..8a8d9be2
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_app_calendar/test.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+##
+## Copyright (C) 2019 Luxoft Sweden AB
+## 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
index d9c99c89..8783b727 100644
--- a/squishtests/suite_neptune3/tst_app_common/steps/app_settings.py
+++ b/squishtests/suite_neptune3/tst_app_common/steps/app_settings.py
@@ -41,66 +41,3 @@ 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!!")