Esempio n. 1
0
    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.email = Email(self)

        # Get details of our test contacts.
        email1 = self.UTILS.general.get_config_variable(
            "gmail_1_email", "common")
        email2 = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")
        email3 = self.UTILS.general.get_config_variable(
            "hotmail_1_email", "common")
        self.contact = MockContact(email=[{
            'type': 'Personal',
            'value': email1
        }, {
            'type': 'Personal',
            'value': email2
        }, {
            'type': 'Personal',
            'value': email3
        }])
        """
        We're not testing adding a contact, so just stick one
        into the database.
        """

        self.UTILS.general.insertContact(self.contact)

        self._email_subject = "test " + str(time.time())
        self._email_message = "Test message"
Esempio n. 2
0
    def setUpEmail(self):

        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)

        self.email = Email(self)
        self.settings = Settings(self)
        self.browser = Browser(self)

        _ = setup_translations(self)

        # Create (and record) a unique 'subject'.
        self.subject = "test " + str(time.time())
        self.body = "This is the test email body."

        # Set up specific folder names.
        if "gmail" in self.test_type:
            self.UTILS.reporting.logComment("Gmail account being used.")
            self.sent_folder_name = _("Sent Mail")
        elif "exchange" in self.test_type:
            self.UTILS.reporting.logComment("Exchange account being used.")
            self.sent_folder_name = _("Sent Items")
        else:
            self.UTILS.reporting.logComment("Non-gmail account being used.")
            self.sent_folder_name = _("Sent")

        self.marionette.set_search_timeout(50)
Esempio n. 3
0
class test_main(GaiaTestCase):

    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        self.connect_to_network()

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.email.launch()
        self.email.setup_account(self.email_user, self.email_address, self.email_pass)

        # Create and send a new test message.
        self.messages.launch()
        test_msg = "Email address {} test at {}".format(self.emailAddy, time.time())
        self.data_layer.send_sms(self.phone_number, test_msg)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg, timeout=120)
        self.UTILS.statusbar.click_on_notification_detail(test_msg, DOM.Messages.frame_locator)
        sms = self.messages.last_message_in_this_thread()

        # Verify that the email address opens the email app.
        link = sms.find_element("tag name", "a")
        link.tap()
        self.wait_for_element_displayed(*DOM.Messages.header_send_message_btn, timeout=30)

        cancel = self.UTILS.element.getElement(DOM.Messages.contact_cancel_btn, "Cancel button")
        cancel.tap()

        # Go into edit mode.
        edit_btn = self.UTILS.element.getElement(DOM.Messages.edit_messages_icon, "Edit button")
        edit_btn.tap()

        # Select Messages mode
        select_msgs_btn = self.UTILS.element.getElement(DOM.Messages.edit_msgs_select_btn, "Select messages button")
        select_msgs_btn.tap()
        self.UTILS.element.waitForElements(DOM.Messages.edit_msgs_header, "Edit messages mode header")

        # Verify that the email address does not open the email app.
        sms = self.messages.last_message_in_this_thread()
        link = sms.find_element("tag name", "a")
        link.tap()

        # Now try to find the email app iframe.
        self.wait_for_element_not_displayed(*DOM.Messages.header_send_message_btn, timeout=30)
Esempio n. 4
0
class test_main(GaiaTestCase):

    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.Email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable("gmail_2_email", "common")

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Set up email account.
        self.connect_to_network()

        self.Email.launch()
        self.Email.setup_account(self.email_user, self.email_address, self.email_pass)

        # Launch messages app.
        self.messages.launch()

        # Create and send a new test message.
        msg_text = "Email one [email protected], two {} , three [email protected] at {}".\
                    format(self.emailAddy, time.time())
        self.data_layer.send_sms(self.phone_number, msg_text)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(msg_text, timeout=120)
        self.UTILS.statusbar.click_on_notification_detail(msg_text, DOM.Messages.frame_locator)
        sms = self.messages.last_message_in_this_thread()
        time.sleep(1)

        # Tap the 2nd email link.
        self.UTILS.reporting.logResult("info", "Click the email address in this message: '{}'.".format(sms.text))
        _link = sms.find_elements("tag name", "a")[1]
        _link.tap()

        # Click on "Send email" button from the overlay
        send_btn = self.UTILS.element.getElement(DOM.Messages.header_send_email_btn, "Send email button")
        send_btn.tap()

        # Switch to email frame and verify the email address is in the To field.
        self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator)
        x = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts, "To field")
        self.UTILS.test.test(x.text == self.emailAddy,
                             "To field contains '{}' (it was '{}').".format(self.emailAddy, self.emailAddy))
Esempio n. 5
0
class test_main(GaiaTestCase):

    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.dest_email = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common")

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Create and send a new test message.
        test_msg = "email address {} test at {}".format(self.dest_email, time.time())
        self.data_layer.send_sms(self.phone_number, test_msg)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg, timeout=120)
        self.UTILS.statusbar.click_on_notification_detail(test_msg, DOM.Messages.frame_locator)
        sms = self.messages.last_message_in_this_thread()
        time.sleep(1)

        # Tap the 2nd email link.
        self.UTILS.reporting.logResult("info", u"Click the email address in this message: '{}'.".format(sms.text))
        _link = sms.find_element("tag name", "a")
        _link.tap()

        send_btn = self.UTILS.element.getElement(DOM.Messages.header_send_email_btn, "Send email button")
        send_btn.tap()

        time.sleep(4)

        self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator)
        setup_confirm = self.UTILS.element.getElement(DOM.Email.email_not_setup_ok, "Set up account confirmation")
        setup_confirm.tap()

        # Try to set up the account - Since there is no connection, it will fail.
        self.email.setup_account_first_step(self.email_user, self.email_address)

        time.sleep(5)
        self.UTILS.iframe.switch_to_frame("data-url", "google")
        self.UTILS.element.getElement(('css selector', 'h1[data-l10n-id=unable-to-connect]'),
                                      "Unable to connect message")
