diff options
Diffstat (limited to 'squishtests/suite_neptune3/tst_popup_climate')
3 files changed, 66 insertions, 51 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 index 4a65d4f3..787ab097 100644 --- a/squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py +++ b/squishtests/suite_neptune3/tst_popup_climate/steps/popup_climate.py @@ -14,7 +14,8 @@ ## 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. +## 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 @@ -31,6 +32,10 @@ ## ############################################################################# +import common.app as app # to switch context +import common.settings as settings # waiting duration + +# squish import names @@ -39,63 +44,75 @@ 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_climateBarMouseArea_MouseArea) - tapObject(climateMouseArea) + app.switch_to_app('climate') + climateMouseArea = squish.waitForObjectExists( + names.climateAreaMouseArea_MouseArea) + squish.tapObject(climateMouseArea) - -@When("the left climate slider is moved downwards") -def step(context): +@When("the '|word|' climate slider is moved '|word|'") +def step(context, leftRight, change): 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) + 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) -@When("the right climate slider is moved upwards") -def step(context): + +@Then("the climate slider value on the '|word|' should '|word|'") +def step(context, leftRight, change): 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): + before_value = 0 + current_value = 0 if leftRight == 'left': before_value = context.userData['leftSliderValue'] - current_value = get_left_temperature_slider_Value() + climate_slider_left = squish.waitForObjectExists( + names.leftTempSlider_TemperatureSlider) + current_value = climate_slider_left.value else: before_value = context.userData['rightSliderValue'] - current_value = get_right_temperature_slider_Value() + 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) + 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") + 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 index 4371eb9e..88eb9e3b 100644 --- a/squishtests/suite_neptune3/tst_popup_climate/test.feature +++ b/squishtests/suite_neptune3/tst_popup_climate/test.feature @@ -3,17 +3,10 @@ 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 + 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 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' + 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 index 07c9da36..ef8c8127 100644 --- a/squishtests/suite_neptune3/tst_popup_climate/test.py +++ b/squishtests/suite_neptune3/tst_popup_climate/test.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + ############################################################################ ## ## Copyright (C) 2018 Luxoft GmbH @@ -12,7 +14,8 @@ ## 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. +## 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 @@ -30,10 +33,12 @@ ############################################################################# 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') |