~nskaggs/ubuntu-calendar-app/dev3

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): nskaggs, Kunal Parmar
  • Date: 2014-08-01 13:44:28 UTC
  • mfrom: (282.1.39 NewEvent-Contact)
  • Revision ID: tarmac-20140801134428-xrmyikasawmebrz0
Bug #1295941
User can only add one guest to the Guests input box for a New Event

Now we are showing contact picker to add guest.

Approved by Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
483
483
    def _fill_location(self, value):
484
484
        self._ensure_entry_field_visible_and_write('eventLocationInput', value)
485
485
 
486
 
    def _fill_guests(self, value):
487
 
        if len(value) > 1:
488
 
            # See bug http://pad.lv/1295941
489
 
            raise CalendarException(
490
 
                'It is not yet possible to add more than one guest.')
491
 
        self._ensure_entry_field_visible_and_write(
492
 
            'eventPeopleInput', value[0])
 
486
    def _fill_guests(self, guests):
 
487
        guests_btn = self.select_single('Button', objectName='addGuestButton')
 
488
        main_view = self.get_root_instance().select_single(MainView)
 
489
 
 
490
        for guest in guests:
 
491
            self.pointing_device.click_object(guests_btn)
 
492
            guest_input = main_view.select_single(
 
493
                NewEventEntryField, objectName='contactPopoverInput')
 
494
            contacts = main_view.select_single(ubuntuuitoolkit.QQuickListView,
 
495
                                               objectName='contactPopoverList')
 
496
            guest_input.write(guest)
 
497
 
 
498
            try:
 
499
                contacts.click_element('contactPopoverList0')
 
500
            except ubuntuuitoolkit.ToolkitException:
 
501
                raise CalendarException('No guest found with name %s' % guest)
493
502
 
494
503
    def _select_calendar(self, calendar):
495
504
        self._get_calendar().select_option('Label', text=calendar)
498
507
        return self.select_single(ubuntuuitoolkit.OptionSelector,
499
508
                                  objectName="calendarsOption")
500
509
 
 
510
    def _get_guests(self):
 
511
        guestlist = self.select_single('QQuickColumn', objectName='guestList')
 
512
        guests = guestlist.select_many('Standard')
 
513
        guest_names = []
 
514
        for guest in guests:
 
515
            guest_names.append(guest.text)
 
516
        return guest_names
 
517
 
501
518
    def _get_form_values(self):
502
519
        # TODO get start date and end date, is all day event, recurrence and
503
520
        # reminders. --elopio - 2014-06-26
505
522
        name = self._get_new_event_entry_field('newEventName').text
506
523
        description = self._get_description_text_area().text
507
524
        location = self._get_new_event_entry_field('eventLocationInput').text
508
 
        # TODO once bug http://pad.lv/1295941 is fixed, we will have to build
509
 
        # the list of guests. --elopio - 2014-06-26
510
 
        guests = [self._get_new_event_entry_field('eventPeopleInput').text]
 
525
        guests = self._get_guests()
511
526
        return data.Event(calendar, name, description, location, guests)
512
527
 
513
528
    @autopilot.logging.log_action(logger.info)