Esempio n. 6
0
class test_main(GaiaTestCase):

    test_msg = "Test message."

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.Email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")
 
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable("gmail_2_email", "common")

        self.contact = MockContact(email = {'type': 'Personal', 'value': self.emailAddy})

        self.UTILS.general.insertContact(self.contact)

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Set up email account.
        self.connect_to_network()

        self.Email.launch()
        self.Email.setup_account(self.email_user, self.email_address, self.email_pass)

        # Launch messages app.
        self.messages.launch()

        # Create and send a new test message.
        self.messages.create_and_send_sms([self.phone_number], "Email {} one.".format(self.emailAddy))
        x = self.messages.wait_for_message()

        # Tap the email link.
        link = x.find_element("tag name", "a")
        link.tap()

        # Press 'add to existing contact' button.
        w = self.UTILS.element.getElement(DOM.Messages.header_send_email_btn, "Send email button")
        w.tap()

        # Switch to email frame and verify the email address is in the To field.
        self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator)
        x = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts, "To field")
        self.UTILS.test.test(x.text == self.emailAddy, 
                        "To field contains '{}' (it was '{}').".format(self.emailAddy, self.emailAddy))
Esempio n. 7
0
class test_main(GaiaTestCase):

    test_msg = "Test message."

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.Email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable("gmail_2_email", "common")

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Set up email account.
        self.connect_to_network()

        self.Email.launch()
        self.Email.setup_account(self.email_user, self.email_address, self.email_pass)

        # Launch messages app.
        self.messages.launch()

        # Create and send a new test message.
        self.messages.create_and_send_sms([self.phone_number], "Email {} one.".format(self.emailAddy))
        send_time = self.messages.last_sent_message_timestamp()
        last_msg = self.messages.wait_for_message(send_time)

        # Tap the email link.
        link = last_msg.find_element("tag name", "a")
        link.tap()

        edit_btn = self.UTILS.element.getElement(DOM.Messages.header_send_email_btn, "Edit button")
        edit_btn.tap()

        # Switch to email frame and verify the email address is in the To field.
        self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator)
        to_field = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts, "To field")
        self.UTILS.test.test(to_field.text == self.emailAddy,
                        "To field contains '{0}' (it was '{0}').".format(self.emailAddy))
Esempio n. 8
0
    def setUp(self):

        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.email = Email(self)

        self.user1 = self.UTILS.general.get_config_variable(
            "gmail_2_user", "common")
        self.email1 = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")
        self.passwd1 = self.UTILS.general.get_config_variable(
            "gmail_2_pass", "common")

        self.data_layer.connect_to_wifi()
Esempio n. 9
0
    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.dest_email = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common")
Esempio n. 10
0
    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.email = Email(self)
        self.loop = Loop(self)

        self.email_add = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_2_pass", "common")
        self.email_user = self.UTILS.general.get_config_variable("gmail_2_user", "common")

        # Get details of our test contacts.
        self.contact = MockContact()
        self.UTILS.general.insertContact(self.contact)
        self.data_layer.connect_to_wifi()

        result = self.loop.initial_test_checks()

        if result:
            self.loop.phone_login()
            self.loop.allow_permission_phone_login()
            self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view")

        self.email.launch()
        self.email.setup_account(self.email_user, self.email_add, self.email_pass)
        self.apps.kill_all()
        time.sleep(2)

        _ = setup_translations(self)
        self.expected_message = _("No problem! Just share the following link and they can call you back from"\
                                  " any browser.")
Esempio n. 11
0
    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.email = Email(self)

        # Get details of our test contacts.
        email1 = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        email2 = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        email3 = self.UTILS.general.get_config_variable("hotmail_1_email", "common")
        self.contact = MockContact(email=[{
            'type': 'Personal',
            'value': email1}, {
            'type': 'Personal',
            'value': email2}, {
            'type': 'Personal',
            'value': email3}
        ])
        """
        We're not testing adding a contact, so just stick one
        into the database.
        """

        self.UTILS.general.insertContact(self.contact)

        self._email_subject = "test " + str(time.time())
        self._email_message = "Test message"
Esempio n. 12
0
    def setUpEmail(self):

        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)

        self.email = Email(self)
        self.settings = Settings(self)
        self.browser = Browser(self)

        _ = setup_translations(self)

        # Create (and record) a unique 'subject'.
        self.subject = "test " + str(time.time())
        self.body = "This is the test email body."

        # Set up specific folder names.
        if "gmail" in self.test_type:
            self.UTILS.reporting.logComment("Gmail account being used.")
            self.sent_folder_name = _("Sent Mail")
        elif "exchange" in self.test_type:
            self.UTILS.reporting.logComment("Exchange account being used.")
            self.sent_folder_name = _("Sent Items")
        else:
            self.UTILS.reporting.logComment("Non-gmail account being used.")
            self.sent_folder_name = _("Sent")

        self.marionette.set_search_timeout(50)
Esempio n. 13
0
class test_main(GaiaTestCase):
    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.email = Email(self)

        self.user1 = self.UTILS.general.get_config_variable(
            "gmail_2_user", "common")
        self.email1 = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")
        self.passwd1 = self.UTILS.general.get_config_variable(
            "gmail_2_pass", "common")

        self.data_layer.connect_to_wifi()

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.email.launch()
        self.email.setup_account(self.user1, self.email1, self.passwd1)

        # Let's erase the first visible mail
        first_mail = self.email.mails()[0]
        _subject = first_mail.find_element(*DOM.Email.folder_subject_list).text
        self.UTILS.reporting.logComment("Deleting email with subject '" +
                                        _subject + "'.")
        self.email.delete_email(_subject)
Esempio n. 14
0
class test_main(GaiaTestCase):

    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.email = Email(self)

        self.user1 = self.UTILS.general.get_config_variable("gmail_2_user", "common")
        self.email1 = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        self.passwd1 = self.UTILS.general.get_config_variable("gmail_2_pass", "common")

        self.data_layer.connect_to_wifi()

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.email.launch()
        self.email.setup_account(self.user1, self.email1, self.passwd1)

        # Let's erase the first visible mail
        first_mail = self.email.mails()[0]
        _subject = first_mail.find_element(*DOM.Email.folder_subject_list).text
        self.UTILS.reporting.logComment("Deleting email with subject '" + _subject + "'.")
        self.email.delete_email(_subject)
Esempio n. 15
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable(
            "gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable(
            "gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable(
            "gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")
        self.connect_to_network()
Esempio n. 16
0
    def setUp(self):

        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.email = Email(self)

        self.user1 = self.UTILS.general.get_config_variable("gmail_2_user", "common")
        self.email1 = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        self.passwd1 = self.UTILS.general.get_config_variable("gmail_2_pass", "common")

        self.data_layer.connect_to_wifi()
Esempio n. 17
0
    def setUp(self):

        # Set up child objects...

        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.contacts = Contacts(self)
        self.email = Email(self)

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.emailE = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        self.emailP = self.UTILS.general.get_config_variable("gmail_2_pass", "common")
        self.emailU = self.UTILS.general.get_config_variable("gmail_2_user", "common")

        self.UTILS.general.add_file_to_device('./tests/_resources/contact_face.jpg')
        self.test_msg = "Test message."

        self.cont = MockContact()
        self.data_layer.delete_all_sms()
