class TestSetupManualEmail(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.connect_to_network() self.email = Email(self.marionette) self.email.launch() def test_setup_imap_email(self): # setup IMAP account self.email.setup_IMAP_email(self.testvars['email']['IMAP']) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0)
class TestSetupActiveSync(GaiaTestCase): def setUp(self): try: self.testvars['email']['ActiveSync'] except KeyError: raise SkipTest('account details not present in test variables') GaiaTestCase.setUp(self) self.connect_to_network() def test_setup_active_sync_email(self): # setup ActiveSync account self.email = Email(self.marionette) self.email.launch() self.email.setup_active_sync_email( self.testvars['email']['ActiveSync']) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # wait for sync to complete self.email.wait_for_emails_to_sync()
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=30) 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.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))
class TestSetupAndSendIMAPEmail(GaiaTestCase): def setUp(self): email = GaiaTestEnvironment(self.testvars).email if not email.get('imap'): raise SkipTest( 'IMAP account details not present in test variables.') elif not email.get('smtp'): raise SkipTest( 'SMTP account details not present in test variables.') GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_setup_and_send_imap_email(self): """ https://moztrap.mozilla.org/manage/case/6113/ https://moztrap.mozilla.org/manage/case/6114/ """ # setup IMAP account self.email.setup_IMAP_email(self.environment.email['imap'], self.environment.email['smtp']) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) # Bug 878772 - email app doesn't show the last emails by default self.email.mails[0].scroll_to_message() curr_time = repr(time.time()).replace('.', '') _subject = 's%s' % curr_time _body = 'b%s' % curr_time new_email = self.email.header.tap_compose() new_email.type_to(self.environment.email['imap']['email']) new_email.type_subject(_subject) new_email.type_body(_body) self.email = new_email.tap_send() self.email.wait_for_email(_subject) self.email.wait_for_search_textbox_displayed() # tap the email that has the expected subject read_email = self.email.tap_email_subject(_subject) self.assertEqual(_body, read_email.body.splitlines()[0]) self.assertEqual(_subject, read_email.subject)
class TestSetupAndSendIMAPEmail(GaiaTestCase): def setUp(self): try: self.account = self.testvars['email']['IMAP'] except KeyError: raise SkipTest('account details not present in test variables') GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_setup_and_send_imap_email(self): """ https://moztrap.mozilla.org/manage/case/6113/ https://moztrap.mozilla.org/manage/case/6114/ """ # setup IMAP account self.email.setup_IMAP_email(self.account) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) # Bug 878772 - email app doesn't show the last emails by default self.email.mails[0].scroll_to_message() curr_time = repr(time.time()).replace('.', '') _subject = 's%s' % curr_time _body = 'b%s' % curr_time new_email = self.email.header.tap_compose() new_email.type_to(self.testvars['email']['IMAP']['email']) new_email.type_subject(_subject) new_email.type_body(_body) self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh self.email.wait_for_email(_subject) # make sure the search textbox is not diplayed self.email.wait_for_search_textbox_hidden() # tap the email that has the expected subject read_email = self.email.tap_email_subject(_subject) self.assertEqual(_body, read_email.body.splitlines()[0]) self.assertEqual(_subject, read_email.subject)
class TestSetupAndSendIMAPEmail(GaiaTestCase): def setUp(self): try: self.account = self.testvars['email']['IMAP'] except KeyError: raise SkipTest('account details not present in test variables') GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_setup_and_send_imap_email(self): """ https://moztrap.mozilla.org/manage/case/6113/ https://moztrap.mozilla.org/manage/case/6114/ """ # setup IMAP account self.email.setup_IMAP_email(self.account) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) # Bug 878772 - email app doesn't show the last emails by default self.email.mails[0].scroll_to_message() curr_time = repr(time.time()).replace('.', '') _subject = 's%s' % curr_time _body = 'b%s' % curr_time new_email = self.email.header.tap_compose() new_email.type_to(self.testvars['email']['IMAP']['email']) new_email.type_subject(_subject) new_email.type_body(_body) self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh self.email.wait_for_email(_subject) # go through emails list and tap the email that has the expected subject for mail in self.email.mails: if mail.subject == _subject: read_email = mail.tap_subject() break self.assertEqual(_body, read_email.body.splitlines()[0]) self.assertEqual(_subject, read_email.subject)
class TestSetupGmail(GaiaTestCase): email_configured = False def setUp(self): GaiaTestCase.setUp(self) self.connect_to_network() self.email = Email(self.marionette) self.email.launch() def test_setup_basic_gmail(self): # setup basic gmail account self.email.basic_setup_email(self.testvars['email']['gmail']['name'], self.testvars['email']['gmail']['email'], self.testvars['email']['gmail']['password']) self.email_configured = True # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) def tearDown(self): if self.email_configured: self.email.delete_email_account(0) GaiaTestCase.tearDown(self)
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))
class TestSetupGmail(GaiaTestCase): def setUp(self): try: self.testvars['email']['gmail'] except KeyError: raise SkipTest('account details not present in test variables') GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_setup_basic_gmail(self): # setup basic gmail account self.email.basic_setup_email('Gmail account', self.testvars['email']['gmail']['email'], self.testvars['email']['gmail']['password']) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0)
class TestSetupAndSendIMAPEmail(GaiaTestCase): def setUp(self): try: self.account = self.testvars["email"]["IMAP"] except KeyError: raise SkipTest("account details not present in test variables") GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_setup_and_send_imap_email(self): """ https://moztrap.mozilla.org/manage/case/6113/ https://moztrap.mozilla.org/manage/case/6114/ """ # setup IMAP account self.email.setup_IMAP_email(self.account) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, "Inbox") # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) # Bug 878772 - email app doesn't show the last emails by default self.email.mails[0].scroll_to_message() curr_time = repr(time.time()).replace(".", "") _subject = "s%s" % curr_time _body = "b%s" % curr_time new_email = self.email.header.tap_compose() new_email.type_to(self.testvars["email"]["IMAP"]["email"]) new_email.type_subject(_subject) new_email.type_body(_body) self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh self.email.wait_for_email(_subject) # go through emails list and tap the email that has the expected subject for mail in self.email.mails: if mail.subject == _subject: read_email = mail.tap_subject() break self.assertEqual(_body, read_email.body.splitlines()[0]) self.assertEqual(_subject, read_email.subject)
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))
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))
class TestSetupAndSendIMAPEmail(GaiaTestCase): def setUp(self): try: self.account = self.testvars['email']['IMAP'] except KeyError: raise SkipTest('account details not present in test variables') GaiaTestCase.setUp(self) self.connect_to_network() self.email = Email(self.marionette) self.email.launch() def test_setup_and_send_imap_email(self): # setup IMAP account self.email.setup_IMAP_email(self.account) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) # Bug 878772 - email app doesn't show the last emails by default self.email.mails[0].scroll_to_message() curr_time = repr(time.time()).replace('.', '') _subject = 's%s' % curr_time _body = 'b%s' % curr_time new_email = self.email.header.tap_compose() new_email.type_to(self.testvars['email']['IMAP']['email']) new_email.type_subject(_subject) new_email.type_body(_body) self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh self.email.wait_for_email(_subject) # assert that the email app subject is in the email list self.assertIn(_subject, [mail.subject for mail in self.email.mails]) read_email = self.email.mails[0].tap_subject() self.assertEqual(_body, read_email.body) self.assertEqual(_subject, read_email.subject)
class TestSetupAndSendIMAPEmail(GaiaTestCase): def setUp(self): try: self.account = self.testvars['email']['IMAP'] except KeyError: raise SkipTest('account details not present in test variables') GaiaTestCase.setUp(self) self.connect_to_network() self.email = Email(self.marionette) self.email.launch() def test_setup_and_send_imap_email(self): # setup IMAP account self.email.setup_IMAP_email(self.account) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) # Bug 878772 - email app doesn't show the last emails by default self.email.mails[0].scroll_to_message() curr_time = repr(time.time()).replace('.', '') _subject = 's%s' % curr_time _body = 'b%s' % curr_time new_email = self.email.header.tap_compose() new_email.type_to(self.testvars['email']['IMAP']['email']) new_email.type_subject(_subject) new_email.type_body(_body) self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh self.email.wait_for_email(_subject) # assert that the email app subject is in the email list self.assertIn(_subject, [mail.subject for mail in self.email.mails]) read_email = self.email.mails[0].tap_subject() self.assertEqual(_body, read_email.body.splitlines()[0]) self.assertEqual(_subject, read_email.subject)
class TestSetupAndSendActiveSyncEmail(GaiaTestCase): def setUp(self): try: self.account = self.testvars['email']['ActiveSync'] except KeyError: raise SkipTest('account details not present in test variables') GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_setup_and_send_active_sync_email(self): """ https://moztrap.mozilla.org/manage/case/2474/ https://moztrap.mozilla.org/manage/case/2475/ """ # setup ActiveSync account self.email.setup_active_sync_email(self.account) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # wait for sync to complete self.email.wait_for_emails_to_sync() curr_time = repr(time.time()).replace('.', '') _subject = 's%s' % curr_time _body = 'b%s' % curr_time new_email = self.email.header.tap_compose() new_email.type_to(self.testvars['email']['ActiveSync']['email']) new_email.type_subject(_subject) new_email.type_body(_body) self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh self.email.wait_for_email(_subject) # assert that the email app subject is in the email list self.assertIn(_subject, [mail.subject for mail in self.email.mails]) read_email = self.email.mails[0].tap_subject() self.assertEqual(_body, read_email.body) self.assertEqual(_subject, read_email.subject)
class TestSetupAndSendActiveSyncEmail(GaiaTestCase): def setUp(self): try: self.account = self.testvars['email']['ActiveSync'] except KeyError: raise SkipTest('account details not present in test variables') GaiaTestCase.setUp(self) self.connect_to_network() self.email = Email(self.marionette) self.email.launch() def test_setup_and_send_active_sync_email(self): """ https://moztrap.mozilla.org/manage/case/2474/ https://moztrap.mozilla.org/manage/case/2475/ """ # setup ActiveSync account self.email.setup_active_sync_email(self.account) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # wait for sync to complete self.email.wait_for_emails_to_sync() curr_time = repr(time.time()).replace('.', '') _subject = 's%s' % curr_time _body = 'b%s' % curr_time new_email = self.email.header.tap_compose() new_email.type_to(self.testvars['email']['ActiveSync']['email']) new_email.type_subject(_subject) new_email.type_body(_body) self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh self.email.wait_for_email(_subject) # assert that the email app subject is in the email list self.assertIn(_subject, [mail.subject for mail in self.email.mails]) read_email = self.email.mails[0].tap_subject() self.assertEqual(_body, read_email.body) self.assertEqual(_subject, read_email.subject)
class TestOnlyOneHeaderDisplayed(GaiaTestCase): def setUp(self): email = GaiaTestEnvironment(self.testvars).email if not email.get('imap'): raise SkipTest( 'IMAP account details not present in test variables.') elif not email.get('smtp'): raise SkipTest( 'SMTP account details not present in test variables.') GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_only_one_header_displayed(self): """ https://bugzilla.mozilla.org/show_bug.cgi?id=1116087 """ self.email.setup_IMAP_email(self.environment.email['imap'], self.environment.email['smtp']) self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) email_header_list = self.marionette.find_elements( *self.email.emails_list_header_locator) self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header') self.device.hold_home_button() cards_view = CardsView(self.marionette) cards_view.wait_for_cards_view() cards_view.wait_for_card_ready(self.email.name) cards_view.close_app(self.email.name) self.assertFalse( cards_view.is_app_displayed(self.email.name), '%s app should not be present in cards view' % self.email.name) self.assertEqual(len(cards_view.cards), 0, 'Should have no cards left to display') Wait(self.marionette).until( lambda m: self.apps.displayed_app.name == Homescreen.name) self.email.launch() self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) email_header_list = self.marionette.find_elements( *self.email.emails_list_header_locator) self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header')
class TestSetupAndSendActiveSyncEmail(GaiaTestCase): def setUp(self): if not GaiaTestEnvironment(self.testvars).email.get('activesync'): raise SkipTest( 'ActiveSync account details not present in test variables.') GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_setup_and_send_active_sync_email(self): """ https://moztrap.mozilla.org/manage/case/2474/ https://moztrap.mozilla.org/manage/case/2475/ """ # setup ActiveSync account self.email.setup_active_sync_email( self.environment.email['activesync']) # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # wait for sync to complete self.email.wait_for_emails_to_sync() curr_time = repr(time.time()).replace('.', '') _subject = 's%s' % curr_time _body = 'b%s' % curr_time new_email = self.email.header.tap_compose() new_email.type_to(self.environment.email['activesync']['email']) new_email.type_subject(_subject) new_email.type_body(_body) self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh self.email.wait_for_email(_subject) read_email = self.email.tap_email_subject(_subject) self.assertEqual(_body, read_email.body) self.assertEqual(_subject, read_email.subject)
class TestSetupManualEmail(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.connect_to_network() self.email = Email(self.marionette) self.email.launch() def test_setup_imap_email(self): # setup IMAP account setup = self.email.tap_manual_setup() setup.type_name(self.testvars['email']['IMAP']['name']) setup.type_email(self.testvars['email']['IMAP']['email']) setup.type_password(self.testvars['email']['IMAP']['password']) setup.select_account_type('IMAP+SMTP') setup.type_imap_hostname(self.testvars['email']['IMAP']['imap_hostname']) setup.type_imap_name(self.testvars['email']['IMAP']['imap_name']) setup.type_imap_port(self.testvars['email']['IMAP']['imap_port']) setup.type_smtp_hostname(self.testvars['email']['IMAP']['smtp_hostname']) setup.type_smtp_name(self.testvars['email']['IMAP']['smtp_name']) setup.type_smtp_port(self.testvars['email']['IMAP']['smtp_port']) setup.tap_next() setup.wait_for_setup_complete() setup.tap_continue() self.email.wait_for_header_area() # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) def tearDown(self): GaiaTestCase.tearDown(self)
class TestOnlyOneHeaderDisplayed(GaiaTestCase): def setUp(self): try: self.testvars['email']['imap'] self.testvars['email']['smtp'] except KeyError: raise SkipTest('account details not present in test variables') GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_only_one_header_displayed(self): """ https://bugzilla.mozilla.org/show_bug.cgi?id=1116087 """ self.email.setup_IMAP_email(self.testvars['email']['imap'], self.testvars['email']['smtp']) self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator) self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header') self.device.hold_home_button() cards_view = CardsView(self.marionette) cards_view.wait_for_cards_view() cards_view.wait_for_card_ready(self.email.name) cards_view.close_app(self.email.name) self.assertFalse(cards_view.is_app_displayed(self.email.name), '%s app should not be present in cards view' % self.email.name) self.assertEqual(len(cards_view.cards), 0, 'Should have no cards left to display') Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == Homescreen.name) self.email.launch() self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator) self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header')
class TestSendIMAPEmail(GaiaTestCase): def setUp(self): try: account = self.testvars['email']['IMAP'] except KeyError: raise SkipTest('account details not present in test variables') GaiaTestCase.setUp(self) self.connect_to_network() self.email = Email(self.marionette) self.email.launch() # setup IMAP account self.email.setup_IMAP_email(account) def test_send_imap_email(self): # Bug 878772 - email app doesn't show the last emails by default self.email.wait_for_emails_to_sync() self.email.mails[0].scroll_to_message() curr_time = repr(time.time()).replace('.', '') new_email = self.email.header.tap_compose() new_email.type_to(self.testvars['email']['IMAP']['email']) new_email.type_subject('test email %s' % curr_time) new_email.type_body('Lorem ipsum dolor sit amet %s' % curr_time) self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh self.email.wait_for_email('test email %s' % curr_time) # assert that the email app subject is in the email list self.assertIn('test email %s' % curr_time, [mail.subject for mail in self.email.mails]) read_email = self.email.mails[0].tap_subject() self.assertEqual('Lorem ipsum dolor sit amet %s' % curr_time, read_email.body) self.assertEqual('test email %s' % curr_time, read_email.subject)
class TestOnlyOneHeaderDisplayed(GaiaTestCase): def setUp(self): email = GaiaTestEnvironment(self.testvars).email if not email.get("imap"): raise SkipTest("IMAP account details not present in test variables.") elif not email.get("smtp"): raise SkipTest("SMTP account details not present in test variables.") GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_only_one_header_displayed(self): """ https://bugzilla.mozilla.org/show_bug.cgi?id=1116087 """ self.email.setup_IMAP_email(self.environment.email["imap"], self.environment.email["smtp"]) self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator) self.assertEqual(len(email_header_list), 1, "Should have only 1 list-header") self.device.hold_home_button() cards_view = CardsView(self.marionette) cards_view.wait_for_cards_view() cards_view.wait_for_card_ready(self.email.name) cards_view.close_app(self.email.name) self.assertFalse( cards_view.is_app_displayed(self.email.name), "%s app should not be present in cards view" % self.email.name ) self.assertEqual(len(cards_view.cards), 0, "Should have no cards left to display") Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == Homescreen.name) self.email.launch() self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator) self.assertEqual(len(email_header_list), 1, "Should have only 1 list-header")
class TestOnlyOneHeaderDisplayed(GaiaTestCase): def setUp(self): email = GaiaTestEnvironment(self.testvars).email if not email.get('imap'): raise SkipTest('IMAP account details not present in test variables.') elif not email.get('smtp'): raise SkipTest('SMTP account details not present in test variables.') GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_only_one_header_displayed(self): """ https://bugzilla.mozilla.org/show_bug.cgi?id=1116087 """ self.email.setup_IMAP_email(self.environment.email['imap'], self.environment.email['smtp']) self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator) self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header') self.device.hold_home_button() cards_view = CardsView(self.marionette) cards_view.wait_for_cards_view() cards_view.cards[0].wait_for_centered() cards_view.cards[0].close() self.assertEqual(len(cards_view.cards), 0, 'Should have no cards left to display') Homescreen(self.marionette).wait_to_be_displayed() self.email.launch() self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator) self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header')
class TestSendIMAPEmail(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.connect_to_network() self.email = Email(self.marionette) self.email.launch() # setup IMAP account self.email.setup_IMAP_email(self.testvars['email']['IMAP']) def test_send_imap_email(self): curr_time = repr(time.time()).replace('.', '') new_email = self.email.header.tap_compose() new_email.type_to(self.testvars['email']['IMAP']['email']) new_email.type_subject('test email %s' % curr_time) new_email.type_body('Lorem ipsum dolor sit amet %s' % curr_time) self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh time.sleep(10) self.email.toolbar.tap_refresh() self.email.wait_for_emails_to_sync() # assert that the email app subject is in the email list self.assertIn('test email %s' % curr_time, [mail.subject for mail in self.email.mails]) read_email = self.email.mails[0].tap_subject() self.assertEqual('Lorem ipsum dolor sit amet %s' % curr_time, read_email.body) self.assertEqual('test email %s' % curr_time, read_email.subject) def tearDown(self): GaiaTestCase.tearDown(self)
class TestSetupGmail(GaiaTestCase): email_configured = False def setUp(self): GaiaTestCase.setUp(self) self.connect_to_network() self.email = Email(self.marionette) self.email.launch() def test_setup_basic_gmail(self): # setup basic gmail account self.email.basic_setup_email( self.testvars['email']['gmail']['name'], self.testvars['email']['gmail']['email'], self.testvars['email']['gmail']['password']) self.email_configured = True # check header area self.assertTrue(self.email.header.is_compose_visible) self.assertTrue(self.email.header.is_menu_visible) self.assertEqual(self.email.header.label, 'Inbox') # check toolbar area self.assertTrue(self.email.toolbar.is_edit_visible) self.assertTrue(self.email.toolbar.is_refresh_visible) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) def tearDown(self): if self.email_configured: self.email.delete_email_account(0) GaiaTestCase.tearDown(self)
class TestSetupAndSendIMAPEmail(GaiaImageCompareTestCase): def setUp(self): if not GaiaTestEnvironment(self.testvars).email.get('imap'): raise SkipTest('IMAP account details not present in test variables.') if not GaiaTestEnvironment(self.testvars).email.get('smtp'): raise SkipTest('SMTP account details not present in test variables.') GaiaImageCompareTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_setup_and_send_imap_email(self): """Verify the Appearance of email app is proper. Refer to: https://moztrap.mozilla.org/manage/case/6113/ https://moztrap.mozilla.org/manage/case/6114/ """ # setup IMAP account self.setup_IMAP_email(self.environment.email['imap'], self.environment.email['smtp']) # take picture of the menu Wait(self.marionette).until(lambda m: self.email.header.is_menu_visible) self.email.wait_for_emails_to_sync() _subject = 'Testing Images' _body = 'The quick brown fox jumps over the lazy dog ~!@#$#%^&*)(_+ <>?,./:";[]{}\\' Wait(self.marionette).until(lambda m: self.email.header.is_compose_visible) new_email = self.email.header.tap_compose() self.take_screenshot() new_email.type_to(self.environment.email['imap']['email']) new_email.type_subject(_subject) new_email.type_body(_body) self.take_screenshot() # Commented out due to Bug 1131095 # Exit to homescreen # self.device.touch_home_button() # self.email.launch() self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh self.email.wait_for_email(_subject) read_email = self.email.tap_email_subject(_subject) Wait(self.marionette, timeout = 20).until( lambda m: _subject == read_email.subject) read_email.tap_move_button() self.take_screenshot() read_email.cancel_move() read_email.tap_reply_button() self.take_screenshot() read_email.cancel_reply() # delete the message to avoid using stale message in future runs read_email.tap_delete_button() self.take_screenshot() read_email.approve_delete() # moved from SetupEmail to embed screenshot commands def setup_IMAP_email(self, imap, smtp): basic_setup = SetupEmail(self.marionette) basic_setup.type_name('IMAP account') basic_setup.type_email(imap['email']) setup = self.email.tap_manual_setup() self.take_screenshot() setup.select_account_type('IMAP+SMTP') setup.type_imap_hostname(imap['hostname']) setup.type_imap_name(imap['username']) setup.type_imap_password(imap['password']) setup.type_imap_port(imap['port']) setup.type_smtp_hostname(smtp['hostname']) setup.type_smtp_name(smtp['username']) setup.type_smtp_password(smtp['password']) setup.type_smtp_port(smtp['port']) self.take_screenshot() setup.tap_next() self.take_screenshot() setup.check_for_emails_interval('20000') setup.tap_account_prefs_next() self.take_screenshot() setup.wait_for_setup_complete() setup.tap_continue() self.email.wait_for_message_list()
class TestEmailNotification(GaiaTestCase): def setUp(self): email = GaiaTestEnvironment(self.testvars).email if not email.get('imap'): raise SkipTest('IMAP account details not present in test variables.') elif not email.get('smtp'): raise SkipTest('SMTP account details not present in test variables.') GaiaTestCase.setUp(self) self.connect_to_local_area_network() # Open email app self.email = Email(self.marionette) self.email.launch() 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) 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() # 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)) def tearDown(self): self.data_layer.set_int_pref('dom.requestSync.minInterval', 100) GaiaTestCase.tearDown(self)
def test_receive_active_sync_email(self): # setup ActiveSync account email = Email(self.marionette) email.launch() email.setup_active_sync_email(self.environment.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(self.environment.host["smtp"]["email"], self.environment.email["activesync"]["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) 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["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 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), )
class TestEmailNotification(GaiaTestCase): def setUp(self): try: self.testvars['email']['IMAP'] except KeyError: raise SkipTest('account details not present in test variables') GaiaTestCase.setUp(self) self.connect_to_local_area_network() # Open email app self.email = Email(self.marionette) self.email.launch() 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))
def setupEmailAccount(self): # setup IMAP account email = Email(self.marionette) email.launch() m = self.marionette # setup email account imap = self.testvars['email']['IMAP'] basic_setup = SetupEmail(self.marionette) name_field = m.find_element(By.CSS_SELECTOR, 'section.card-setup-account-info input.sup-info-name') name_field.send_keys(imap['name']) time.sleep(1) email_field = m.find_element(By.CSS_SELECTOR, 'section.card-setup-account-info input.sup-info-email') email_field.tap() email.keyboard.send(imap['email']) # setup mail server information setup = email.tap_manual_setup() setup.type_imap_hostname(imap['imap_hostname']) setup.type_imap_name(imap['imap_name']) setup.type_imap_port(imap['imap_port']) _imap_password_locator = m.find_element(By.CSS_SELECTOR, 'section.card-setup-manual-config .sup-manual-composite-password') _imap_password_locator.clear() _imap_password_locator.send_keys(imap['password']) setup.type_smtp_hostname(imap['smtp_hostname']) setup.type_smtp_name(imap['smtp_name']) setup.type_smtp_port(imap['smtp_port']) _smtp_hostname_locator = m.find_element(By.CSS_SELECTOR, 'section.card-setup-manual-config .sup-manual-smtp-password') _smtp_hostname_locator.clear() _smtp_hostname_locator.send_keys(imap['password']) setup.tap_next() # setup remind frequency manual = m.find_element("css selector",'li[class="syncinterval-setting select-item"] > span[class="button icon icon-dialog"]') manual.tap() self.marionette.switch_to_frame() options = self.marionette.find_elements(By.CSS_SELECTOR, 'ol[class="value-selector-options-container"] > li') for li in options: if li.text == 'Every 5 minutes': li.tap() break for item in m.find_elements(By.CSS_SELECTOR, 'button.value-option-confirm'): if item.is_displayed() == True: item.tap() break self.apps.switch_to_displayed_app() setup.tap_account_prefs_next() setup.wait_for_setup_complete() setup.tap_continue() email.wait_for_message_list() # wait for sync to complete email.wait_for_emails_to_sync()
class TestEmailNotification(GaiaTestCase): def setUp(self): try: self.testvars["email"]["IMAP"] except KeyError: raise SkipTest("account details not present in test variables") GaiaTestCase.setUp(self) self.connect_to_local_area_network() # Open email app self.email = Email(self.marionette) self.email.launch() 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), )
class TestEmailNotification(GaiaTestCase): def setUp(self): email = GaiaTestEnvironment(self.testvars).email if not email.get('imap'): raise SkipTest( 'IMAP account details not present in test variables.') elif not email.get('smtp'): raise SkipTest( 'SMTP account details not present in test variables.') GaiaTestCase.setUp(self) self.connect_to_local_area_network() # Open email app self.email = Email(self.marionette) self.email.launch() 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) 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() # 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)) def tearDown(self): self.marionette.execute_script( "SpecialPowers.setIntPref('dom.requestSync.minInterval', 100);", special_powers=True) GaiaTestCase.tearDown(self)
class TestSetupAndSendIMAPEmail(GaiaImageCompareTestCase): def setUp(self): if not GaiaTestEnvironment(self.testvars).email.get('imap'): raise SkipTest( 'IMAP account details not present in test variables.') if not GaiaTestEnvironment(self.testvars).email.get('smtp'): raise SkipTest( 'SMTP account details not present in test variables.') GaiaImageCompareTestCase.setUp(self) self.connect_to_local_area_network() self.email = Email(self.marionette) self.email.launch() def test_setup_and_send_imap_email(self): """Verify the Appearance of email app is proper. Refer to: https://moztrap.mozilla.org/manage/case/6113/ https://moztrap.mozilla.org/manage/case/6114/ """ # setup IMAP account self.setup_IMAP_email(self.environment.email['imap'], self.environment.email['smtp']) # take picture of the menu Wait( self.marionette).until(lambda m: self.email.header.is_menu_visible) self.email.wait_for_emails_to_sync() _subject = 'Testing Images' _body = 'The quick brown fox jumps over the lazy dog ~!@#$#%^&*)(_+ <>?,./:";[]{}\\' Wait(self.marionette).until( lambda m: self.email.header.is_compose_visible) new_email = self.email.header.tap_compose() self.take_screenshot() new_email.type_to(self.environment.email['imap']['email']) new_email.type_subject(_subject) new_email.type_body(_body) self.take_screenshot() # Commented out due to Bug 1131095 # Exit to homescreen # self.device.touch_home_button() # self.email.launch() self.email = new_email.tap_send() # wait for the email to be sent before we tap refresh self.email.wait_for_email(_subject) read_email = self.email.tap_email_subject(_subject) Wait(self.marionette, timeout=20).until(lambda m: _subject == read_email.subject) read_email.tap_move_button() self.take_screenshot() read_email.cancel_move() read_email.tap_reply_button() self.take_screenshot() read_email.cancel_reply() # delete the message to avoid using stale message in future runs read_email.tap_delete_button() self.take_screenshot() read_email.approve_delete() # moved from SetupEmail to embed screenshot commands def setup_IMAP_email(self, imap, smtp): basic_setup = SetupEmail(self.marionette) basic_setup.type_name('IMAP account') basic_setup.type_email(imap['email']) setup = self.email.tap_manual_setup() self.take_screenshot() setup.select_account_type('IMAP+SMTP') setup.type_imap_hostname(imap['hostname']) setup.type_imap_name(imap['username']) setup.type_imap_password(imap['password']) setup.type_imap_port(imap['port']) setup.type_smtp_hostname(smtp['hostname']) setup.type_smtp_name(smtp['username']) setup.type_smtp_password(smtp['password']) setup.type_smtp_port(smtp['port']) self.take_screenshot() setup.tap_next() self.take_screenshot() setup.check_for_emails_interval('20000') setup.tap_account_prefs_next() self.take_screenshot() setup.wait_for_setup_complete() setup.tap_continue() self.email.wait_for_message_list()