diff options
author | Sven Kroemeke <skroemeke@luxoft.com> | 2019-03-29 15:32:27 +0100 |
---|---|---|
committer | SvenKa Roem <skroemeke@luxoft.com> | 2019-04-01 12:09:26 +0000 |
commit | 7d7740c9af1a0a5012829c44142afbd619aeafd4 (patch) | |
tree | 8829fc4e01b924490195d99fcd92781e45ef5305 /squishtests | |
parent | 62d5c9b646530b1405194786d37bf3b4ea718120 (diff) |
[squish] add 1st music app and widget tests
Added first simple tests for music widget, and for
the music app (same concept), but for distinguishment
a common file is introduced.
- widget: skipping forth and back through play list
- app: switching through views
Change-Id: Ic5592a8c2943c05a850c8a4ba3cfb9306f8dd6f7
Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
Diffstat (limited to 'squishtests')
8 files changed, 354 insertions, 4 deletions
diff --git a/squishtests/suite_neptune3/shared/scripts/names.py b/squishtests/suite_neptune3/shared/scripts/names.py index bca756ec..ead36372 100644 --- a/squishtests/suite_neptune3/shared/scripts/names.py +++ b/squishtests/suite_neptune3/shared/scripts/names.py @@ -66,8 +66,10 @@ multi_process_container = o_QtAM_ApplicationManagerWindow.copy() climate_single_process_container = neptune_UI_Center_Console.copy() calendar_single_process_container = neptune_UI_Center_Console.copy() -settings_single_process_container = neptune_UI_Center_Console.copy() +music_single_process_container = neptune_UI_Center_Console.copy() phone_single_process_container = neptune_UI_Center_Console.copy() +settings_single_process_container = neptune_UI_Center_Console.copy() + # define for each app an own starting-to-search container, # they all might look the same and could maybe be simplified @@ -75,14 +77,18 @@ phone_single_process_container = neptune_UI_Center_Console.copy() # apps cannot simply be replaced by the "center-console"-container container_climate = climate_single_process_container.copy() container_calendar = calendar_single_process_container.copy() +container_music = music_single_process_container.copy() +container_phone = phone_single_process_container.copy() container_settings = settings_single_process_container.copy() container_phone = phone_single_process_container.copy() + # contains the changer apps_reference_container = {'container_climate': container_climate, 'container_calendar': container_calendar, - 'container_settings': container_settings, - 'container_phone': container_phone} + 'container_music': container_music, + 'container_phone': container_phone, + 'container_settings': container_settings} # create an array of all changers, they will be used not singled out # but rather as the whole collection if mode is multi-process @@ -150,4 +156,19 @@ favorites_phoneView_ContactsView = {"container": container_phone, "objectName": keypad_phoneView_KeypadViewPanel = {"container": container_phone, "objectName": "keypad_phoneView", "type": "KeypadViewPanel", "visible": True} phoneCallerEndButton = {"container": container_phone, "objectName": "callerButtonEndCall", "type": "ToolButton", "visible": True} phoneCallerLabel = {"container": container_phone, "objectName": "callerLabelFullName", "type": "Label", "visible": True} - +musicPlayer = {"container": container_music, "objectName": "musicPlayer", "type": "AlbumArtPanel", "visible": True} +musicAppContent_MusicView = {"container": container_music, "objectName": "musicAppContent", "type": "MusicView", "visible": True} +musicProgressBar_MusicProgress = {"container": container_music, "objectName": "musicProgressBar", "type": "MusicProgress", "visible": True} +musicSongNext_ToolButton = {"container": container_music, "objectName": "musicSongNext", "type": "ToolButton", "visible": True} +musicSongPlayPause_ToolButton = {"container": container_music, "objectName": "musicSongPlayPause", "type": "ToolButton", "visible": True} +musicSongPrevious_ToolButton = {"container": container_music, "objectName": "musicSongPrevious", "type": "ToolButton", "visible": True} +shuffleMusicButton_ToolButton = {"container": container_music, "objectName": "shuffleMusicButton", "type": "ToolButton", "visible": True} +repeatMusicButton_ToolButton = {"container": container_music, "objectName": "repeatMusicButton", "type": "ToolButton", "visible": True} +musicView_sources_ToolButton = {"container": container_music, "objectName": "musicView_sources", "type": "ToolButton", "visible": True} +musicView_albums_ToolButton = {"container": container_music, "objectName": "musicView_albums", "type": "ToolButton", "visible": True} +musicView_artists_ToolButton = {"container": container_music, "objectName": "musicView_artists", "type": "ToolButton", "visible": True} +musicView_favorites_ToolButton = {"container": container_music, "objectName": "musicView_favorites", "type": "ToolButton", "visible": True} +musicPlayListList_ListView = {"container": container_music, "objectName": "musicPlayListList", "type": "ListView", "visible": True} +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} diff --git a/squishtests/suite_neptune3/shared/steps/common_music.py b/squishtests/suite_neptune3/shared/steps/common_music.py new file mode 100644 index 00000000..570579f0 --- /dev/null +++ b/squishtests/suite_neptune3/shared/steps/common_music.py @@ -0,0 +1,92 @@ +# -*- 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 +import common.app as app + + +@Given("tap music widget '|word|' button, '|integer|' time(s)") +def step(context, button_name, number_taps): + ui_buttons = { + 'next': names.musicSongNext_ToolButton, + 'previous': names.musicSongPrevious_ToolButton, + 'play': names.musicSongPlayPause_ToolButton, + 'pause': names.musicSongPlayPause_ToolButton, + 'repeat': names.repeatMusicButton_ToolButton, + 'shuffle': names.shuffleMusicButton_ToolButton + } + + if button_name not in ui_buttons.keys(): + app.fail("The music button '" + button_name + "' is not known!") + return + + app.switch_to_app('music') + for _i in range(number_taps): + squish.snooze(0.25) + squish.tapObject(ui_buttons[button_name]) + + +@Given("remember current playlist") +def step(context): + if not context.userData: + context.userData = {} + # yes, only in music context + app.switch_to_app('music') + + ui_info_playlist = squish.waitForObject(names.musicAppContent_MusicView) + ui_info_element = squish.waitForObject(names.musicPlayer) + + play_current_index = ui_info_element.currentIndex + playlist_music_count = ui_info_playlist.store.musicCount + + context.userData['index'] = play_current_index + context.userData['count'] = playlist_music_count + + +@Then("the '|integer|' distance song will be displayed") +def step(context, distance_index): + if not context.userData: + context.userData = {} + + old_index = context.userData['index'] + count = context.userData['count'] + + # switch context + app.switch_to_app('music') + ui_info_element = squish.waitForObject(names.musicPlayer) + + play_current_index = ui_info_element.currentIndex + app.compare((old_index + distance_index) % count, + play_current_index, + "index should be according song skipping") diff --git a/squishtests/suite_neptune3/tst_app_music/steps/app_music.py b/squishtests/suite_neptune3/tst_app_music/steps/app_music.py new file mode 100644 index 00000000..46347383 --- /dev/null +++ b/squishtests/suite_neptune3/tst_app_music/steps/app_music.py @@ -0,0 +1,79 @@ +# -*- 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 + +# commonly used +possible_view_buttons = { + 'sources': names.musicView_sources_ToolButton, + 'albums': names.musicView_albums_ToolButton, + 'artists': names.musicView_artists_ToolButton, + 'favorites': names.musicView_favorites_ToolButton +} + + +@OnFeatureStart +def hook(context): + start_neptune_ui_app_w_focus("console") + + +@When("tap music playlist view '|word|' button") +def step(context, button_name): + if button_name not in possible_view_buttons.keys(): + app.fail("in music view, button '" + + button_name + + "' is not known!") + return + + app.switch_to_app('music') + squish.snooze(0.25) + button = squish.waitForObject(possible_view_buttons[button_name]) + squish.tapObject(button) + + +@Then("music list view should change to view '|any|'") +def step(context, view_name): + if view_name not in possible_view_buttons.keys(): + app.fail("in music view, list view '" + + view_name + + "' is not known!") + return + + app.switch_to_app('music') + squish.snooze(0.25) + info_ui = squish.waitForObject(names.musicToolsColumn) + + currentView = str(info_ui.currentText) + app.compare(currentView, view_name, + "view stored is not what is changed to") diff --git a/squishtests/suite_neptune3/tst_app_music/test.feature b/squishtests/suite_neptune3/tst_app_music/test.feature new file mode 100644 index 00000000..7500e78f --- /dev/null +++ b/squishtests/suite_neptune3/tst_app_music/test.feature @@ -0,0 +1,19 @@ +Feature: Test music app functionality + + Test some features of music app. + + +Scenario Outline: Open music app from launcher bar and switch + to all music playlists. + Given main menu is open + And 'music' app from launcher tapped + And switch app to 'music' + Then wait '1' seconds and 'music' app is active + When tap music playlist view '<views>' button + Then music list view should change to view '<views>' + + Examples: + | views | + | artists | + | albums | + | favorites | diff --git a/squishtests/suite_neptune3/tst_app_music/test.py b/squishtests/suite_neptune3/tst_app_music/test.py new file mode 100644 index 00000000..8a8d9be2 --- /dev/null +++ b/squishtests/suite_neptune3/tst_app_music/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_widget_music/steps/widget_music.py b/squishtests/suite_neptune3/tst_widget_music/steps/widget_music.py new file mode 100644 index 00000000..d9be960f --- /dev/null +++ b/squishtests/suite_neptune3/tst_widget_music/steps/widget_music.py @@ -0,0 +1,37 @@ +# -*- 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 +## +############################################################################ + + +@OnFeatureStart +def hook(context): + start_neptune_ui_app_w_focus("console") diff --git a/squishtests/suite_neptune3/tst_widget_music/test.feature b/squishtests/suite_neptune3/tst_widget_music/test.feature new file mode 100644 index 00000000..64d6acdd --- /dev/null +++ b/squishtests/suite_neptune3/tst_widget_music/test.feature @@ -0,0 +1,18 @@ +Feature: Test music widget functionality + + Test some features of the music widget. + + + Scenario Outline: Navigate on the music widget songs + + Given main menu is open + And remember current playlist + And tap music widget '<button>' button, '<times>' time(s) + Then the '<distance>' distance song will be displayed + + Examples: + | button | times | distance | + | previous | 4 | -4 | + | next | 2 | 2 | + | next | 3 | 3 | + | previous | 1 | -1 | diff --git a/squishtests/suite_neptune3/tst_widget_music/test.py b/squishtests/suite_neptune3/tst_widget_music/test.py new file mode 100644 index 00000000..8a8d9be2 --- /dev/null +++ b/squishtests/suite_neptune3/tst_widget_music/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') |