Esempio n. 18
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        self.connect_to_network()
Esempio n. 19
0
    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.email = Email(self)
        self.loop = Loop(self)

        self.email_add = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable(
            "gmail_2_pass", "common")
        self.email_user = self.UTILS.general.get_config_variable(
            "gmail_2_user", "common")

        # Get details of our test contacts.
        self.contact = MockContact()
        self.UTILS.general.insertContact(self.contact)
        self.data_layer.connect_to_wifi()

        result = self.loop.initial_test_checks()

        if result:
            self.loop.phone_login()
            self.loop.allow_permission_phone_login()
            self.UTILS.element.waitForElements(DOM.Loop.app_header,
                                               "Loop main view")

        self.email.launch()
        self.email.setup_account(self.email_user, self.email_add,
                                 self.email_pass)
        self.apps.kill_all()
        time.sleep(2)

        _ = setup_translations(self)
        self.expected_message = _("No problem! Just share the following link and they can call you back from"\
                                  " any browser.")
Esempio n. 20
0
    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.dest_email = self.UTILS.general.get_config_variable("gmail_2_email", "common")
Esempio n. 21
0
    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.Email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")
 
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable("gmail_2_email", "common")

        self.contact = MockContact(email = {'type': 'Personal', 'value': self.emailAddy})

        self.UTILS.general.insertContact(self.contact)
Esempio n. 22
0
class test_main(GaiaTestCase):

    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.email = Email(self)
        self.loop = Loop(self)

        self.email_add = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_2_pass", "common")
        self.email_user = self.UTILS.general.get_config_variable("gmail_2_user", "common")

        # Get details of our test contacts.
        self.contact = MockContact()
        self.UTILS.general.insertContact(self.contact)
        self.data_layer.connect_to_wifi()

        result = self.loop.initial_test_checks()

        if result:
            self.loop.phone_login()
            self.loop.allow_permission_phone_login()
            self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view")

        self.email.launch()
        self.email.setup_account(self.email_user, self.email_add, self.email_pass)
        self.apps.kill_all()
        time.sleep(2)

        _ = setup_translations(self)
        self.expected_message = _("No problem! Just share the following link and they can call you back from"\
                                  " any browser.")

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Launch contacts app.
        self.contacts.launch()
        self.contacts.view_contact(self.contact['name'])
        video_btn = self.marionette.find_element(DOM.Contacts.view_contact_hello_option[0],
                                                 DOM.Contacts.view_contact_hello_option[1].format("video"))
        video_btn.tap()
        self.loop.share_micro_and_camera()
        self.wait_for_element_displayed(*DOM.Loop.not_a_user_explanation, timeout=10)
        not_a_user_explanation = self.marionette.find_element(*DOM.Loop.not_a_user_explanation)
        self.UTILS.test.test(not_a_user_explanation.text == self.expected_message, "Message found: {} (Expected: {}".\
                             format(not_a_user_explanation.text, self.expected_message))

        share_options = self.UTILS.element.getElements(DOM.Loop.share_link_options, "Sharing options")
        self.UTILS.test.test(len(share_options) == 3, "There are {} sharing options (Expected: 3)".\
                             format(len(share_options)))
        share_by_email = self.UTILS.element.getElement(DOM.Loop.share_panel_email_share, "Share by Email")
        share_by_email.tap()
        self.UTILS.iframe.switch_to_frame(*DOM.Email.frame_locator)
        time.sleep(2)

        # Modify the message subject
        subject = self.UTILS.element.getElement(DOM.Email.compose_subject, "Subject input").get_attribute("value")
        self.UTILS.reporting.debug("*** Email Subject before editing: {}".format(subject))
        new_subject = " Editing subject"
        expected = subject + new_subject
        self.UTILS.general.typeThis(DOM.Email.compose_subject, "Subject input area", new_subject, p_clear=False,
                                    p_validate=False)
        subject_after = self.UTILS.element.getElement(DOM.Email.compose_subject, "Subject input").\
                                                        get_attribute("value")
        self.UTILS.test.test(expected == subject_after, "Expected subject: {} Actual subject: {}".\
                            format(expected, subject_after))

        # Modify the message body
        msg_body = self.UTILS.element.getElement(DOM.Email.compose_msg, "Input message area").text
        self.UTILS.reporting.debug("*** Email Body before editing: {}".format(msg_body))
        new_text = " This is more test in the Email"
        expected = msg_body + new_text
        self.UTILS.general.typeThis(DOM.Email.compose_msg, "Input message area",
                                   new_text, p_clear=False, p_validate=False)
        msg_body_after = self.UTILS.element.getElement(DOM.Email.compose_msg, "Input message area").text
        self.UTILS.test.test(expected == msg_body_after, "Expected text: {} Actual text: {}".\
                            format(expected, msg_body_after))
