def test_receive_active_sync_email(self):
        # setup ActiveSync account
        email = Email(self.marionette)
        email.launch()

        email.setup_active_sync_email(self.testvars['email']['ActiveSync'])

        # wait for sync to complete
        email.wait_for_emails_to_sync()

        # Touch home button to exit email app
        self.device.touch_home_button()

        # send email to active sync account
        mock_email = MockEmail(
            senders_email=self.testvars['email']['IMAP']['email'],
            recipients_email=self.testvars['email']['ActiveSync']['email'])
        EmailUtil().send(self.testvars['email']['IMAP'], mock_email)

        self.marionette.switch_to_frame()
        system = System(self.marionette)

        # Wait for email notification
        system.wait_for_notification_toaster_displayed(timeout=60)
        system.wait_for_notification_toaster_not_displayed()

        # Expand the notification bar
        system.wait_for_status_bar_displayed()
        utility_tray = system.open_utility_tray()
        utility_tray.wait_for_notification_container_displayed()

        # Assert there is one notification is listed in notifications-container
        notifications = utility_tray.notifications
        self.assertEqual(1, len(notifications), 'Expected one notification.')
        email = notifications[0].tap_notification()

        self.wait_for_condition(
            lambda m: self.apps.displayed_app.name == "E-Mail")
        self.apps.switch_to_displayed_app()

        # check if the sender's email address is fine
        self.assertEqual(
            email.senders_email, mock_email.senders_email,
            'Senders\'s email on the inbox screen is incorrect. '
            'Expected email is %s. Actual email is %s.' %
            (mock_email.senders_email, email.senders_email))

        # check if the subject is fine
        self.assertEqual(
            email.subject, mock_email.subject,
            'Senders\'s email on the inbox scrseen is incorrect. '
            'Expected subject is %s. Actual subject is %s.' %
            (mock_email.subject, email.subject))

        # check if the email message is fine
        self.assertEqual(
            email.body, mock_email.message,
            'Email message on read email screen is incorrect. '
            'Expected message is "%s". Actual message is '
            '"%s".' % (mock_email.message, email.body))
예제 #2
0
    def test_IMAP_email_notification(self):
        """ https://moztrap.mozilla.org/manage/case/10744/"""
        # setup email account
        self.email.setup_IMAP_email(self.environment.email['imap'],
                                    self.environment.email['smtp'])

        # check account has emails
        self.email.wait_for_emails_to_sync()
        self.assertGreater(len(self.email.mails), 0)

        # Touch home button to exit email app
        self.device.touch_home_button()

        # send email to IMAP account
        mock_email = MockEmail(self.environment.host['smtp']['email'],
                               self.environment.email['imap']['email'])
        EmailUtil().send(self.environment.host['smtp'], mock_email)

        self.marionette.switch_to_frame()
        system = System(self.marionette)

        # Wait for email notification
        system.wait_for_notification_toaster_displayed(timeout=60,
                                                       for_app='email')
        system.wait_for_notification_toaster_not_displayed()

        system.wait_for_status_bar_displayed()
        utility_tray = system.open_utility_tray()

        notifications = utility_tray.get_notifications(for_app='email')
        self.assertEqual(1, len(notifications),
                         'Expected one email notification.')
        email = notifications[0].tap_notification()

        email.wait_to_be_displayed()
        self.apps.switch_to_displayed_app()

        # Wait for senders email to be shown
        email.wait_for_senders_email_displayed()

        # check if the sender's email address is fine
        self.assertEqual(
            email.senders_email, mock_email['from'],
            'Senders\'s email on the inbox screen is incorrect. '
            'Expected email is %s. Actual email is %s.' %
            (mock_email['from'], email.senders_email))

        # check if the subject is fine
        self.assertEqual(
            email.subject, mock_email['subject'],
            'Senders\'s email on the inbox screen is incorrect. '
            'Expected subject is %s. Actual subject is %s.' %
            (mock_email['subject'], email.subject))

        # check if the email message is fine
        self.assertEqual(
            email.body, mock_email['message'],
            'Email message on read email screen is incorrect. '
            'Expected message is "%s". Actual message is '
            '"%s".' % (mock_email['message'], email.body))
