~pkunal-parmar/ubuntu-calendar-app/ICalImport

« back to all changes in this revision

Viewing changes to tests/autopilot/calendar_app/__init__.py

New Calendar App management tests. Fixes: https://bugs.launchpad.net/bugs/1300354.

Approved by Ubuntu Phone Apps Jenkins Bot, Nicholas Skaggs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
        header.click_action_button('neweventbutton')
143
143
        return self.wait_select_single(NewEvent, objectName='newEventPage')
144
144
 
 
145
    @autopilot.logging.log_action(logger.info)
 
146
    def go_to_calendar_choice_popup(self):
 
147
        """Open the calendar chioce popup.
 
148
 
 
149
        :return: CalendaChoicePopup.
 
150
 
 
151
        """
 
152
        header = self.get_header()
 
153
        header.click_action_button('calendarsbutton')
 
154
        return self.wait_select_single(
 
155
            CalendarChoicePopup, objectName="calendarchoicepopup")
 
156
 
145
157
    def set_picker(self, field, mode, value):
146
158
        # open picker
147
159
        self.pointing_device.click_object(field)
285
297
        header = self.get_header()
286
298
        header.click_action_button('todaybutton')
287
299
 
 
300
    @autopilot.logging.log_action(logger.info)
 
301
    def get_color_picker_dialog(self):
 
302
        return self.wait_select_single(
 
303
            "ColorPickerDialog", objectName="colorPickerDialog")
 
304
 
 
305
    @autopilot.logging.log_action(logger.info)
 
306
    def press_header_custombackbutton(self):
 
307
        header = self.get_header()
 
308
        header.click_custom_back_button()
 
309
 
288
310
 
289
311
class YearView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
290
312
 
1003
1025
        delete_button = self.select_single(
1004
1026
            'Button', objectName='deleteEventButton')
1005
1027
        self.pointing_device.click_object(delete_button)
 
1028
 
 
1029
 
 
1030
class CalendarChoicePopup(
 
1031
        ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
 
1032
 
 
1033
    """Autopilot helper for the Calendar Choice Popup."""
 
1034
 
 
1035
    @autopilot.logging.log_action(logger.debug)
 
1036
    def press_check_box_button(self):
 
1037
        """ press check box button to select or unselect it """
 
1038
        calendar = self._get_calendar()
 
1039
        check_box = calendar.wait_select_single(
 
1040
            "CheckBox", objectName="checkBox")
 
1041
        self.pointing_device.click_object(check_box)
 
1042
        check_box.checked.wait_for(False)
 
1043
 
 
1044
    def _get_calendar(self):
 
1045
        calendarItems = self.select_many("Standard", objectName="calendarItem")
 
1046
        for item in calendarItems:
 
1047
            if item.select_single(
 
1048
                    "Label", objectName="calendarName").text == "Personal":
 
1049
                    return item
 
1050
 
 
1051
    @autopilot.logging.log_action(logger.debug)
 
1052
    def get_checkbox_status(self):
 
1053
        """ press check box button to select or unselect it """
 
1054
        calendar = self._get_calendar()
 
1055
        return calendar.wait_select_single(
 
1056
            "CheckBox", objectName="checkBox").checked
 
1057
 
 
1058
    @autopilot.logging.log_action(logger.debug)
 
1059
    def get_calendar_color(self):
 
1060
        """ get calendar color """
 
1061
        calendar = self._get_calendar()
 
1062
        return calendar.select_single(
 
1063
            "QQuickRectangle", objectName="calendarColorCode").color
 
1064
 
 
1065
    @autopilot.logging.log_action(logger.debug)
 
1066
    def open_color_picker_dialog(self):
 
1067
        """ press color rectangle to open calendar color picker"""
 
1068
        calendar = self._get_calendar()
 
1069
        color_rectangle = calendar.wait_select_single(
 
1070
            "QQuickRectangle", objectName="calendarColorCode")
 
1071
        self.pointing_device.click_object(color_rectangle)
 
1072
 
 
1073
 
 
1074
class ColorPickerDialog(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
 
1075
    """Autopilot helper for the Color Picker Dialog."""
 
1076
 
 
1077
    @autopilot.logging.log_action(logger.debug)
 
1078
    def change_calendar_color(self, new_color):
 
1079
        new_color_circle = self.wait_select_single(
 
1080
            "QQuickRectangle", objectName=new_color)
 
1081
        self.pointing_device.click_object(new_color_circle)