diff options
author | Sven Kroemeke <skroemeke@luxoft.com> | 2018-09-26 17:06:17 +0200 |
---|---|---|
committer | Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com> | 2018-10-18 09:34:07 +0000 |
commit | 56be33601e142db05bce8799e8987886e70ea3f3 (patch) | |
tree | 4fad8d5fb5ae845ebabbc065d659bc3dfbc15516 /squishtests | |
parent | f3fe6919cabf131d10265c53ec4fbb0daeeb5329 (diff) |
[squish] Added climate bar tests
Task-number: AUTOSUITE-659
Change-Id: Ie88c22f411628eb9daf101432302d40507c9f70c
Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
Diffstat (limited to 'squishtests')
3 files changed, 159 insertions, 0 deletions
diff --git a/squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py b/squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py new file mode 100644 index 00000000..82a5541e --- /dev/null +++ b/squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- + +############################################################################ +## +## Copyright (C) 2018 Luxoft GmbH +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the Neptune 3 IVI UI. +## +## $QT_BEGIN_LICENSE:GPL-QTAS$ +## Commercial License Usage +## Licensees holding valid commercial Qt Automotive Suite licenses may use +## this file in accordance with the commercial license agreement provided +## with the Software or, alternatively, in accordance with the terms +## contained in a written agreement between you and The Qt Company. For +## licensing terms and conditions see https://www.qt.io/terms-conditions. +## For further information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 or (at your option) any later version +## approved by the KDE Free Qt Foundation. The licenses are as published by +## the Free Software Foundation and appearing in the file LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +## SPDX-License-Identifier: GPL-3.0 +## +############################################################################# + +import names + + +@OnFeatureStart +def hook(context): + start_neptune_ui_app_w_focus("console") + + + +def get_left_temperature_slider_Value(): + return waitForObjectExists(names.neptune_UI_Center_Console_leftTempSlider_TemperatureSlider).value + +def get_right_temperature_slider_Value(): + return waitForObjectExists(names.neptune_UI_Center_Console_rightTempSlider_TemperatureSlider).value + + +@Given("the climate area is tapped") +def step(context): + climateMouseArea = waitForObjectExists(names.neptune_3_UI_Center_Console_squish_climateBarMouseArea_MouseArea) + tapObject(climateMouseArea) + + + +@When("the left climate slider is moved downwards") +def step(context): + if not context.userData: + context.userData = {} + context.userData['leftSliderValue'] = get_left_temperature_slider_Value() + toggle_left = waitForObject(names.neptune_UI_Center_Console_handle_Image) + + good, midth = get_middle_of_object(toggle_left) + if good: + downwards_delta = QPoint(3, -235) + touchAndDrag(toggle_left, midth.x, midth.y, downwards_delta.x, downwards_delta.y) + + +@When("the right climate slider is moved upwards") +def step(context): + if not context.userData: + context.userData = {} + + context.userData['rightSliderValue'] = get_right_temperature_slider_Value() + toggle_right = waitForObject(names.neptune_UI_Center_Console_handle_Image_3) + good, midth = get_middle_of_object(toggle_right) + + if good: + upwards_delta = QPoint(0, -300) + touchAndDrag(toggle_right, midth.x, midth.y, upwards_delta.x, upwards_delta.y) + + +@Then("the climate slider value on the '|word|' should '|word|'") +def step(context,leftRight,change): + if leftRight == 'left': + before_value = context.userData['leftSliderValue'] + current_value = get_left_temperature_slider_Value() + else: + before_value = context.userData['rightSliderValue'] + current_value = get_right_temperature_slider_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") + 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 new file mode 100644 index 00000000..4371eb9e --- /dev/null +++ b/squishtests/suite_neptune3/tst_popup_climate/test.feature @@ -0,0 +1,19 @@ +Feature: Test the climate popup features + + The climate popup has certain functionality. + This will be tested here. + + Scenario: test the climate slider left slide downward + + Given main menu is open + And the climate area is tapped + When the left climate slider is moved downwards2 + Then the climate slider value on the 'left' should 'decrease' + + Scenario: test the climate slider right slide downwards + + Given main menu is open + And the climate icon is tapped + + When the right climate slider is moved upwards + Then the climate slider value on the 'right' should 'increase' diff --git a/squishtests/suite_neptune3/tst_popup_climate/test.py b/squishtests/suite_neptune3/tst_popup_climate/test.py new file mode 100644 index 00000000..07c9da36 --- /dev/null +++ b/squishtests/suite_neptune3/tst_popup_climate/test.py @@ -0,0 +1,39 @@ +############################################################################ +## +## Copyright (C) 2018 Luxoft GmbH +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the Neptune 3 IVI UI. +## +## $QT_BEGIN_LICENSE:GPL-QTAS$ +## Commercial License Usage +## Licensees holding valid commercial Qt Automotive Suite licenses may use +## this file in accordance with the commercial license agreement provided +## with the Software or, alternatively, in accordance with the terms +## contained in a written agreement between you and The Qt Company. For +## licensing terms and conditions see https://www.qt.io/terms-conditions. +## For further information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 or (at your option) any later version +## approved by the KDE Free Qt Foundation. The licenses are as published by +## the Free Software Foundation and appearing in the file LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +## SPDX-License-Identifier: GPL-3.0 +## +############################################################################# + +source(findFile('scripts', 'python/bdd.py')) + +setupHooks('../shared/scripts/bdd_hooks.py') +collectStepDefinitions('./steps', '../shared/steps') + +def main(): + testSettings.throwOnFailure = True + runFeatureFile('test.feature') |