~mihirsoni/ubuntu-calendar-app/dateSelectNewEventTest

« back to all changes in this revision

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

  • Committer: Mihir Soni
  • Date: 2014-10-23 22:44:56 UTC
  • Revision ID: mihirsoni.123@gmail.com-20141023224456-2j0wago6tbis6eyp
Date select while creating new event

Show diffs side-by-side

added added

removed removed

Lines of Context:
546
546
class NewEvent(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
547
547
 
548
548
    """Autopilot helper for the New Event page."""
549
 
 
 
549
    
550
550
    @autopilot.logging.log_action(logger.info)
551
551
    def add_event(self, event_information):
552
552
        """Add a new event.
570
570
        """
571
571
        # TODO fill start date and end date, is all day event, recurrence and
572
572
        # reminders. --elopio - 2014-06-26
573
 
        date = self.select_many(NewEventEntryField,objectName='dateInput')
574
 
        self.pointing_device.click_object(date[1])
575
 
        #date.print_tree()
576
 
        picker = self.select_single("DatePicker")
577
 
        date_to_pick= datetime.date(2014, 10, 30)
578
 
        picker.pick_date(date_to_pick)
 
573
        # self._fill_from_date()
 
574
        # self._fill_to_date()
 
575
        if event_information.startDate is not None:
 
576
            self._fill_date(event_information.startDate, 'fromPicker')
 
577
        if event_information.endDate is not None:
 
578
            self._fill_date(event_information.endDate, 'toPicker')
579
579
        if event_information.calendar is not None:
580
580
            self._select_calendar(event_information.calendar)
581
581
        if event_information.name is not None:
587
587
        if event_information.guests is not None:
588
588
            self._fill_guests(event_information.guests)
589
589
 
 
590
    def _fill_date(self, date, object_name):
 
591
        picker = self.select_single(
 
592
            "NewEventTimePicker",
 
593
            objectName=object_name)
 
594
        dateButton = picker.select_single(
 
595
            NewEventEntryField,
 
596
            objectName="dateInput")
 
597
        self.pointing_device.click_object(dateButton)
 
598
        main_view = self.get_root_instance().select_single(MainView)
 
599
        picker = main_view.wait_select_single("DatePicker")
 
600
        date_to_pick= datetime.date(date.year, date.month, date.day)
 
601
        picker.pick_date(date_to_pick)
 
602
        self.pointing_device.click_object(dateButton)
 
603
 
590
604
    def _fill_name(self, value):
591
605
        self._ensure_entry_field_visible_and_write('newEventName', value)
592
606