Esempio n. 23
0
class test_main(GaiaTestCase):
    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.email = Email(self)
        self.loop = Loop(self)

        self.email_add = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable(
            "gmail_2_pass", "common")
        self.email_user = self.UTILS.general.get_config_variable(
            "gmail_2_user", "common")

        # Get details of our test contacts.
        self.contact = MockContact()
        self.UTILS.general.insertContact(self.contact)
        self.data_layer.connect_to_wifi()

        result = self.loop.initial_test_checks()

        if result:
            self.loop.phone_login()
            self.loop.allow_permission_phone_login()
            self.UTILS.element.waitForElements(DOM.Loop.app_header,
                                               "Loop main view")

        self.email.launch()
        self.email.setup_account(self.email_user, self.email_add,
                                 self.email_pass)
        self.apps.kill_all()
        time.sleep(2)

        _ = setup_translations(self)
        self.expected_message = _("No problem! Just share the following link and they can call you back from"\
                                  " any browser.")

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Launch contacts app.
        self.contacts.launch()
        self.contacts.view_contact(self.contact['name'])
        video_btn = self.marionette.find_element(
            DOM.Contacts.view_contact_hello_option[0],
            DOM.Contacts.view_contact_hello_option[1].format("video"))
        video_btn.tap()
        self.loop.share_micro_and_camera()
        self.wait_for_element_displayed(*DOM.Loop.not_a_user_explanation,
                                        timeout=10)
        not_a_user_explanation = self.marionette.find_element(
            *DOM.Loop.not_a_user_explanation)
        self.UTILS.test.test(not_a_user_explanation.text == self.expected_message, "Message found: {} (Expected: {}".\
                             format(not_a_user_explanation.text, self.expected_message))

        share_options = self.UTILS.element.getElements(
            DOM.Loop.share_link_options, "Sharing options")
        self.UTILS.test.test(len(share_options) == 3, "There are {} sharing options (Expected: 3)".\
                             format(len(share_options)))
        share_by_email = self.UTILS.element.getElement(
            DOM.Loop.share_panel_email_share, "Share by email")
        share_by_email.tap()
        self.UTILS.iframe.switch_to_frame(*DOM.Email.frame_locator)
        to_address = self.UTILS.element.getElement(
            DOM.Email.compose_to_from_contacts, "Recipient Address")
        self.UTILS.test.test(to_address.text == self.contact['email']['value'], "Recipient address: {} Expected: {}".\
                             format(to_address.text, self.contact['email']['value']))
        subject = self.UTILS.element.getElement(DOM.Email.compose_subject,
                                                "Email subject")
        self.UTILS.test.test(subject.get_attribute("value") == "Firefox Hello", "Email subject: {} Expected:"\
                             " Firefox Hello".format(subject.get_attribute("value")))
        compose_msg = self.UTILS.element.getElement(DOM.Email.compose_msg,
                                                    "Message body")
        expected_body = _(
            "Click on the link and answer the call! https://hello.firefox.com/#call"
        )
        self.UTILS.test.test(expected_body in compose_msg.text, "Message body: {} Expected: {}".\
                             format(compose_msg.text, expected_body))
Esempio n. 24
0
class test_main(GaiaTestCase):
    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable(
            "gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable(
            "gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable(
            "gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")
        self.connect_to_network()

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.email.launch()
        self.email.setup_account(self.email_user, self.email_address,
                                 self.email_pass)

        # Create and send a new test message.
        self.messages.launch()
        test_msg = "Email address {} test at {}".format(
            self.emailAddy, time.time())
        self.data_layer.send_sms(self.phone_number, test_msg)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg,
                                                                  timeout=120)
        self.UTILS.statusbar.click_on_notification_detail(
            test_msg, DOM.Messages.frame_locator)
        sms = self.messages.last_message_in_this_thread()

        # Verify that the email address opens the email app.
        link = sms.find_element("tag name", "a")
        link.tap()
        self.wait_for_element_displayed(*DOM.Messages.header_send_message_btn,
                                        timeout=30)

        cancel = self.UTILS.element.getElement(DOM.Messages.contact_cancel_btn,
                                               "Cancel button")
        cancel.tap()

        # Go into edit mode.
        edit_btn = self.UTILS.element.getElement(
            DOM.Messages.edit_messages_icon, "Edit button")
        edit_btn.tap()

        # Select Messages mode
        select_msgs_btn = self.UTILS.element.getElement(
            DOM.Messages.edit_msgs_select_btn, "Select messages button")
        select_msgs_btn.tap()
        self.UTILS.element.waitForElements(DOM.Messages.edit_msgs_header,
                                           "Edit messages mode header")

        # Verify that the email address does not open the email app.
        sms = self.messages.last_message_in_this_thread()
        link = sms.find_element("tag name", "a")
        link.tap()

        # Now try to find the email app iframe.
        self.wait_for_element_not_displayed(
            *DOM.Messages.header_send_message_btn, timeout=30)
Esempio n. 25
0
class test_main(GaiaTestCase):

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.email = Email(self)

        # Get details of our test contacts.
        email1 = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        email2 = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        email3 = self.UTILS.general.get_config_variable("hotmail_1_email", "common")
        self.contact = MockContact(email=[{
            'type': 'Personal',
            'value': email1}, {
            'type': 'Personal',
            'value': email2}, {
            'type': 'Personal',
            'value': email3}
        ])
        """
        We're not testing adding a contact, so just stick one
        into the database.
        """

        self.UTILS.general.insertContact(self.contact)

        self._email_subject = "test " + str(time.time())
        self._email_message = "Test message"

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        self.connect_to_network()

        # Set up to use email (with account #1).
        em_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        em_email = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        em_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")
        self.email.launch()
        self.email.setup_account(em_user, em_email, em_pass)

        # Launch contacts app.
        self.contacts.launch()

        # View the details of our contact.
        self.contacts.view_contact(self.contact['name'])

        # Click the 2nd email button
        email_btn = self.UTILS.element.getElement(("id", DOM.Contacts.email_button_spec_id.format(1)),
                                        "2nd send Email address in for this contact")
        email_btn.tap()

        # Switch to email frame.
        time.sleep(1)
        self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator)

        # Verify the 'to' field is correct.
        expected_to = self.contact["email"][1]["value"]
        y = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts, "'To' field")
        self.UTILS.test.test(y.text == expected_to,
                        "The 'to' field contains '" + expected_to + "' (it was (" + y.text + ").")

        # Fill in the rest and send it.
        self.UTILS.general.typeThis(DOM.Email.compose_subject, "'Subject' field", self._email_subject, True, False)
        self.UTILS.general.typeThis(DOM.Email.compose_msg, "Message field", self._email_message, True, False, False)

        # Send the message.
        self.email.send_the_email_and_switch_frame(self.contact['name'], DOM.Contacts.frame_locator)
Esempio n. 26
0
class test_main(GaiaTestCase):
    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable(
            "gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable(
            "gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable(
            "gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.dest_email = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Set up email account.
        self.connect_to_network()

        # Create and send a new test message.
        test_msg = "email address {} test at {}".format(
            self.dest_email, time.time())
        self.data_layer.send_sms(self.phone_number, test_msg)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg,
                                                                  timeout=120)
        self.UTILS.statusbar.click_on_notification_detail(
            test_msg, DOM.Messages.frame_locator)
        sms = self.messages.last_message_in_this_thread()
        time.sleep(1)

        # Tap the 2nd email link.
        self.UTILS.reporting.logResult(
            "info",
            "Click the email address in this message: '{}'.".format(sms.text))
        _link = sms.find_element("tag name", "a")
        _link.tap()

        # Tap on "Send email" button from the overlay
        send_btn = self.UTILS.element.getElement(
            DOM.Messages.header_send_email_btn, "Send email button")
        send_btn.tap()

        time.sleep(4)
        self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator)

        # Confirm we want to setUp our email account
        confirm = self.UTILS.element.getElement(DOM.Email.email_not_setup_ok,
                                                "Set up account confirmation")
        confirm.tap()

        self.email.setup_account(self.email_user,
                                 self.email_address,
                                 self.email_pass,
                                 via_activity=True)

        # Verify the email address is in the To field.
        to_field = self.UTILS.element.getElement(
            DOM.Email.compose_to_from_contacts, "To field")
        self.UTILS.test.test(
            to_field.text == self.dest_email,
            "To field contains '{0}' (it was '{0}').".format(self.dest_email))

        # Fill in the details and send the email.
        self.UTILS.general.typeThis(DOM.Email.compose_subject,
                                    "'Subject' field", "Test email", True,
                                    False)
        self.UTILS.general.typeThis(DOM.Email.compose_msg, "Message field",
                                    "Just a test", True, False, False)

        send_btn = self.UTILS.element.getElement(DOM.Email.compose_send_btn,
                                                 "Send button")
        send_btn.tap()
        self.UTILS.element.waitForNotElements(DOM.Messages.send_email_failed,
                                              "Sending email error message",
                                              timeout=10)
