~chris.gagnon/+junk/messaging-ap-test

« back to all changes in this revision

Viewing changes to tests/autopilot/messaging_app/tests/test_messaging.py

  • Committer: chris.gagnon
  • Date: 2014-02-14 05:40:21 UTC
  • Revision ID: chris.gagnon@canonical.com-20140214054021-r6kitlysphj4px0h
add a couple more tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
581
581
        self.thread_list.select_single('Label', text=message1)
582
582
 
583
583
    def test_contact_predictive_text(self):
 
584
        """test predictive text when selecting contact"""
584
585
        self.main_view.click_new_message_button()
585
586
        self.assertThat(self.thread_list.visible, Eventually(Equals(False)))
586
587
 
592
593
                        Eventually(Equals('Aaa')))
593
594
 
594
595
    def test_send_text_to_contact_with_more_than_one_number(self):
 
596
        """Send a text to a contact with more than one number"""
595
597
        message = 'Aa get this'
596
598
 
597
599
        self.main_view.click_new_message_button()
601
603
 
602
604
        self.main_view.type_message(message)
603
605
 
604
 
        # send
605
606
        self.main_view.click_send_button()
606
607
 
607
608
        # verify that we get a bubble with our message
628
629
        self.thread_list.select_single('Label', text='Mobile')
629
630
        # verify our text
630
631
        self.thread_list.select_single('Label', text=message)
 
632
 
 
633
    def test_more_than_one_message_to_contact_with_more_than_one_number(self):
 
634
        """Send more than one message to a contact with more than one number"""
 
635
        self.main_view.click_new_message_button()
 
636
        self.assertThat(self.thread_list.visible, Eventually(Equals(False)))
 
637
 
 
638
        self.main_view.type_contact_phone_num('1')
 
639
        self.main_view.type_message('message1')
 
640
 
 
641
        self.main_view.click_send_button()
 
642
 
 
643
        self.assertThat(self.main_view.get_header().title,
 
644
                        Eventually(Equals('Aa')))
 
645
 
 
646
        # switch back to main page with thread list
 
647
        self.main_view.close_osk()
 
648
        self.main_view.go_back()
 
649
 
 
650
        # verify the main page with the contacts that have sent messages is
 
651
        # visible
 
652
        self.assertThat(self.thread_list.visible, Eventually(Equals(True)))
 
653
 
 
654
        # verify a message in the thread list
 
655
        self.assertThat(self.thread_list.count, Equals(1))
 
656
        # verify our number
 
657
        self.thread_list.select_single('Label', text='Aa')
 
658
        self.thread_list.select_single('Label', text='message1')
 
659
 
 
660
        # make second message
 
661
        self.main_view.click_new_message_button()
 
662
        self.assertThat(self.thread_list.visible, Eventually(Equals(False)))
 
663
 
 
664
        self.main_view.type_contact_phone_num('9')
 
665
        self.main_view.type_message('message9')
 
666
 
 
667
        self.main_view.click_send_button()
 
668
 
 
669
        self.assertThat(self.main_view.get_header().title,
 
670
                        Eventually(Equals('Aa')))
 
671
 
 
672
        # switch back to main page with thread list
 
673
        self.main_view.close_osk()
 
674
        self.main_view.go_back()
 
675
 
 
676
        # verify the main page with the contacts that have sent messages is
 
677
        # visible
 
678
        self.assertThat(self.thread_list.visible, Eventually(Equals(True)))
 
679
 
 
680
        # verify a message in the thread list
 
681
        self.assertThat(self.thread_list.count, Equals(2))
 
682
        # verify our number
 
683
        self.thread_list.select_many('Label', text='Aa')
 
684
        self.thread_list.select_single('Label', text='message1')
 
685
        self.thread_list.select_single('Label', text='message9')