From 7e82a6d1557628e1d2bf3482532b1404227b05e8 Mon Sep 17 00:00:00 2001 From: Sven Kroemeke Date: Thu, 14 Feb 2019 12:12:39 +0100 Subject: [squish] rename tests to correspond better to their feature Some tests were named wrongly. This will clarify some tests' intention. Also the suite.conf had to be adapted to the renamed tests. Some texts in the test have been changed according to the new naming, these changes only reflect a kind of documentation, they have no functional use. Name of python test files are invariant to functionality, since they are included by directory - so renaming was just to also reflect the intention of the feature. Change-Id: Id998fbfb3f5be3b4857dcff0b56b94becf1ac59f Reviewed-by: Bramastyo Harimukti Santoso --- squishtests/suite_neptune3/suite.conf | 2 +- .../tst_climate/steps/popup_climate.py | 118 ++++++++++++ .../suite_neptune3/tst_climate/test.feature | 12 ++ squishtests/suite_neptune3/tst_climate/test.py | 44 +++++ .../tst_home_screen/steps/widget_operations.py | 145 +++++++++++++++ .../suite_neptune3/tst_home_screen/test.feature | 23 +++ squishtests/suite_neptune3/tst_home_screen/test.py | 44 +++++ .../tst_launch_bar/steps/launch_bar.py | 198 --------------------- .../suite_neptune3/tst_launch_bar/test.feature | 45 ----- squishtests/suite_neptune3/tst_launch_bar/test.py | 44 ----- .../tst_launcher/steps/launcher_bar.py | 198 +++++++++++++++++++++ .../suite_neptune3/tst_launcher/test.feature | 45 +++++ squishtests/suite_neptune3/tst_launcher/test.py | 44 +++++ .../steps/widget_operations.py | 145 --------------- .../tst_main_menu_widgets/test.feature | 23 --- .../suite_neptune3/tst_main_menu_widgets/test.py | 44 ----- .../tst_popup_climate/steps/popup_climate.py | 118 ------------ .../suite_neptune3/tst_popup_climate/test.feature | 12 -- .../suite_neptune3/tst_popup_climate/test.py | 44 ----- .../tst_popup_menus/steps/go_to_menu_steps.py | 100 ----------- .../suite_neptune3/tst_popup_menus/test.feature | 21 --- squishtests/suite_neptune3/tst_popup_menus/test.py | 44 ----- .../tst_volume/steps/volume_slider.py | 100 +++++++++++ squishtests/suite_neptune3/tst_volume/test.feature | 20 +++ squishtests/suite_neptune3/tst_volume/test.py | 44 +++++ 25 files changed, 838 insertions(+), 839 deletions(-) create mode 100644 squishtests/suite_neptune3/tst_climate/steps/popup_climate.py create mode 100644 squishtests/suite_neptune3/tst_climate/test.feature create mode 100644 squishtests/suite_neptune3/tst_climate/test.py create mode 100644 squishtests/suite_neptune3/tst_home_screen/steps/widget_operations.py create mode 100644 squishtests/suite_neptune3/tst_home_screen/test.feature create mode 100644 squishtests/suite_neptune3/tst_home_screen/test.py delete mode 100644 squishtests/suite_neptune3/tst_launch_bar/steps/launch_bar.py delete mode 100644 squishtests/suite_neptune3/tst_launch_bar/test.feature delete mode 100644 squishtests/suite_neptune3/tst_launch_bar/test.py create mode 100644 squishtests/suite_neptune3/tst_launcher/steps/launcher_bar.py create mode 100644 squishtests/suite_neptune3/tst_launcher/test.feature create mode 100644 squishtests/suite_neptune3/tst_launcher/test.py delete mode 100644 squishtests/suite_neptune3/tst_main_menu_widgets/steps/widget_operations.py delete mode 100644 squishtests/suite_neptune3/tst_main_menu_widgets/test.feature delete mode 100644 squishtests/suite_neptune3/tst_main_menu_widgets/test.py delete mode 100644 squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py delete mode 100644 squishtests/suite_neptune3/tst_popup_climate/test.feature delete mode 100644 squishtests/suite_neptune3/tst_popup_climate/test.py delete mode 100644 squishtests/suite_neptune3/tst_popup_menus/steps/go_to_menu_steps.py delete mode 100644 squishtests/suite_neptune3/tst_popup_menus/test.feature delete mode 100644 squishtests/suite_neptune3/tst_popup_menus/test.py create mode 100644 squishtests/suite_neptune3/tst_volume/steps/volume_slider.py create mode 100644 squishtests/suite_neptune3/tst_volume/test.feature create mode 100644 squishtests/suite_neptune3/tst_volume/test.py diff --git a/squishtests/suite_neptune3/suite.conf b/squishtests/suite_neptune3/suite.conf index 449a76b6..f8b5605c 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 tst_app_calendar +TEST_CASES=tst_environment_info tst_home_screen tst_volume tst_launcher tst_app_common tst_app_calendar VERSION=3 WRAPPERS=Qt diff --git a/squishtests/suite_neptune3/tst_climate/steps/popup_climate.py b/squishtests/suite_neptune3/tst_climate/steps/popup_climate.py new file mode 100644 index 00000000..789b86ce --- /dev/null +++ b/squishtests/suite_neptune3/tst_climate/steps/popup_climate.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- + +############################################################################ +## +## Copyright (C) 2019 Luxoft Sweden AB +## Copyright (C) 2018 Pelagicore AG +## 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.app as app # to switch context +import common.settings as settings # waiting duration + +# squish +import names + + +@OnFeatureStart +def hook(context): + start_neptune_ui_app_w_focus("console") + + +@Given("the climate area is tapped") +def step(context): + app.switch_to_app('climate') + climateMouseArea = squish.waitForObjectExists( + names.climateAreaMouseArea_MouseArea) + squish.tapObject(climateMouseArea) + + +@When("the '|word|' climate slider is moved '|word|'") +def step(context, leftRight, change): + if not context.userData: + context.userData = {} + + 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) + + +@Then("the climate slider value on the '|word|' should '|word|'") +def step(context, leftRight, change): + if not context.userData: + context.userData = {} + + before_value = 0 + current_value = 0 + if leftRight == 'left': + before_value = context.userData['leftSliderValue'] + climate_slider_left = squish.waitForObjectExists( + names.leftTempSlider_TemperatureSlider) + current_value = climate_slider_left.value + else: + before_value = context.userData['rightSliderValue'] + 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) + + if change == 'increase': + 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_climate/test.feature b/squishtests/suite_neptune3/tst_climate/test.feature new file mode 100644 index 00000000..88eb9e3b --- /dev/null +++ b/squishtests/suite_neptune3/tst_climate/test.feature @@ -0,0 +1,12 @@ +Feature: Test the climate popup features + + The climate popup has certain functionality. + This will be tested here. + + 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 'upwards' + Then the climate slider value on the 'left' should 'increase' + And click the popup close button diff --git a/squishtests/suite_neptune3/tst_climate/test.py b/squishtests/suite_neptune3/tst_climate/test.py new file mode 100644 index 00000000..53e5d84a --- /dev/null +++ b/squishtests/suite_neptune3/tst_climate/test.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +############################################################################ +## +## Copyright (C) 2019 Luxoft Sweden AB +## Copyright (C) 2018 Pelagicore AG +## 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_home_screen/steps/widget_operations.py b/squishtests/suite_neptune3/tst_home_screen/steps/widget_operations.py new file mode 100644 index 00000000..23d0ab82 --- /dev/null +++ b/squishtests/suite_neptune3/tst_home_screen/steps/widget_operations.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- + +############################################################################ +## +## Copyright (C) 2019 Luxoft Sweden AB +## Copyright (C) 2018 Pelagicore AG +## 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.settings as settings +import common.app as app +import common.qml_names as qml + +# squish dependent +import names + + +@OnFeatureStart +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): + snooze(seconds) + addWidget_popup = names.neptune_3_UI_Center_Console_addWidgetPopupItem_AddWidgetPopup + # test.compare(volume_popup.exists) something funny?? + try: + waitForObjectExists(addWidget_popup, settings.G_WAIT_FOR_INEXISTANCE_MS) + except Exception: + test.compare(True, True, "add widget popup closed!") + else: + 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!") + + +@When("add map is tapped") +def step(context): + addWidgetItem_maps = waitForObject(names.widgetList_AddWidgets_Maps) + tapObject(addWidgetItem_maps) + + +@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, + "'" + app_name + "' widget closed!") diff --git a/squishtests/suite_neptune3/tst_home_screen/test.feature b/squishtests/suite_neptune3/tst_home_screen/test.feature new file mode 100644 index 00000000..d25e0af4 --- /dev/null +++ b/squishtests/suite_neptune3/tst_home_screen/test.feature @@ -0,0 +1,23 @@ +Feature: Home screen configuration + + From home screen it is possible to change the widgets, + add, remove, and start apps which the widgets represent. + + Scenario: Open and close add new widget popup + + Given main menu is open + Then add widget was tapped + And the new widget dialogue appeared + When the popup close button is clicked + Then the add widget popup should not be there after '1' seconds of closing animation + + Scenario: Add new widget maps + + Given main menu is open + Then add widget was tapped + And the new widget dialogue appeared + When add map is tapped + 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 + diff --git a/squishtests/suite_neptune3/tst_home_screen/test.py b/squishtests/suite_neptune3/tst_home_screen/test.py new file mode 100644 index 00000000..53e5d84a --- /dev/null +++ b/squishtests/suite_neptune3/tst_home_screen/test.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +############################################################################ +## +## Copyright (C) 2019 Luxoft Sweden AB +## Copyright (C) 2018 Pelagicore AG +## 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_launch_bar/steps/launch_bar.py b/squishtests/suite_neptune3/tst_launch_bar/steps/launch_bar.py deleted file mode 100644 index 458f7c8d..00000000 --- a/squishtests/suite_neptune3/tst_launch_bar/steps/launch_bar.py +++ /dev/null @@ -1,198 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################ -## -## Copyright (C) 2019 Luxoft Sweden AB -## Copyright (C) 2018 Pelagicore AG -## 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.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, "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 tapped") -def step(context): - grid_button = waitForObject(names.neptune_3_UI_Center_Console_gridButton_ToolButton) - tapObject(grid_button) - - -@Then("the grid should be '|word|'") -def step(context, string_open): - open_status = string_open == 'opened' - 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 deleted file mode 100644 index 5c67ae9b..00000000 --- a/squishtests/suite_neptune3/tst_launch_bar/test.feature +++ /dev/null @@ -1,45 +0,0 @@ -Feature: The launch bar is configurable - - The launch bar is highly configurable. - Sorted in a natural way the first items are - 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 tapped - Then the grid should be 'opened' - 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 '' is tabbed and move index '' up and '' right - And the '' app index has increased by '' - 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 deleted file mode 100644 index 53e5d84a..00000000 --- a/squishtests/suite_neptune3/tst_launch_bar/test.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################ -## -## Copyright (C) 2019 Luxoft Sweden AB -## Copyright (C) 2018 Pelagicore AG -## 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_launcher/steps/launcher_bar.py b/squishtests/suite_neptune3/tst_launcher/steps/launcher_bar.py new file mode 100644 index 00000000..458f7c8d --- /dev/null +++ b/squishtests/suite_neptune3/tst_launcher/steps/launcher_bar.py @@ -0,0 +1,198 @@ +# -*- coding: utf-8 -*- + +############################################################################ +## +## Copyright (C) 2019 Luxoft Sweden AB +## Copyright (C) 2018 Pelagicore AG +## 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.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, "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 tapped") +def step(context): + grid_button = waitForObject(names.neptune_3_UI_Center_Console_gridButton_ToolButton) + tapObject(grid_button) + + +@Then("the grid should be '|word|'") +def step(context, string_open): + open_status = string_open == 'opened' + 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_launcher/test.feature b/squishtests/suite_neptune3/tst_launcher/test.feature new file mode 100644 index 00000000..750d77bb --- /dev/null +++ b/squishtests/suite_neptune3/tst_launcher/test.feature @@ -0,0 +1,45 @@ +Feature: The launcher bar is configurable + + The launcher bar is highly configurable. + Sorted in a natural way the first items are + 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 tapped + Then the grid should be 'opened' + 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 '' is tabbed and move index '' up and '' right + And the '' app index has increased by '' + 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_launcher/test.py b/squishtests/suite_neptune3/tst_launcher/test.py new file mode 100644 index 00000000..53e5d84a --- /dev/null +++ b/squishtests/suite_neptune3/tst_launcher/test.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +############################################################################ +## +## Copyright (C) 2019 Luxoft Sweden AB +## Copyright (C) 2018 Pelagicore AG +## 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_main_menu_widgets/steps/widget_operations.py b/squishtests/suite_neptune3/tst_main_menu_widgets/steps/widget_operations.py deleted file mode 100644 index 23d0ab82..00000000 --- a/squishtests/suite_neptune3/tst_main_menu_widgets/steps/widget_operations.py +++ /dev/null @@ -1,145 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################ -## -## Copyright (C) 2019 Luxoft Sweden AB -## Copyright (C) 2018 Pelagicore AG -## 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.settings as settings -import common.app as app -import common.qml_names as qml - -# squish dependent -import names - - -@OnFeatureStart -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): - snooze(seconds) - addWidget_popup = names.neptune_3_UI_Center_Console_addWidgetPopupItem_AddWidgetPopup - # test.compare(volume_popup.exists) something funny?? - try: - waitForObjectExists(addWidget_popup, settings.G_WAIT_FOR_INEXISTANCE_MS) - except Exception: - test.compare(True, True, "add widget popup closed!") - else: - 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!") - - -@When("add map is tapped") -def step(context): - addWidgetItem_maps = waitForObject(names.widgetList_AddWidgets_Maps) - tapObject(addWidgetItem_maps) - - -@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, - "'" + 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 deleted file mode 100644 index 1d53deec..00000000 --- a/squishtests/suite_neptune3/tst_main_menu_widgets/test.feature +++ /dev/null @@ -1,23 +0,0 @@ -Feature: Main menu widget changes - - From main menu it is possible to change the widget, - they are positioned horizontally. - - Scenario: Open and close add new widget popup - - Given main menu is open - Then add widget was tapped - And the new widget dialogue appeared - When the popup close button is clicked - Then the add widget popup should not be there after '1' seconds of closing animation - - Scenario: Add new widget maps - - Given main menu is open - Then add widget was tapped - And the new widget dialogue appeared - When add map is tapped - 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 - diff --git a/squishtests/suite_neptune3/tst_main_menu_widgets/test.py b/squishtests/suite_neptune3/tst_main_menu_widgets/test.py deleted file mode 100644 index 53e5d84a..00000000 --- a/squishtests/suite_neptune3/tst_main_menu_widgets/test.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################ -## -## Copyright (C) 2019 Luxoft Sweden AB -## Copyright (C) 2018 Pelagicore AG -## 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_popup_climate/steps/popup_climate.py b/squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py deleted file mode 100644 index 789b86ce..00000000 --- a/squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py +++ /dev/null @@ -1,118 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################ -## -## Copyright (C) 2019 Luxoft Sweden AB -## Copyright (C) 2018 Pelagicore AG -## 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.app as app # to switch context -import common.settings as settings # waiting duration - -# squish -import names - - -@OnFeatureStart -def hook(context): - start_neptune_ui_app_w_focus("console") - - -@Given("the climate area is tapped") -def step(context): - app.switch_to_app('climate') - climateMouseArea = squish.waitForObjectExists( - names.climateAreaMouseArea_MouseArea) - squish.tapObject(climateMouseArea) - - -@When("the '|word|' climate slider is moved '|word|'") -def step(context, leftRight, change): - if not context.userData: - context.userData = {} - - 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) - - -@Then("the climate slider value on the '|word|' should '|word|'") -def step(context, leftRight, change): - if not context.userData: - context.userData = {} - - before_value = 0 - current_value = 0 - if leftRight == 'left': - before_value = context.userData['leftSliderValue'] - climate_slider_left = squish.waitForObjectExists( - names.leftTempSlider_TemperatureSlider) - current_value = climate_slider_left.value - else: - before_value = context.userData['rightSliderValue'] - 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) - - if change == 'increase': - 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 deleted file mode 100644 index 88eb9e3b..00000000 --- a/squishtests/suite_neptune3/tst_popup_climate/test.feature +++ /dev/null @@ -1,12 +0,0 @@ -Feature: Test the climate popup features - - The climate popup has certain functionality. - This will be tested here. - - 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 '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 deleted file mode 100644 index 53e5d84a..00000000 --- a/squishtests/suite_neptune3/tst_popup_climate/test.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################ -## -## Copyright (C) 2019 Luxoft Sweden AB -## Copyright (C) 2018 Pelagicore AG -## 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_popup_menus/steps/go_to_menu_steps.py b/squishtests/suite_neptune3/tst_popup_menus/steps/go_to_menu_steps.py deleted file mode 100644 index 84c082ae..00000000 --- a/squishtests/suite_neptune3/tst_popup_menus/steps/go_to_menu_steps.py +++ /dev/null @@ -1,100 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################ -## -## Copyright (C) 2019 Luxoft Sweden AB -## Copyright (C) 2018 Pelagicore AG -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the Neptune 3 IVI UI. -## -## $QT_BEGIN_LICENSE:GPL-QTAS$ -## Commercial License Usage -## Licensees holding valid commercial Qt Automotive Suite licenses may use -## this file in accordance with the commercial license agreement provided -## with the Software or, alternatively, in accordance with the terms -## contained in a written agreement between you and The Qt Company. For -## licensing terms and conditions see https://www.qt.io/terms-conditions. -## For further information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 or (at your option) any later version -## approved by the KDE Free Qt Foundation. The licenses are as published by -## the Free Software Foundation and appearing in the file LICENSE.GPL3 -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -## SPDX-License-Identifier: GPL-3.0 -## -############################################################################# - -import names - -@OnFeatureStart -def hook(context): - start_neptune_ui_app_w_focus("console") - -@OnScenarioEnd -#def hook(context): -# currentApplicationContext().detach() - - -@When("the volume button is tapped") -def step(context): - volume_icon = waitForObject(names.neptune_3_UI_Center_Console_volumePopupButton_ToolButton) - tapObject(volume_icon) - -@Then("the volume popup should appear") -def step(context): - volume_popup = names.neptune_3_UI_Center_Console_volumePopupItem_VolumePopup - is_enabled = waitForObjectExists(volume_popup).enabled - is_visible = waitForObjectExists(volume_popup).visible - test.compare( is_enabled and is_visible, True, "is both enabled and visible") - - -@Then("the volume popup should not be there after '|integer|' seconds of closing animation") -def step(context,seconds): - exists = is_squish_object_there(names.neptune_3_UI_Center_Console_volumePopupItem_VolumePopup,seconds) - if exists: - test.compare(True,False," volume popup is still there!") - else: - test.compare(True,True,"volume popup closed!") - - -@When("the volume slider is moved 'upwards'") -def step(context): - if not context.userData: - context.userData = {} - - volumeSlider = waitForObject(names.neptune_3_UI_Center_Console_volumeSlider_Slider) - context.userData['VolumeSliderValue'] = volumeSlider.value - - start_point = QPoint(8.13, 55.83) - movement = QPoint(0, -31) - - ts_point = coord_transform2D(start_point) - ts_movement = coord_transform2D(movement) - - touchAndDrag(volumeSlider, ts_point.x, ts_point.y, ts_movement.x, ts_movement.y) - - -@Then("the volume slider value should be '|word|'") -def step(context,change): - before_value = context.userData['VolumeSliderValue'] - - volumeSlider = waitForObject(names.neptune_3_UI_Center_Console_volumeSlider_Slider) - current_value = volumeSlider.value - - test.log("Before: " + str(before_value) + " now: " + str(current_value)) - - is_now_smaller = (current_value < before_value) - is_equal = (current_value == before_value) - - if change == 'increased': - test.compare(not is_now_smaller and not is_equal, True, "has greater value") - else: # decreased - test.compare(is_now_smaller, True, "has smaller value") diff --git a/squishtests/suite_neptune3/tst_popup_menus/test.feature b/squishtests/suite_neptune3/tst_popup_menus/test.feature deleted file mode 100644 index 532256ca..00000000 --- a/squishtests/suite_neptune3/tst_popup_menus/test.feature +++ /dev/null @@ -1,21 +0,0 @@ -Feature: Test the popups - - From main menu some popups are directly accessible. - Just test if they open - - Scenario: Open and close the volume popup - - Given main menu is open - When the volume button is tapped - Then the volume popup should appear - When the popup close button is clicked - Then the volume popup should not be there after '1' seconds of closing animation - - Scenario: Change the volume - - Given main menu is open - When 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 deleted file mode 100644 index 53e5d84a..00000000 --- a/squishtests/suite_neptune3/tst_popup_menus/test.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################ -## -## Copyright (C) 2019 Luxoft Sweden AB -## Copyright (C) 2018 Pelagicore AG -## 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_volume/steps/volume_slider.py b/squishtests/suite_neptune3/tst_volume/steps/volume_slider.py new file mode 100644 index 00000000..84c082ae --- /dev/null +++ b/squishtests/suite_neptune3/tst_volume/steps/volume_slider.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- + +############################################################################ +## +## Copyright (C) 2019 Luxoft Sweden AB +## Copyright (C) 2018 Pelagicore AG +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the Neptune 3 IVI UI. +## +## $QT_BEGIN_LICENSE:GPL-QTAS$ +## Commercial License Usage +## Licensees holding valid commercial Qt Automotive Suite licenses may use +## this file in accordance with the commercial license agreement provided +## with the Software or, alternatively, in accordance with the terms +## contained in a written agreement between you and The Qt Company. For +## licensing terms and conditions see https://www.qt.io/terms-conditions. +## For further information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 or (at your option) any later version +## approved by the KDE Free Qt Foundation. The licenses are as published by +## the Free Software Foundation and appearing in the file LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +## SPDX-License-Identifier: GPL-3.0 +## +############################################################################# + +import names + +@OnFeatureStart +def hook(context): + start_neptune_ui_app_w_focus("console") + +@OnScenarioEnd +#def hook(context): +# currentApplicationContext().detach() + + +@When("the volume button is tapped") +def step(context): + volume_icon = waitForObject(names.neptune_3_UI_Center_Console_volumePopupButton_ToolButton) + tapObject(volume_icon) + +@Then("the volume popup should appear") +def step(context): + volume_popup = names.neptune_3_UI_Center_Console_volumePopupItem_VolumePopup + is_enabled = waitForObjectExists(volume_popup).enabled + is_visible = waitForObjectExists(volume_popup).visible + test.compare( is_enabled and is_visible, True, "is both enabled and visible") + + +@Then("the volume popup should not be there after '|integer|' seconds of closing animation") +def step(context,seconds): + exists = is_squish_object_there(names.neptune_3_UI_Center_Console_volumePopupItem_VolumePopup,seconds) + if exists: + test.compare(True,False," volume popup is still there!") + else: + test.compare(True,True,"volume popup closed!") + + +@When("the volume slider is moved 'upwards'") +def step(context): + if not context.userData: + context.userData = {} + + volumeSlider = waitForObject(names.neptune_3_UI_Center_Console_volumeSlider_Slider) + context.userData['VolumeSliderValue'] = volumeSlider.value + + start_point = QPoint(8.13, 55.83) + movement = QPoint(0, -31) + + ts_point = coord_transform2D(start_point) + ts_movement = coord_transform2D(movement) + + touchAndDrag(volumeSlider, ts_point.x, ts_point.y, ts_movement.x, ts_movement.y) + + +@Then("the volume slider value should be '|word|'") +def step(context,change): + before_value = context.userData['VolumeSliderValue'] + + volumeSlider = waitForObject(names.neptune_3_UI_Center_Console_volumeSlider_Slider) + current_value = volumeSlider.value + + test.log("Before: " + str(before_value) + " now: " + str(current_value)) + + is_now_smaller = (current_value < before_value) + is_equal = (current_value == before_value) + + if change == 'increased': + test.compare(not is_now_smaller and not is_equal, True, "has greater value") + else: # decreased + test.compare(is_now_smaller, True, "has smaller value") diff --git a/squishtests/suite_neptune3/tst_volume/test.feature b/squishtests/suite_neptune3/tst_volume/test.feature new file mode 100644 index 00000000..fc5851e3 --- /dev/null +++ b/squishtests/suite_neptune3/tst_volume/test.feature @@ -0,0 +1,20 @@ +Feature: Test the popups + + From the home screen the volume popup is directly accessible. + + Scenario: Open and close the volume popup + + Given main menu is open + 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 + + Scenario: Change the volume + + Given main menu is open + 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_volume/test.py b/squishtests/suite_neptune3/tst_volume/test.py new file mode 100644 index 00000000..53e5d84a --- /dev/null +++ b/squishtests/suite_neptune3/tst_volume/test.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +############################################################################ +## +## Copyright (C) 2019 Luxoft Sweden AB +## Copyright (C) 2018 Pelagicore AG +## 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') -- cgit v1.2.3