Esempio n. 27
0
class test_main(GaiaTestCase):

    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.email = Email(self)
        self.loop = Loop(self)

        self.email_add = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_2_pass", "common")
        self.email_user = self.UTILS.general.get_config_variable("gmail_2_user", "common")

        # Get details of our test contacts.
        self.contact = MockContact()
        self.UTILS.general.insertContact(self.contact)
        self.data_layer.connect_to_wifi()

        result = self.loop.initial_test_checks()

        if result:
            self.loop.phone_login()
            self.loop.allow_permission_phone_login()
            self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view")

        self.email.launch()
        self.email.setup_account(self.email_user, self.email_add, self.email_pass)
        self.apps.kill_all()
        time.sleep(2)

        _ = setup_translations(self)
        self.expected_message = _("No problem! Just share the following link and they can call you back from"\
                                  " any browser.")

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Launch contacts app.
        self.contacts.launch()
        self.contacts.view_contact(self.contact['name'])
        video_btn = self.marionette.find_element(DOM.Contacts.view_contact_hello_option[0],
                                                 DOM.Contacts.view_contact_hello_option[1].format("video"))
        video_btn.tap()
        self.loop.share_micro_and_camera()
        self.wait_for_element_displayed(*DOM.Loop.not_a_user_explanation, timeout=10)
        not_a_user_explanation = self.marionette.find_element(*DOM.Loop.not_a_user_explanation)
        self.UTILS.test.test(not_a_user_explanation.text == self.expected_message, "Message found: {} (Expected: {}".\
                             format(not_a_user_explanation.text, self.expected_message))

        share_options = self.UTILS.element.getElements(DOM.Loop.share_link_options, "Sharing options")
        self.UTILS.test.test(len(share_options) == 3, "There are {} sharing options (Expected: 3)".\
                             format(len(share_options)))
        share_by_email = self.UTILS.element.getElement(DOM.Loop.share_panel_email_share, "Share by email")
        share_by_email.tap()
        self.UTILS.iframe.switch_to_frame(*DOM.Email.frame_locator)
        to_address = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts, "Recipient Address")
        self.UTILS.test.test(to_address.text == self.contact['email']['value'], "Recipient address: {} Expected: {}".\
                             format(to_address.text, self.contact['email']['value']))
        subject = self.UTILS.element.getElement(DOM.Email.compose_subject, "Email subject")
        self.UTILS.test.test(subject.get_attribute("value") == "Firefox Hello", "Email subject: {} Expected:"\
                             " Firefox Hello".format(subject.get_attribute("value")))
        compose_msg = self.UTILS.element.getElement(DOM.Email.compose_msg, "Message body")
        expected_body = _("Click on the link and answer the call! https://hello.firefox.com/#call")
        self.UTILS.test.test(expected_body in compose_msg.text, "Message body: {} Expected: {}".\
                             format(compose_msg.text, expected_body))
Esempio n. 28
0
class test_main(GaiaTestCase):
    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.email = Email(self)
        self.loop = Loop(self)

        self.email_add = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable(
            "gmail_2_pass", "common")
        self.email_user = self.UTILS.general.get_config_variable(
            "gmail_2_user", "common")

        # Get details of our test contacts.
        self.contact = MockContact()
        self.UTILS.general.insertContact(self.contact)
        self.data_layer.connect_to_wifi()

        result = self.loop.initial_test_checks()

        if result:
            self.loop.phone_login()
            self.loop.allow_permission_phone_login()
            self.UTILS.element.waitForElements(DOM.Loop.app_header,
                                               "Loop main view")

        self.email.launch()
        self.email.setup_account(self.email_user, self.email_add,
                                 self.email_pass)
        self.apps.kill_all()
        time.sleep(2)

        _ = setup_translations(self)
        self.expected_message = _("No problem! Just share the following link and they can call you back from"\
                                  " any browser.")

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Launch contacts app.
        self.contacts.launch()
        self.contacts.view_contact(self.contact['name'])
        video_btn = self.marionette.find_element(
            DOM.Contacts.view_contact_hello_option[0],
            DOM.Contacts.view_contact_hello_option[1].format("video"))
        video_btn.tap()
        self.loop.share_micro_and_camera()
        self.wait_for_element_displayed(*DOM.Loop.not_a_user_explanation,
                                        timeout=10)
        not_a_user_explanation = self.marionette.find_element(
            *DOM.Loop.not_a_user_explanation)
        self.UTILS.test.test(not_a_user_explanation.text == self.expected_message, "Message found: {} (Expected: {}".\
                             format(not_a_user_explanation.text, self.expected_message))

        share_options = self.UTILS.element.getElements(
            DOM.Loop.share_link_options, "Sharing options")
        self.UTILS.test.test(len(share_options) == 3, "There are {} sharing options (Expected: 3)".\
                             format(len(share_options)))
        share_by_email = self.UTILS.element.getElement(
            DOM.Loop.share_panel_email_share, "Share by Email")
        share_by_email.tap()
        self.UTILS.iframe.switch_to_frame(*DOM.Email.frame_locator)
        time.sleep(2)

        # Modify the message subject
        subject = self.UTILS.element.getElement(
            DOM.Email.compose_subject, "Subject input").get_attribute("value")
        self.UTILS.reporting.debug(
            "*** Email Subject before editing: {}".format(subject))
        new_subject = " Editing subject"
        expected = subject + new_subject
        self.UTILS.general.typeThis(DOM.Email.compose_subject,
                                    "Subject input area",
                                    new_subject,
                                    p_clear=False,
                                    p_validate=False)
        subject_after = self.UTILS.element.getElement(DOM.Email.compose_subject, "Subject input").\
                                                        get_attribute("value")
        self.UTILS.test.test(expected == subject_after, "Expected subject: {} Actual subject: {}".\
                            format(expected, subject_after))

        # Modify the message body
        msg_body = self.UTILS.element.getElement(DOM.Email.compose_msg,
                                                 "Input message area").text
        self.UTILS.reporting.debug(
            "*** Email Body before editing: {}".format(msg_body))
        new_text = " This is more test in the Email"
        expected = msg_body + new_text
        self.UTILS.general.typeThis(DOM.Email.compose_msg,
                                    "Input message area",
                                    new_text,
                                    p_clear=False,
                                    p_validate=False)
        msg_body_after = self.UTILS.element.getElement(
            DOM.Email.compose_msg, "Input message area").text
        self.UTILS.test.test(expected == msg_body_after, "Expected text: {} Actual text: {}".\
                            format(expected, msg_body_after))
