aboutsummaryrefslogtreecommitdiffstats
path: root/squishtests
diff options
context:
space:
mode:
authorSven Kroemeke <skroemeke@luxoft.com>2019-05-07 14:22:34 +0200
committerBramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>2019-05-13 08:42:22 +0000
commit907d90ea05332a36c07bda01ef98cb9e189afb4d (patch)
tree68e5fa1741d1b3d58293a2072187fae5bd78d86b /squishtests
parent5f70869be8e1d563dc2edea90f704bab6095fe9f (diff)
[squish] add calendar top monthly view test
Functionality test of the monthly calendar view - only looking into month changes by button navigation. Change-Id: Icda5c6f00041676b3887825e0c85eb395131fb92 Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
Diffstat (limited to 'squishtests')
-rw-r--r--squishtests/suite_neptune3/shared/scripts/names.py3
-rw-r--r--squishtests/suite_neptune3/tst_app_calendar/steps/app_calendar.py50
-rw-r--r--squishtests/suite_neptune3/tst_app_calendar/test.feature22
3 files changed, 74 insertions, 1 deletions
diff --git a/squishtests/suite_neptune3/shared/scripts/names.py b/squishtests/suite_neptune3/shared/scripts/names.py
index bdec035b..baf8cb49 100644
--- a/squishtests/suite_neptune3/shared/scripts/names.py
+++ b/squishtests/suite_neptune3/shared/scripts/names.py
@@ -197,3 +197,6 @@ roofOpenButton_ToolButton = {"container": container_vehicle, "objectName": "roof
vehicleDoorLeft_OpenCloseButton_ToolButton = {"container": container_vehicle, "objectName": "vehicleDoorLeft_OpenCloseButton", "type": "ToolButton", "visible": True}
vehicleDoorRight_OpenCloseButton_ToolButton = {"container": container_vehicle, "objectName": "vehicleDoorRight_OpenCloseButton", "type": "ToolButton", "visible": True}
trunk_OpenCloseButton_ToolButton = {"container": container_vehicle, "objectName": "trunk_OpenCloseButton", "type": "ToolButton", "visible": True}
+topCalendarMonthlyViewPreviousButton = {"container": container_calendar, "objectName": "topCalendarMonthlyViewPreviousButton", "type": "ToolButton", "visible": True}
+topCalendarGrid = {"container": container_calendar, "objectName": "topCalendarGrid", "type": "MonthGrid", "visible": True}
+topCalendarMonthlyViewNextButton = {"container": container_calendar, "objectName": "topCalendarMonthlyViewNextButton", "type": "ToolButton", "visible": True}
diff --git a/squishtests/suite_neptune3/tst_app_calendar/steps/app_calendar.py b/squishtests/suite_neptune3/tst_app_calendar/steps/app_calendar.py
index 9bbc1c8f..1f4dcb0a 100644
--- a/squishtests/suite_neptune3/tst_app_calendar/steps/app_calendar.py
+++ b/squishtests/suite_neptune3/tst_app_calendar/steps/app_calendar.py
@@ -35,6 +35,7 @@
import names
import common.app as app
import common.qml_names as qml
+import __builtin__
# all variable ui elements in a single dict, though qml_names definitions
@@ -48,6 +49,11 @@ variable_calendar_ui = {
'view': qml.calendar_view['next']}
}
+top_buttons_calendar_ui = {
+ 'previous': names.topCalendarMonthlyViewPreviousButton,
+ 'next': names.topCalendarMonthlyViewNextButton
+}
+
@OnFeatureStart
def hook(context):
@@ -83,8 +89,50 @@ def step(context, view_name):
app.switch_to_app('calendar')
squish.snooze(0.25)
- view_stack_layout = waitForObject(names.calendarViewContent)
+ view_stack_layout = squish.waitForObject(names.calendarViewContent)
current_index = view_stack_layout.currentIndex
stack_layouts = object.children(view_stack_layout)
current_name = stack_layouts[current_index].objectName
test.compare(current_name, compare_name, "calendar views")
+
+
+@When("store current month viewed")
+def step(context):
+ if not context.userData:
+ context.userData = {}
+
+ app.switch_to_app('calendar')
+ squish.snooze(0.25)
+
+ grid_for_info = squish.waitForObject(names.topCalendarGrid)
+ current_month = __builtin__.int(str(grid_for_info.month))
+ context.userData['month'] = current_month
+
+
+@Then("tap on '|word|' button in monthly view")
+def step(context, button_name):
+ if not context.userData:
+ context.userData = {}
+
+ if button_name not in top_buttons_calendar_ui.keys():
+ app.fail("in calendar, the button '"
+ + button_name
+ + "' is not known!")
+ return
+ button = top_buttons_calendar_ui[button_name]
+ month_delta = 1 if (top_buttons_calendar_ui.keys()[0]
+ == button_name) else -1
+
+ app.switch_to_app('calendar')
+ squish.snooze(0.25)
+
+ squish.tapObject(button)
+
+ squish.snooze(0.5)
+ grid_for_info = squish.waitForObject(names.topCalendarGrid)
+
+ month_now = __builtin__.int(str(grid_for_info.month))
+ month_before = context.userData['month']
+
+ month_change = (month_before + month_delta) % 12
+ app.compare(str(month_change + 1), str(month_now + 1), " month changes")
diff --git a/squishtests/suite_neptune3/tst_app_calendar/test.feature b/squishtests/suite_neptune3/tst_app_calendar/test.feature
index 767eb8b4..82c6f309 100644
--- a/squishtests/suite_neptune3/tst_app_calendar/test.feature
+++ b/squishtests/suite_neptune3/tst_app_calendar/test.feature
@@ -24,3 +24,25 @@ Feature: Test calendar app functionality
| events |
| year |
| next |
+
+
+ Scenario Outline: Switch through the month view on top
+ Given main menu is open
+ And 'calendar' app from launcher tapped
+ And switch app to 'calendar'
+ When store current month viewed
+ Then tap on '<change>' button in monthly view
+
+ Examples:
+ | change |
+ | previous |
+ | previous |
+ | previous |
+ | previous |
+ | previous |
+ | previous |
+ | next |
+ | next |
+ | next |
+ | next |
+