예제 #3
0
    def test_IMAP_email_notification(self):
        """ https://moztrap.mozilla.org/manage/case/10744/"""
        # setup email account
        self.email.setup_IMAP_email(self.testvars['email']['IMAP'])

        # check account has emails
        self.email.wait_for_emails_to_sync()
        self.assertGreater(len(self.email.mails), 0)

        # Touch home button to exit email app
        self.device.touch_home_button()

        # send email to IMAP account
        mock_email = MockEmail(
            senders_email=self.testvars['email']['IMAP']['email'],
            recipients_email=self.testvars['email']['IMAP']['email'])
        EmailUtil().send(self.testvars['email']['IMAP'], mock_email)

        self.marionette.switch_to_frame()
        system = System(self.marionette)

        # Wait for email notification
        system.wait_for_notification_toaster_displayed(timeout=60)
        system.wait_for_notification_toaster_not_displayed()

        # Expand the notification bar
        system.wait_for_status_bar_displayed()
        utility_tray = system.open_utility_tray()
        utility_tray.wait_for_notification_container_displayed()

        # Assert there is one notification and is listed in notifications-container
        notifications = utility_tray.notifications
        self.assertEqual(1, len(notifications), 'Expected one notification.')
        email = notifications[0].tap_notification()

        self.wait_for_condition(
            lambda m: self.apps.displayed_app.name == self.email.name)
        self.apps.switch_to_displayed_app()

        # check if the sender's email address is fine
        self.assertEqual(
            email.senders_email, mock_email.senders_email,
            'Senders\'s email on the inbox screen is incorrect. '
            'Expected email is %s. Actual email is %s.' %
            (mock_email.senders_email, email.senders_email))

        # check if the subject is fine
        self.assertEqual(
            email.subject, mock_email.subject,
            'Senders\'s email on the inbox screen is incorrect. '
            'Expected subject is %s. Actual subject is %s.' %
            (mock_email.subject, email.subject))

        # check if the email message is fine
        self.assertEqual(
            email.body, mock_email.message,
            'Email message on read email screen is incorrect. '
            'Expected message is "%s". Actual message is '
            '"%s".' % (mock_email.message, email.body))
예제 #4
0
    def test_receive_active_sync_email(self):
        # setup ActiveSync account
        email = Email(self.marionette)
        email.launch()

        email.setup_active_sync_email(self.testvars['email']['ActiveSync'])

        # wait for sync to complete
        email.wait_for_emails_to_sync()

        # send email to active sync account
        mock_email = MockEmail(
            senders_email=self.testvars['email']['IMAP']['email'],
            recipients_email=self.testvars['email']['ActiveSync']['email'])
        EmailUtil().send(self.testvars['email']['IMAP'], mock_email)

        # wait for the email to arrive
        email.wait_for_email(mock_email.subject)

        # check if the sender's email address is fine
        self.assertEqual(
            email.mails[0].senders_email, mock_email.senders_email,
            'Senders\'s email on the inbox screen is incorrect. '
            'Expected email is %s. Actual email is %s.' %
            (mock_email.senders_email, email.mails[0].senders_email))

        # check if the subject is fine
        self.assertEqual(
            email.mails[0].subject, mock_email.subject,
            'Senders\'s email on the inbox scrseen is incorrect. '
            'Expected subject is %s. Actual subject is %s.' %
            (mock_email.subject, email.mails[0].subject))

        # open the email to read it
        email = email.mails[0].tap_subject()

        # check if the sender's email address is fine
        self.assertEqual(
            email.senders_email, mock_email.senders_email,
            'Senders\'s email on the inbox screen is incorrect. '
            'Expected email is %s. Actual email is %s.' %
            (mock_email.senders_email, email.senders_email))

        # check if the subject is fine
        self.assertEqual(
            email.subject, mock_email.subject,
            'Senders\'s email on the inbox scrseen is incorrect. '
            'Expected subject is %s. Actual subject is %s.' %
            (mock_email.subject, email.subject))

        # check if the email message is fine
        self.assertEqual(
            email.body, mock_email.message,
            'Email message on read email screen is incorrect. '
            'Expected message is "%s". Actual message is '
            '"%s".' % (mock_email.message, email.body))