Esempio n. 29
0
class test_main(GaiaTestCase):
    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.email = Email(self)

        # Get details of our test contacts.
        email1 = self.UTILS.general.get_config_variable(
            "gmail_1_email", "common")
        email2 = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")
        email3 = self.UTILS.general.get_config_variable(
            "hotmail_1_email", "common")
        self.contact = MockContact(email=[{
            'type': 'Personal',
            'value': email1
        }, {
            'type': 'Personal',
            'value': email2
        }, {
            'type': 'Personal',
            'value': email3
        }])
        """
        We're not testing adding a contact, so just stick one
        into the database.
        """

        self.UTILS.general.insertContact(self.contact)

        self._email_subject = "test " + str(time.time())
        self._email_message = "Test message"

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        self.connect_to_network()

        # Set up to use email (with account #1).
        em_user = self.UTILS.general.get_config_variable(
            "gmail_1_user", "common")
        em_email = self.UTILS.general.get_config_variable(
            "gmail_1_email", "common")
        em_pass = self.UTILS.general.get_config_variable(
            "gmail_1_pass", "common")
        self.email.launch()
        self.email.setup_account(em_user, em_email, em_pass)

        # Launch contacts app.
        self.contacts.launch()

        # View the details of our contact.
        self.contacts.view_contact(self.contact['name'])

        # Click the 2nd email button
        email_btn = self.UTILS.element.getElement(
            ("id", DOM.Contacts.email_button_spec_id.format(1)),
            "2nd send Email address in for this contact")
        email_btn.tap()

        # Switch to email frame.
        time.sleep(1)
        self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator)

        # Verify the 'to' field is correct.
        expected_to = self.contact["email"][1]["value"]
        y = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts,
                                          "'To' field")
        self.UTILS.test.test(
            y.text == expected_to, "The 'to' field contains '" + expected_to +
            "' (it was (" + y.text + ").")

        # Fill in the rest and send it.
        self.UTILS.general.typeThis(DOM.Email.compose_subject,
                                    "'Subject' field", self._email_subject,
                                    True, False)
        self.UTILS.general.typeThis(DOM.Email.compose_msg, "Message field",
                                    self._email_message, True, False, False)

        # Send the message.
        self.email.send_the_email_and_switch_frame(self.contact['name'],
                                                   DOM.Contacts.frame_locator)
Esempio n. 30
0
class Emailing(GaiaTestCase):

    def setUpEmail(self):

        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)

        self.email = Email(self)
        self.settings = Settings(self)
        self.browser = Browser(self)

        _ = setup_translations(self)

        # Create (and record) a unique 'subject'.
        self.subject = "test " + str(time.time())
        self.body = "This is the test email body."

        # Set up specific folder names.
        if "gmail" in self.test_type:
            self.UTILS.reporting.logComment("Gmail account being used.")
            self.sent_folder_name = _("Sent Mail")
        elif "exchange" in self.test_type:
            self.UTILS.reporting.logComment("Exchange account being used.")
            self.sent_folder_name = _("Sent Items")
        else:
            self.UTILS.reporting.logComment("Non-gmail account being used.")
            self.sent_folder_name = _("Sent")

        self.marionette.set_search_timeout(50)

    def set_subject(self):
        self.subject = "test " + str(time.time())

    def send_email(self, account_to_load, to):
        self.UTILS.reporting.logComment("[SEND]Using subject \"" + self.subject + "\".")

        self.email.launch()
        self.email.setup_account(account_to_load["username"], account_to_load["email"], account_to_load["pass"])
        self.email.open_folder(_("Inbox"))

        # At the inbox, compose and send a new email (or fail).
        if type(to) is list:
            to_addresses = [account["email"] for account in to]
            self.email.send_new_email(to_addresses, self.subject, self.body)
        else:
            self.email.send_new_email(to["email"], self.subject, self.body)

        # Check our email is in the sent folder.
        self.email.open_folder(self.sent_folder_name)
        self.UTILS.test.test(self.email.email_is_in_folder(self.subject),
                             "Email with subject [{}] found in the Sent folder.".format(self.subject))

    def receive_email(self, account_to_load, sender, prefix="", many_recipients=False, files_attached=False):

        self.UTILS.reporting.logComment("[RECEIVE]Using subject \"" + self.subject + "\".")

        self.email.launch()
        self.email.setup_account(account_to_load["username"], account_to_load["email"], account_to_load["pass"])

        # Make sure we're in the inbox
        header_text = self.UTILS.element.getElement(DOM.GLOBAL.app_head, "Application header").text
        self.UTILS.reporting.logResult("info", "Header name in <b>receive_email</b> method: {}".format(header_text))

        if header_text != _("Inbox"):
            self.email.open_folder(_("Inbox"))

        self.UTILS.test.test(self.email.open_msg(prefix + self.subject),
                             "Email was opened successfully.", True)

        to_name = account_to_load["email"].split("@")[0]
        from_name = sender["email"].split("@")[0]

        x = self.UTILS.element.getElement(DOM.Email.open_email_from, "'From' field")

        self.UTILS.test.test((x.text == sender["email"] or x.text == from_name),
                             "'To' field = '" + sender["email"] + "', (it was '" + x.text + "').")

        if many_recipients:
            # self.UTILS.reporting.logResult("info", "Many recipients!!!!!")
            to_fields = self.UTILS.element.getElements(DOM.Email.open_email_to, "'To' field")
            to_fields_text = [elem.text for elem in to_fields]
            isThere = account_to_load["email"] in to_fields_text or to_name in to_fields_text \
                or account_to_load["username"] in to_fields_text

            self.UTILS.test.test(isThere,
                                 "'From' field shows the sender (it was '{}').".format(" ".join(to_fields_text)))
        else:
            x = self.UTILS.element.getElement(DOM.Email.open_email_to, "'To' field")
            self.UTILS.test.test((x.text == account_to_load["email"] or x.text == to_name
                                  or x.text == account_to_load["username"]),
                                 "'From' field shows the sender (it was '" + x.text + "').")

        x = self.UTILS.element.getElement(DOM.Email.open_email_subject, "'Subject' field")
        self.UTILS.test.test(x.text == prefix + self.subject,
                             "'Subject' field = '" + prefix + self.subject + "', (it was '" + x.text + "').")

        if files_attached:
            self.UTILS.element.waitForElements(DOM.Email.open_email_attached_file,
                                               "There are files attached to this mail")
