aboutsummaryrefslogtreecommitdiffstats
path: root/squishtests
diff options
context:
space:
mode:
authorSven Kroemeke <skroemeke@luxoft.com>2019-04-02 14:43:41 +0200
committerSvenKa Roem <skroemeke@luxoft.com>2019-04-03 14:32:57 +0000
commit9b7c4e492813cca1f33d740efb9c9394490b1d1f (patch)
treefdb67a92807c010a11994ee0c3ccb0d66b82ea3c /squishtests
parent54231f09dfa42c46d01cbd0bb3022f2cd12f608e (diff)
[squish] add app downloads tests
In downloads app tests were added: - change the 3 views and test if they changed - install and deinstall apps in these views Change-Id: I0fe7b63f353b3ddc8ec5edf7bc0074a610c0dfaf Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
Diffstat (limited to 'squishtests')
-rw-r--r--squishtests/suite_neptune3/shared/scripts/common/qml_names.py1
-rw-r--r--squishtests/suite_neptune3/shared/scripts/common/settings.py4
-rw-r--r--squishtests/suite_neptune3/shared/scripts/names.py8
-rw-r--r--squishtests/suite_neptune3/tst_app_downloads/steps/app_downloads.py170
-rw-r--r--squishtests/suite_neptune3/tst_app_downloads/test.feature34
-rw-r--r--squishtests/suite_neptune3/tst_app_downloads/test.py42
6 files changed, 257 insertions, 2 deletions
diff --git a/squishtests/suite_neptune3/shared/scripts/common/qml_names.py b/squishtests/suite_neptune3/shared/scripts/common/qml_names.py
index 80f89bf5..310d5d7d 100644
--- a/squishtests/suite_neptune3/shared/scripts/common/qml_names.py
+++ b/squishtests/suite_neptune3/shared/scripts/common/qml_names.py
@@ -52,3 +52,4 @@ viewPhoneButtons = ['recents',
phone_contactView_prefix = "contactNr_"
phone_contactView_button_prefix = "callButtonContactNr_"
phone_contactView_caller_prefix = "contactNameOfNr_"
+app_downloads_prefix = "itemDownloadApp_"
diff --git a/squishtests/suite_neptune3/shared/scripts/common/settings.py b/squishtests/suite_neptune3/shared/scripts/common/settings.py
index d5ef4246..c763b22b 100644
--- a/squishtests/suite_neptune3/shared/scripts/common/settings.py
+++ b/squishtests/suite_neptune3/shared/scripts/common/settings.py
@@ -55,7 +55,7 @@ G_NAME_ID = [['vehicle', 'com.luxoft.vehicle'],
['settings', 'com.pelagicore.apps.settings'],
['music', 'com.pelagicore.music'],
['cluster', 'com.theqtcompany.cluster'],
- ['appstore', 'com.pelagicore.appstore'],
+ ['downloads', 'com.pelagicore.downloads'],
['phone', 'com.pelagicore.phone'],
['calendar', 'com.pelagicore.calendar'],
['climate', 'com.pelagicore.climate'],
@@ -69,7 +69,7 @@ G_APP_HANDLE = {'vehicle': None,
'settings': None,
'music': None,
'cluster': None,
- 'appstore': None,
+ 'downloads': None,
'phone': None,
'calendar': None,
'climate': None,
diff --git a/squishtests/suite_neptune3/shared/scripts/names.py b/squishtests/suite_neptune3/shared/scripts/names.py
index 200a7a79..b370c23d 100644
--- a/squishtests/suite_neptune3/shared/scripts/names.py
+++ b/squishtests/suite_neptune3/shared/scripts/names.py
@@ -82,6 +82,9 @@ container_phone = phone_single_process_container.copy()
container_settings = settings_single_process_container.copy()
container_phone = phone_single_process_container.copy()
+# the apps below do not belong to apps that have an own sub processes, yet!
+container_downloads = neptune_UI_Center_Console.copy()
+
# contains the changer
apps_reference_container = {'container_climate': container_climate,
@@ -172,3 +175,8 @@ musicPlayListList_ListView = {"container": container_music, "objectName": "music
musicListBackButton_ToolButton = {"container": container_music, "objectName": "musicListBackButton", "type": "ToolButton", "visible": False}
musicListPlayAllButton_ToolButton = {"container": container_music, "objectName": "musicListPlayAllButton", "type": "ToolButton", "visible": False}
musicToolsColumn = {"container": container_music, "objectName": "musicToolsColumn", "type": "ToolsColumn", "visible": True}
+downloadAppList_DownloadAppList = {"container": container_downloads, "objectName": "downloadAppList", "type": "DownloadAppList", "visible": True}
+downloadAppViewButton_Games = {"container": container_downloads, "objectName": "downloadAppViewButton_Games", "type": "ToolButton", "visible": True}
+downloadAppViewButton_Business = {"container": container_downloads, "objectName": "downloadAppViewButton_Business", "type": "ToolButton", "visible": True}
+downloadAppViewButton_Entertainment = {"container": container_downloads, "objectName": "downloadAppViewButton_Entertainment", "type": "ToolButton", "visible": True}
+downloadsToolsColumn = {"container": container_downloads, "objectName": "downloadsAppColumn", "type": "DownloadsToolsColumn", "visible": True}
diff --git a/squishtests/suite_neptune3/tst_app_downloads/steps/app_downloads.py b/squishtests/suite_neptune3/tst_app_downloads/steps/app_downloads.py
new file mode 100644
index 00000000..61b2ad70
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_app_downloads/steps/app_downloads.py
@@ -0,0 +1,170 @@
+# -*- 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
+##
+############################################################################
+
+import names
+import common.app as app
+import common.qml_names as qml
+
+# commonly used
+possible_ui_elements = {
+ 'Games': names.downloadAppViewButton_Games,
+ 'Business': names.downloadAppViewButton_Business,
+ 'Entertainment': names.downloadAppViewButton_Entertainment
+}
+
+
+@OnFeatureStart
+def hook(context):
+ start_neptune_ui_app_w_focus("console")
+
+
+@When("tap download app view '|word|' button")
+def step(context, button_name):
+ if button_name not in possible_ui_elements.keys():
+ app.fail("in downloads app view, button '"
+ + button_name
+ + "' is not known!")
+ return
+
+ #app.switch_to_app('downloads')
+ squish.snooze(0.25)
+ button = squish.waitForObject(possible_ui_elements[button_name])
+ squish.tapObject(button)
+
+
+@Then("current download view is '|word|'")
+def step(context, view_name):
+ if view_name not in possible_ui_elements.keys():
+ app.fail("in downloads app, view '"
+ + view_name
+ + "' is not known!")
+ return
+
+ #app.switch_to_app('downloads')
+ squish.snooze(0.25)
+ info_ui = squish.waitForObject(names.downloadsToolsColumn)
+
+ currentView = str(info_ui.currentTool)
+ app.compare(currentView, view_name,
+ "view stored is not what is changed to")
+
+
+@When("tap and '|word|' all available apps")
+def step(context, command):
+ possible_options = ['install', 'deinstall']
+ if command not in possible_options:
+ app.fail("in downloads, the command '"
+ + command + "' is not known!")
+ return
+ # what to do
+ install = (command == possible_options[0])
+
+ #app.switch_to_app('downloads')
+ squish.snooze(0.25)
+ app_list = squish.waitForObject(names.downloadAppList_DownloadAppList)
+ number_of_app_in_view = app_list.count
+
+ # store installable apps here
+ just_changed_installation_apps = []
+
+ for i in range(number_of_app_in_view):
+ # this is a little bit old school without objectName
+ # actually objectName is used to achieve
+ # app information aka model.id
+ # here we use index to find the item
+ download_app_struct = {
+ "container": names.downloadAppList_DownloadAppList,
+ "index": i,
+ "type": "ListItemProgress",
+ "visible": True}
+ model_ToolButton_ui = {"container": download_app_struct,
+ "type": "ToolButton",
+ "visible": True}
+ test.log("download app index " + str(i)
+ + " was found! Trying ...")
+ download_app = squish.waitForObject(download_app_struct)
+ app_objectName = str(download_app.objectName)
+
+ model_text = str(download_app.text)
+
+ # delete prefix, if this works, string must be different
+ model_name = app_objectName.replace(qml.app_downloads_prefix, "")
+ if model_name != model_text:
+ installed = download_app.isInstalled
+
+ if install is not installed:
+ test.log("Found: (" + str(i) + ") " + model_text + " as '"
+ + model_name + "' "
+ + ("installed" if installed
+ else "not installed")
+ + "!")
+ install_button = squish.waitForObject(model_ToolButton_ui)
+ squish.tapObject(install_button)
+
+ # wait a little and hope it installs during that time
+ just_changed_installation_apps.append(model_name)
+ squish.snooze(2)
+ else:
+ test.log("app '" + model_name + "' is already "
+ + ("installed" if not install else "not installed")
+ + "!")
+ else:
+ test.fail("in download test, a problem with model.id occurred.")
+
+ # wait for last toast message to disappear
+ squish.snooze(0.5)
+ # now check in grid if just installed apps exist
+ grid_view = squish.waitForObject(
+ names.neptune_UI_Center_Console_grid_GridView)
+ launcher_bar = squish.waitForObject(
+ names.neptune_3_UI_Center_Console_gridButton_ToolButton)
+ squish.tapObject(launcher_bar)
+
+ if len(just_changed_installation_apps) == 0:
+ test.passes("good, no apps to " +
+ ("install" if install else "uninstall")
+ + "!")
+ else:
+ for el in just_changed_installation_apps:
+ object_name = qml.grid_delegate + el
+ app_pointer = find_object_name_recursively(grid_view,
+ object_name,
+ 3)
+ # python .......
+ found = (app_pointer is not None)
+ app.compare(found, install,
+ ("app '" + str(el) + "' exists"))
+ # tap again to close
+ squish.tapObject(launcher_bar)
+ # wait for toast message to disappear
+ squish.snooze(0.5)
diff --git a/squishtests/suite_neptune3/tst_app_downloads/test.feature b/squishtests/suite_neptune3/tst_app_downloads/test.feature
new file mode 100644
index 00000000..886e4ccb
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_app_downloads/test.feature
@@ -0,0 +1,34 @@
+Feature: Test downloads app functionality
+
+ Test some features of downloading apps.
+
+
+Scenario Outline: Open all download views
+
+ Given main menu is open
+ And 'downloads' app from launcher tapped
+ Then wait '3' seconds and 'downloads' app is active
+ When tap download app view '<views>' button
+ Then current download view is '<views>'
+
+ Examples:
+ | views |
+ | Games |
+ | Business |
+ | Entertainment |
+
+
+Scenario Outline: Open download app from launcher bar and download
+ all downloadable apps and start and exit and
+ check in launcher
+ Given main menu is open
+ And 'downloads' app from launcher tapped
+ Then wait '3' seconds and 'downloads' app is active
+ When tap download app view '<views>' button
+ And tap and 'install' all available apps
+ And tap and 'deinstall' all available apps
+
+ Examples:
+ | views |
+ | Business |
+ | Entertainment |
diff --git a/squishtests/suite_neptune3/tst_app_downloads/test.py b/squishtests/suite_neptune3/tst_app_downloads/test.py
new file mode 100644
index 00000000..8a8d9be2
--- /dev/null
+++ b/squishtests/suite_neptune3/tst_app_downloads/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')