Esempio n. 31
0
class test_main(GaiaTestCase):

    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.dest_email = self.UTILS.general.get_config_variable("gmail_2_email", "common")

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Set up email account.
        self.connect_to_network()

        # Create and send a new test message.
        test_msg = "email address {} test at {}".format(self.dest_email, time.time())
        self.data_layer.send_sms(self.phone_number, test_msg)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg, timeout=120)
        self.UTILS.statusbar.click_on_notification_detail(test_msg, DOM.Messages.frame_locator)
        sms = self.messages.last_message_in_this_thread()
        time.sleep(1)

        # Tap the 2nd email link.
        self.UTILS.reporting.logResult("info", "Click the email address in this message: '{}'.".format(sms.text))
        _link = sms.find_element("tag name", "a")
        _link.tap()

        # Tap on "Send email" button from the overlay
        send_btn = self.UTILS.element.getElement(DOM.Messages.header_send_email_btn, "Send email button")
        send_btn.tap()

        time.sleep(4)
        self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator)

        # Confirm we want to setUp our email account
        confirm = self.UTILS.element.getElement(DOM.Email.email_not_setup_ok, "Set up account confirmation")
        confirm.tap()

        self.email.setup_account(self.email_user, self.email_address, self.email_pass, via_activity=True)

        # Verify the email address is in the To field.
        to_field = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts, "To field")
        self.UTILS.test.test(to_field.text == self.dest_email,
                             "To field contains '{0}' (it was '{0}').".format(self.dest_email))

        # Fill in the details and send the email.
        self.UTILS.general.typeThis(DOM.Email.compose_subject, "'Subject' field", "Test email", True, False)
        self.UTILS.general.typeThis(DOM.Email.compose_msg, "Message field", "Just a test", True, False, False)

        send_btn = self.UTILS.element.getElement(DOM.Email.compose_send_btn, "Send button")
        send_btn.tap()
        self.UTILS.element.waitForNotElements(DOM.Messages.send_email_failed, "Sending email error message",
                                              timeout=10)
Esempio n. 32
0
class Emailing(GaiaTestCase):
    def setUpEmail(self):

        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)

        self.email = Email(self)
        self.settings = Settings(self)
        self.browser = Browser(self)

        _ = setup_translations(self)

        # Create (and record) a unique 'subject'.
        self.subject = "test " + str(time.time())
        self.body = "This is the test email body."

        # Set up specific folder names.
        if "gmail" in self.test_type:
            self.UTILS.reporting.logComment("Gmail account being used.")
            self.sent_folder_name = _("Sent Mail")
        elif "exchange" in self.test_type:
            self.UTILS.reporting.logComment("Exchange account being used.")
            self.sent_folder_name = _("Sent Items")
        else:
            self.UTILS.reporting.logComment("Non-gmail account being used.")
            self.sent_folder_name = _("Sent")

        self.marionette.set_search_timeout(50)

    def set_subject(self):
        self.subject = "test " + str(time.time())

    def send_email(self, account_to_load, to):
        self.UTILS.reporting.logComment("[SEND]Using subject \"" +
                                        self.subject + "\".")

        self.email.launch()
        self.email.setup_account(account_to_load["username"],
                                 account_to_load["email"],
                                 account_to_load["pass"])
        self.email.open_folder(_("Inbox"))

        # At the inbox, compose and send a new email (or fail).
        if type(to) is list:
            to_addresses = [account["email"] for account in to]
            self.email.send_new_email(to_addresses, self.subject, self.body)
        else:
            self.email.send_new_email(to["email"], self.subject, self.body)

        # Check our email is in the sent folder.
        self.email.open_folder(self.sent_folder_name)
        self.UTILS.test.test(
            self.email.email_is_in_folder(self.subject),
            "Email with subject [{}] found in the Sent folder.".format(
                self.subject))

    def receive_email(self,
                      account_to_load,
                      sender,
                      prefix="",
                      many_recipients=False,
                      files_attached=False):

        self.UTILS.reporting.logComment("[RECEIVE]Using subject \"" +
                                        self.subject + "\".")

        self.email.launch()
        self.email.setup_account(account_to_load["username"],
                                 account_to_load["email"],
                                 account_to_load["pass"])

        # Make sure we're in the inbox
        header_text = self.UTILS.element.getElement(DOM.GLOBAL.app_head,
                                                    "Application header").text
        self.UTILS.reporting.logResult(
            "info", "Header name in <b>receive_email</b> method: {}".format(
                header_text))

        if header_text != _("Inbox"):
            self.email.open_folder(_("Inbox"))

        self.UTILS.test.test(self.email.open_msg(prefix + self.subject),
                             "Email was opened successfully.", True)

        to_name = account_to_load["email"].split("@")[0]
        from_name = sender["email"].split("@")[0]

        x = self.UTILS.element.getElement(DOM.Email.open_email_from,
                                          "'From' field")

        self.UTILS.test.test(
            (x.text == sender["email"] or x.text == from_name),
            "'To' field = '" + sender["email"] + "', (it was '" + x.text +
            "').")

        if many_recipients:
            # self.UTILS.reporting.logResult("info", "Many recipients!!!!!")
            to_fields = self.UTILS.element.getElements(DOM.Email.open_email_to,
                                                       "'To' field")
            to_fields_text = [elem.text for elem in to_fields]
            isThere = account_to_load["email"] in to_fields_text or to_name in to_fields_text \
                or account_to_load["username"] in to_fields_text

            self.UTILS.test.test(
                isThere, "'From' field shows the sender (it was '{}').".format(
                    " ".join(to_fields_text)))
        else:
            x = self.UTILS.element.getElement(DOM.Email.open_email_to,
                                              "'To' field")
            self.UTILS.test.test(
                (x.text == account_to_load["email"] or x.text == to_name
                 or x.text == account_to_load["username"]),
                "'From' field shows the sender (it was '" + x.text + "').")

        x = self.UTILS.element.getElement(DOM.Email.open_email_subject,
                                          "'Subject' field")
        self.UTILS.test.test(
            x.text == prefix + self.subject, "'Subject' field = '" + prefix +
            self.subject + "', (it was '" + x.text + "').")

        if files_attached:
            self.UTILS.element.waitForElements(
                DOM.Email.open_email_attached_file,
                "There are files attached to this mail")
Esempio n. 33
0
class test_main(GaiaTestCase):

    def setUp(self):

        # Set up child objects...

        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.contacts = Contacts(self)
        self.email = Email(self)

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable("gmail_1_email", "common")
        self.emailE = self.UTILS.general.get_config_variable("gmail_2_email", "common")
        self.emailP = self.UTILS.general.get_config_variable("gmail_2_pass", "common")
        self.emailU = self.UTILS.general.get_config_variable("gmail_2_user", "common")

        self.UTILS.general.add_file_to_device('./tests/_resources/contact_face.jpg')
        self.test_msg = "Test message."

        self.cont = MockContact()
        self.data_layer.delete_all_sms()

    def tearDown(self):
        self.UTILS.general.remove_files()
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.connect_to_network()

        self.email.launch()
        self.email.setup_account(self.emailU, self.emailE, self.emailP)

        self.messages.launch()

        # Create and send a new test message.
        self.messages.create_and_send_sms([self.phone_number], "Hello {} old bean.".format(self.emailAddy))
        send_time = self.messages.last_sent_message_timestamp()
        x = self.messages.wait_for_message(send_time=send_time)

        link = x.find_element("tag name", "a")
        link.tap()

        # Click 'create new contact'.
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
        x = self.UTILS.element.getElement(DOM.Messages.header_create_new_contact_btn, "Create new contact button")
        x.tap()

        # Verify that the email is in the email field.
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        x = self.UTILS.element.getElement(DOM.Contacts.email_field, "Email field")
        x_txt = x.get_attribute("value")
        self.UTILS.test.test(x_txt == self.emailAddy, "Email is '{}' (expected '{}')".format(x_txt, self.emailAddy))

        # Put the contact details into each of the fields (this method
        # clears each field first).
        self._changeField('givenName', self.cont["givenName"])
        self._changeField('familyName', self.cont["familyName"])
        self._changeField('tel', self.cont["tel"]["value"])
        self._changeField('street', self.cont["addr"]["streetAddress"])
        self._changeField('zip', self.cont["addr"]["postalCode"])
        self._changeField('city', self.cont["addr"]["locality"])
        self._changeField('country', self.cont["addr"]["countryName"])

        # Add another email address.
        self.contacts.add_another_email_address(self.cont["email"]["value"])

        done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button")
        done_button.tap()

        self.marionette.switch_to_frame()
        self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@src,'contacts')]"),
                                              "Contact app iframe")

        # Now return to the SMS app.
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)

    def _changeField(self, p_field, p_valObj):

        # To try and get around marionette issues I'm resetting Marionette every time here.

        self.UTILS.general.checkMarionetteOK()
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        contFields = self.contacts.get_contact_fields()
        self.contacts.replace_str(contFields[p_field], p_valObj)
Esempio n. 34
0
class test_main(GaiaTestCase):
    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.Email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable(
            "gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable(
            "gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable(
            "gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Set up email account.
        self.connect_to_network()

        self.Email.launch()
        self.Email.setup_account(self.email_user, self.email_address,
                                 self.email_pass)

        # Launch messages app.
        self.messages.launch()

        # Create and send a new test message.
        msg_text = "Email one [email protected], two {} , three [email protected] at {}".\
                    format(self.emailAddy, time.time())
        self.data_layer.send_sms(self.phone_number, msg_text)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(msg_text,
                                                                  timeout=120)
        self.UTILS.statusbar.click_on_notification_detail(
            msg_text, DOM.Messages.frame_locator)
        sms = self.messages.last_message_in_this_thread()
        time.sleep(1)

        # Tap the 2nd email link.
        self.UTILS.reporting.logResult(
            "info",
            "Click the email address in this message: '{}'.".format(sms.text))
        _link = sms.find_elements("tag name", "a")[1]
        _link.tap()

        # Click on "Send email" button from the overlay
        send_btn = self.UTILS.element.getElement(
            DOM.Messages.header_send_email_btn, "Send email button")
        send_btn.tap()

        # Switch to email frame and verify the email address is in the To field.
        self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator)
        x = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts,
                                          "To field")
        self.UTILS.test.test(
            x.text == self.emailAddy,
            "To field contains '{}' (it was '{}').".format(
                self.emailAddy, self.emailAddy))
Esempio n. 35
0
class test_main(GaiaTestCase):

    test_msg = "Test message."

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.Email = Email(self)

        self.email_user = self.UTILS.general.get_config_variable(
            "gmail_1_user", "common")
        self.email_address = self.UTILS.general.get_config_variable(
            "gmail_1_email", "common")
        self.email_pass = self.UTILS.general.get_config_variable(
            "gmail_1_pass", "common")

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.emailAddy = self.UTILS.general.get_config_variable(
            "gmail_2_email", "common")

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Set up email account.
        self.connect_to_network()

        self.Email.launch()
        self.Email.setup_account(self.email_user, self.email_address,
                                 self.email_pass)

        # Launch messages app.
        self.messages.launch()

        # Create and send a new test message.
        self.messages.create_and_send_sms(
            [self.phone_number], "Email {} one.".format(self.emailAddy))
        send_time = self.messages.last_sent_message_timestamp()
        last_msg = self.messages.wait_for_message(send_time)

        # Tap the email link.
        link = last_msg.find_element("tag name", "a")
        link.tap()

        edit_btn = self.UTILS.element.getElement(
            DOM.Messages.header_send_email_btn, "Edit button")
        edit_btn.tap()

        # Switch to email frame and verify the email address is in the To field.
        self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator)
        to_field = self.UTILS.element.getElement(
            DOM.Email.compose_to_from_contacts, "To field")
        self.UTILS.test.test(
            to_field.text == self.emailAddy,
            "To field contains '{0}' (it was '{0}').".format(self.emailAddy))