Esempio n. 1
0
class test_main(GaiaTestCase):

    def setUp(self):

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


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

    def test_run(self):

        self.contacts.launch()
        self.messages.launch()
        self.UTILS.home.touchHomeButton()
        time.sleep(1)

        self.UTILS.home.holdHomeButton()

        self.UTILS.element.waitForElements(DOM.Home.cards_view, "App 'cards' list (task switcher)")

        x = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot:", x)
Esempio n. 2
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        # Prepare the contact we're going to insert.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.contact = MockContact(tel={'type': '', 'value': self.phone_number})
        self.UTILS.general.insertContact(self.contact)
        self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
        self.data_layer.delete_all_sms()

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

    def test_run(self):
        self.UTILS.statusbar.clearAllStatusBarNotifs()

        # Create message - 5 x 10 chars.
        timestamp = " {}".format(time.time())
        sms_message = "0123456789" * 5 + timestamp
        self.UTILS.reporting.logComment("Message length sent: {}".format((len(sms_message))))

        self.UTILS.messages.create_incoming_sms(self.phone_number, sms_message)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(timestamp, timeout=120)
        title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5)
        self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)

        self.messages.forwardMessageToMultipleRecipients("sms", self.phone_number, self.contact["name"])
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 setUp(self):

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

        self.actions = Actions(self.marionette)

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
        self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)
        self.data_layer.delete_all_sms()

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

    def test_run(self):
        self.UTILS.statusbar.clearAllStatusBarNotifs()

        # Create message
        timestamp = " {}".format(time.time())
        sms_message = "0123456789" * 5 + timestamp
        self.UTILS.reporting.logComment("Message length sent: {}".format((len(sms_message))))

        self.UTILS.messages.create_incoming_sms(self.phone_number, sms_message)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(timestamp, timeout=120)
        title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5)
        self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)

        self.messages.forwardMessage("sms", self.phone_number)
Esempio n. 5
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        timestamp = time.time()
        self.test_msgs = ["Hello world {} at {}".format(i, timestamp) for i in range(3)]

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number)
        self.data_layer.delete_all_sms()
        self.UTILS.statusbar.clearAllStatusBarNotifs()

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

    def test_run(self):
        for msg in self.test_msgs:
            self.messages.create_and_send_mms("image", [self.phone_number], msg)
            self.messages.wait_for_message()
            self.messages.closeThread()

        self.messages.openThread(self.phone_number)
        self.messages.deleteMessagesInThisThread()
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)

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.cp_incoming_number = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
        self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)
        self.data_layer.delete_all_sms()

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

    def test_run(self):
        self.UTILS.statusbar.clearAllStatusBarNotifs()

        # Create and send a new test message.
        self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg)

        self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120)
        title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.cp_incoming_number, timeout=5)
        self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)

        self.messages.check_last_message_contents(self.test_msg)
Esempio n. 7
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)

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

    def test_run(self):

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

        # Start a new sms.
        self.messages.startNewSMS()

        # Enter a message the message area.
        x = self.messages.enterSMSMsg("Test text.")

        # Check the 'Send button isn't enabled yet.
        x = self.UTILS.element.getElement(DOM.Messages.send_message_button, "Send message button")
        self.UTILS.test.test(not x.is_enabled(), 
                        "Send button is not enabled after message supplied, but target still empty.")
Esempio n. 8
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        # Prepare the contact we're going to insert.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.contact = MockContact(tel={'type': '', 'value': self.phone_number})

        self.UTILS.general.insertContact(self.contact)
        self.UTILS.reporting.logComment("Using target telephone number " + self.contact["tel"]["value"])

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

    def test_run(self):

        # Launch messages app.
        self.messages.launch()
        """
        Send a message to create a thread (use number, not name as this
        avoids some blocking bugs just now). 
        """

        self.messages.create_and_send_sms( [self.contact["tel"]["value"]], "Test message.")
        returnedSMS = self.messages.wait_for_message()

        # Examine the header.
        self.UTILS.element.headerCheck(self.contact["name"])
Esempio n. 9
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        # Import contact (adjust to the correct number).
        self.telNum = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.UTILS.reporting.logComment("Using target telephone number " + self.telNum)

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

    def test_run(self):

        # Launch messages app.
        self.messages.launch()
        """
        Send a message to create a thread (use number, not name as this
        avoids some blocking bugs just now). 
        """

        self.messages.create_and_send_sms([self.telNum], "Test message.")
        returnedSMS = self.messages.wait_for_message()
Esempio n. 10
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.msg = "Test {}".format(time.time())
        self.cp_incoming_number = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
        self.data_layer.delete_all_sms()

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

    def test_run(self):

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

        self.UTILS.messages.create_incoming_sms(self.phone_number, self.msg)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(self.msg, timeout=120)
Esempio n. 11
0
class test_main(GaiaTestCase):

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.gallery = Gallery(self)
        self.settings = Settings(self)

        self.test_msg = "Hello World"

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number)
        self.data_layer.delete_all_sms()

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

    def test_run(self):

        # Configure Auto Retrieve as off from messaging settings
        self.settings.launch()
        self.settings.configure_mms_auto_retrieve("on_without_r")

        send_time = self.messages.create_and_send_mms("image", [self.phone_number], self.test_msg)
        self.messages.wait_for_message(send_time)
        self.messages.verify_mms_received("img", self.phone_number)
Esempio n. 12
0
class test_main(GaiaTestCase):

    test_msg = "This text has multiple spaces 1  2  3  4  5."

    def setUp(self):

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

        # Remove number and import contact.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
        self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)

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

    def test_run(self):
        self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120)
        title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5)
        self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)

        # Check the receievd message.
        self.messages.check_last_message_contents(self.test_msg)
Esempio n. 13
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.test_msg = "Hello World"
        self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number)
        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.UTILS.statusbar.clearAllStatusBarNotifs()
        self.messages.create_and_send_mms('video', [self.phone_number], self.test_msg)
        self.messages.verify_mms_received("video", self.phone_number)
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):

        # 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. 15
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        # Get details of our test contacts.
        self.contact = MockContact(tel=[{'type': 'Mobile', 'value': '11111111'},
                                    {'type': 'Mobile', 'value': '222222222'}])
        """
        We're not testing adding a contact, so just stick one
        into the database.
        """

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

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

    def test_run(self):

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

        # Select our contact.

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

        # Tap the 2nd sms button (index=1) in the view details screen to go to the sms page.
        smsBTN = self.UTILS.element.getElement(("id", DOM.Contacts.sms_button_specific_id.format(1)),
                                        "2nd send SMS button")
        smsBTN.tap()
        """
        Switch to the 'Messages' app frame (or marionette will still be watching the
        'Contacts' app!).
        """

        self.marionette.switch_to_frame()
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
        time.sleep(3)
        """
        test: this automatically opens the 'send SMS' screen, so
        check the correct name is in the header of this sms.
        """

        self.UTILS.element.headerCheck("1 recipient")

        # Check this is the right number.
        self.messages.checkIsInToField(self.contact["name"])
        self.messages.checkNumberIsInToField(self.contact["tel"][1]["value"])
Esempio n. 16
0
class test_main(GaiaTestCase):

    link = "www.google.com"
    test_msg = "Test " + link + " this."

    def setUp(self):

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

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)

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

    def test_run(self):
        self.connect_to_network()

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

        # Create and send a new test message.
        self.messages.create_and_send_sms([self.phone_number], self.test_msg)
        """
        Wait for the last message in this thread to be a 'received' one
        and click the link.
        """

        msg = self.messages.wait_for_message()
        self.UTILS.test.test(msg, "Received a message.", True)

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

        select_btn = self.UTILS.element.getElement(DOM.Messages.edit_msgs_select_btn, "Select button")
        select_btn.tap()

        tag = msg.find_element("tag name", "a")
        tag.tap()

        header = self.UTILS.element.getElement(DOM.Messages.edit_msgs_header, "1 selected message")
        self.UTILS.test.test(header.text == "1 selected",
            "Into edit mode, if you tap on link, the browser is not open and the message is selected.")

        self.marionette.switch_to_frame()
        time.sleep(5)  # (give the browser time to launch)
        self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@src,'browser')]"), "Browser iframe")
Esempio n. 17
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. 18
0
class test_main(GaiaTestCase):

    test_msg = "Test."

    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.messages = Messages(self)

        # Prepare the contact we're going to insert.
        tlf = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.contact = MockContact(tel={'type': 'Mobile', 'value': tlf})

        self.UTILS.reporting.logComment("Using target telephone number " + self.contact["tel"]["value"])

        # Add this contact (quick'n'dirty method - we're just testing sms, no adding a contact).
        self.UTILS.general.insertContact(self.contact)

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

    def test_run(self):

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

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

        # Tap the sms button in the view details screen to go to the sms page.
        smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button")
        smsBTN.tap()
        """
        Switch to the 'Messages' app frame (or marionette will still be watching the
        'Contacts' app!).
        """

        time.sleep(2)
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)

        # Create SMS.
        x = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "frame", x)
        self.messages.enterSMSMsg(self.test_msg)

        # Click send.
        self.messages.sendSMS()
Esempio n. 19
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.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")

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

    def test_run(self):

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

        # Create and send a new test message.
        test_str = "Nine 123456789 numbers."
        self.messages.create_and_send_sms([self.phone_number], test_str)
        msg = self.messages.wait_for_message()

        # Long press the emedded number link.
        tag = msg.find_element("tag name", "a")
        tag.tap()

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

        # Cancel the action.
        form_header = self.UTILS.element.getElement(DOM.Contacts.contact_form_header, "Cancel button")
        form_header.tap(25, 25)

        # Wait for the contacts app to go away.
        self.marionette.switch_to_frame()
        self.UTILS.element.waitForNotElements(("xpath",
                                        "//iframe[contains(@src, '{}')]".format(DOM.Contacts.frame_locator[1])),
                                        "Contacts iframe")

        # Kill the SMS app (and all others).
        self.apps.kill_all()

        # Open the contacts app.
        self.contacts.launch()

        # Verify that there are no contacts.
        self.UTILS.element.waitForElements(("xpath", "//p[contains(text(), 'No contacts')]"),
                                    "No contacts message")
Esempio n. 20
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        # Import contact (adjust the correct number).
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.data_layer.delete_all_sms()

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

    def test_run(self):

        # Send some messages to create a thread
        self.texts = ["Test 1", "Test 2", "Test 3"]
        self.directions = ["outgoing", "incoming"]
        self.create_test_sms(self.phone_number, self.texts)

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

        # Enter the thread.
        self.messages.openThread(self.phone_number)

        # Find the first message.
        time.sleep(2)
        msg_list = self.UTILS.element.getElements(DOM.Messages.message_list, "Message list", False)
        msgs = [(text, direction) for text in self.texts for direction in self.directions]
        for (msg, expected) in zip(msg_list, msgs):
            direction = "outgoing" if "outgoing" in msg.get_attribute("class") else "incoming"
            text = self.marionette.find_element(*DOM.Messages.last_message_text_nested, id=msg.id).text
            self.UTILS.test.test(text == expected[0], "**** Text: {}  Expected: {}".format(text, expected[0]))
            self.UTILS.test.test(direction == expected[1], "Direction: {}  Expected: {}".\
                                 format(direction, expected[1]))

        # Tap the message area.
        x = self.UTILS.element.getElement(DOM.Messages.input_message_area, "Message area")
        x.tap()

        # Check the keyboard is now present.
        self.UTILS.iframe.switchToFrame(*DOM.Keyboard.frame_locator)

    def create_test_sms(self, number, msg_list):
        """Send messages in the list to populate a thread.
        """
        for msg in msg_list:
            self.data_layer.send_sms(number, msg)
            self.UTILS.statusbar.wait_for_notification_toaster_detail(msg, timeout=120)
Esempio n. 21
0
class test_main(GaiaTestCase):

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.browser = Browser(self)
        self.actions = Actions(self.marionette)

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.target_email = self.UTILS.general.get_config_variable("gmail_1_email", "common")

        self.msg = "Testing email link with " + self.target_email

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

    def test_run(self):

        self.connect_to_network()

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

        # Create and send a new test message.
        self.messages.create_and_send_sms([self.phone_number], self.msg)
        """
        Wait for the last message in this thread to be a 'received' one
        and click the link.
        """

        x = self.messages.wait_for_message()
        self.UTILS.test.test(x, "Received a message.", True)

        # Long-press the link.
        email_link = x.find_element("tag name", "a")
        email_link.tap()

        x = self.UTILS.element.getElement(DOM.Messages.header_add_to_contact_btn,
                                    "'Add to an existing contact' button")
        x.tap()

        # Check for warning message.
        self.UTILS.iframe.switchToFrame("src", "contacts")

        self.UTILS.element.waitForElements(("xpath", 
                "//p[contains(text(),'contact list is empty')]"), "Warning message")

        fnam = self.UTILS.debug.screenShot("26975")
        self.UTILS.reporting.logResult("info", "Screenshot of final position", fnam)
Esempio n. 22
0
class test_main(GaiaTestCase):

    test_num = "089123456"
    test_msg = "Testing " + test_num + " number."

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.Dialer = Dialer(self)
        self.contacts = Contacts(self)

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.cp_incoming_number = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
        self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)
        self.data_layer.delete_all_sms()

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

    def test_run(self):
        self.connect_to_network()
        self.UTILS.statusbar.clearAllStatusBarNotifs()

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

        self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120)
        title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.cp_incoming_number, timeout=5)
        self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)

        last_msg = self.messages.last_message_in_this_thread()
        num = last_msg.find_element("tag name", "a")
        num.tap()

        call_btn = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button")
        call_btn.tap()

        time.sleep(5)

        # Create a contact from this number.
        self.Dialer.createContactFromThisNum()

        # Make sure the number is automatically in the contact details.
        number_field = self.UTILS.element.getElement(("id", "number_0"), "Mobile number field")
        self.UTILS.test.test(number_field.get_attribute("value") == self.test_num,
                        "The correct number is automatically entered in the new contact's number field.")
Esempio n. 23
0
class test_main(GaiaTestCase):

    links = ["www.google.com", "www.hotmail.com", "www.wikipedia.org"]
    test_msg = "Test " + " ".join(links) + " this."

    def setUp(self):

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

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)

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

    def test_run(self):

        self.connect_to_network()

        # Create and send a new test message.
        self.data_layer.send_sms(self.phone_number, self.test_msg)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120)

        map(self.try_link, range(len(self.links)), self.links)

    def try_link(self, link_number, link):
        self.UTILS.reporting.logResult("info", "Tapping <b>{}</b> ...".format(link))

        # Switch to messaging app.
        self.messages.launch()
        self.messages.openThread(self.phone_number)
        time.sleep(1)

        # Get last message.
        msg = self.messages.last_message_in_this_thread()

        # Find all URLs
        l = msg.find_element("xpath", "//a[text()='{}']".format(link))

        # Tap on required link.
        self.UTILS.element.simulateClick(l)

        self.marionette.switch_to_frame()
        self.browser.wait_for_page_to_load()
        self.UTILS.test.test(
            link in self.browser.loaded_url(), "Web page loaded #{} correctly.".format(link_number + 1))
Esempio n. 24
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.num1 = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.num2 = "621234567"

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

    def test_run(self):

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

        # Create and send a new test message.
        self.messages.create_and_send_sms([self.num1], "Test {} number.".format(self.num2))
        x = self.messages.wait_for_message()

        # Enter edit mode.
        x = self.UTILS.element.getElement(DOM.Messages.edit_messages_icon, "Edit button")
        x.tap()

        # Tap the edit header.
        self.UTILS.reporting.logResult("info", "<b>NOTE:</b> This is the original number header, but really should be threads-edit-mode (marionette might be corrected for this, so switch the code to that if it starts failing)")
        x = self.UTILS.element.getElement(DOM.Messages.message_header, "Thread header (edit header)")
        x.tap()

        # Verify that nothing happened.
        self.UTILS.element.waitForNotElements(DOM.Messages.header_call_btn,
                                        "Call button")
        self.UTILS.element.waitForNotElements(DOM.Messages.header_create_new_contact_btn,
                                        "Create new contact button")
        self.UTILS.element.waitForNotElements(DOM.Messages.header_add_to_contact_btn,
                                        "Add to existing contact button")
        self.UTILS.element.waitForNotElements(DOM.Messages.contact_cancel_btn,
                                        "Cancel button")





        
Esempio n. 25
0
class test_main(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.contacts = Contacts(self)
        self.contact = MockContact(tel=[{'type': 'Mobile', 'value': '111111111'},
                                        {'type': 'Mobile', 'value': '222222222'}])

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

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

    def test_run(self):
        self.messages.launch()

        # Type a message containing the required string
        self.messages.startNewSMS()
        self.messages.enterSMSMsg("Test message")

        # Search for our contact.
        self.messages.selectAddContactButton()
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.contacts.search(self.contact['name'])
        self.contacts.select_search_result_several_phones(self.contact['name'],
                                                          self.contact['tel'][0]['value'], cancel=True)
Esempio n. 26
0
class test_main(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.contacts = Contacts(self)

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.contact = MockContact(tel={'type': '', 'value': self.phone_number})

        self.UTILS.general.insertContact(self.contact)
        self.UTILS.reporting.logComment("Using target telephone number " + self.contact["tel"]["value"])

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

    def test_run(self):
        self.messages.launch()

        # Type a message containing the required string
        self.messages.startNewSMS()
        self.messages.enterSMSMsg("Test message")

        # Search for our contact.
        self.messages.selectAddContactButton()
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.contacts.search("Knot A Match")
        self.contacts.check_search_results("Knot A Match", False)
Esempio n. 27
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)
        self.test_msg = "Test."

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

    def test_run(self):

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

        # Create and send a new test message.
        self.messages.create_and_send_sms([self.phone_number], self.test_msg)
        send_time = self.messages.last_sent_message_timestamp()

        # Wait for the last message in this thread to be a 'received' one.
        returnedSMS = self.messages.wait_for_message(send_time=send_time)
        self.UTILS.test.test(returnedSMS, "A received message appeared in the thread.", True)

        self.messages.check_last_message_contents(self.test_msg)
Esempio n. 28
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        self.test_msg = "Hello World"

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number)
        self.data_layer.delete_all_sms()

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

    def test_run(self):
        # Create and Send an MMS with a audio attached.
        self.messages.create_and_send_mms("audio", [self.phone_number], self.test_msg)

        self.messages.wait_for_message()
        self.messages.verify_mms_received("audio", self.phone_number)
        self.messages.open_attached_file(DOM.Music.frame_locator)
        time.sleep(5)
        self.music.is_player_playing()
Esempio n. 29
0
class test_main(GaiaTestCase):

    test_num = "123456789"
    test_msg = "Test number " + test_num + " for dialing."

    def setUp(self):

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

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")

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

    def test_run(self):

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

        # Create and send a new test message.
        self.messages.create_and_send_sms([self.phone_number], self.test_msg)
        """
        Wait for the last message in this thread to be a 'received' one
        and click the link.
        """

        x = self.messages.wait_for_message()
        self.UTILS.test.test(x, "Received a message.", True)

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

        x = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button")
        x.tap()

        self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator)

        # Dial the number.
        self.Dialer.call_this_number()

        # Wait 2 seconds, then hangup.
        time.sleep(2)
        self.Dialer.hangUp()
        self.data_layer.kill_active_call()
Esempio n. 30
0
class test_main(GaiaTestCase):

    test_msg = "Test."

    def setUp(self):

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

        # Prepare the contact we're going to insert.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.contact = MockContact(givenName='AAAAAAAAAAAAAAAALEX',
                                    familyName='SMITHXXXXXXXX',
                                    name='AAAAAAAAAAAAAAAALEX SMITHXXXXXXXX',
                                    tel={'type': 'Mobile', 'value': self.phone_number})

        self.UTILS.general.insertContact(self.contact)
        self.cp_incoming_number = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
        self.data_layer.delete_all_sms()

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

    def test_run(self):
        self.messages.launch()

        self.UTILS.messages.create_incoming_sms(self.contact["tel"]["value"], self.test_msg)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120)
        title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.cp_incoming_number, timeout=5)
        self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)

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

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

        # Tap the sms button in the view details screen to go to the sms page.
        smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button")
        smsBTN.tap()

        time.sleep(2)
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)

        self.messages.check_last_message_contents(self.test_msg)
Esempio n. 31
0
    def setUp(self):

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

        # Prepare the contact we're going to insert.
        tlf = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.contact = MockContact(tel={'type': 'Mobile', 'value': tlf})

        self.UTILS.reporting.logComment("Using target telephone number " +
                                        self.contact["tel"]["value"])

        # Add this contact (quick'n'dirty method - we're just testing sms, no adding a contact).
        self.UTILS.general.insertContact(self.contact)
Esempio n. 32
0
    def setUp(self):

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

        # Prepare the contact we're going to insert.
        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.contact = MockContact(tel={
            'type': 'Mobile',
            'value': self.phone_number
        })

        self.UTILS.general.insertContact(self.contact)
Esempio n. 33
0
    def setUp(self):

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

        # Prepare the contact we're going to insert.
        self.contacts = []
        for i in range(3):
            given_name = "Name {}".format(i)
            family_name = "Surname {}".format(i)
            contact = MockContact(givenName=given_name,
                                  familyName=family_name,
                                  name="{} {}".format(given_name, family_name))
            self.contacts.append(contact)
            self.UTILS.general.insertContact(contact)
Esempio n. 34
0
class test_main(GaiaTestCase):

    link = "www.google.com"
    test_msg = "Open this URL: " + link

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.gallery = Gallery(self)
        self.browser = Browser(self)

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.UTILS.reporting.logComment("Sending mms to telephone number " +
                                        self.phone_number)
        self.data_layer.delete_all_sms()
        self.UTILS.statusbar.clearAllStatusBarNotifs()

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

    def test_run(self):
        self.data_layer.connect_to_cell_data()

        self.messages.create_and_send_mms('image', [self.phone_number],
                                          self.test_msg)
        self.messages.wait_for_message()
        last_msg = self.messages.last_message_in_this_thread()
        tags = last_msg.find_elements("tag name", "a")

        # Tap on required link.
        tags[0].tap()
        """
        Give the browser time to start up, then
        switch to the browser frame and check the page loaded.
        """
        time.sleep(3)
        self.marionette.switch_to_frame()
        self.browser.wait_for_page_to_load()
        self.UTILS.test.test(self.link in self.browser.loaded_url(),
                             "Web page loaded correctly.")
Esempio n. 35
0
    def setUp(self):

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

        self.actions = Actions(self.marionette)

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.incoming_sms_num = self.UTILS.general.get_config_variable(
            "sms_platform_numbers", "common").split(',')
        self.UTILS.reporting.logComment("Sending sms to telephone number " +
                                        self.phone_number)
        self.data_layer.delete_all_sms()
Esempio n. 36
0
    def setUp(self):

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

        # Establish which phone number to use and set up the contact.
        self.num1 = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.incoming_sms_num = self.UTILS.general.get_config_variable(
            "sms_platform_numbers", "common").split(',')
        self.contact = MockContact(tel={'type': 'Mobile', 'value': self.num1})

        self.UTILS.general.insertContact(self.contact)
        self.data_layer.delete_all_sms()
        self.UTILS.statusbar.clearAllStatusBarNotifs()
Esempio n. 37
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.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')

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

    def test_run(self):

        # Create and send a new test message.
        msg_text = "Nine 123456789 numbers."
        self.UTILS.messages.create_incoming_sms(self.phone_number, msg_text)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(msg_text, timeout=120)
        title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5)
        self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)
        sms = self.messages.last_message_in_this_thread()

        # Long press the embedded number link.
        link = sms.find_element("tag name", "a")
        link.tap()

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

        contFields = self.contacts.get_contact_fields()

        # Verify the number is in the number field.
        self.UTILS.test.test("123456789" in contFields['tel'].get_attribute("value"),
                        "Our target number is in the telephone field (expected {}).".\
                        format(contFields['tel'].get_attribute("value")))
        """
        Put the contact details into each of the fields (this method
        clears each field first).
        """

        self.contacts.replace_str(contFields['givenName'], "Test27000")
        self.contacts.replace_str(contFields['familyName'], "Testerton")
        x = self.UTILS.element.getElement(DOM.Contacts.done_button, "Done button")
        x.tap()

        # Wait for the contacts app to go away.
        self.marionette.switch_to_frame()
        self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@src, '{}')]".\
                                               format(DOM.Contacts.frame_locator[1])), "Contacts iframe")

        # Verify that the sms app is still running.
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
Esempio n. 38
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)

        # Prepare the contact we're going to insert.
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.contact_1 = MockContact(tel={'type': '', 'value': self.phone_number})
        self.contact_2 = MockContact(tel={'type': '', 'value': self.phone_number})

        self.UTILS.general.insertContact(self.contact_1)
        self.UTILS.reporting.logComment("Using target telephone number " + self.contact_1["tel"]["value"])

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

    def test_run(self):

        # Launch messages app.
        self.messages.launch()
        """
        Send a message to create a thread (use number, not name as this
        avoids some blocking bugs just now).
        """

        self.messages.create_and_send_sms([self.contact_1["tel"]["value"]], "Test message.")
        self.messages.wait_for_message()

        # Open contacts app and modify the contact used to send the SMS in the previous step
        self.contacts.launch()
        self.UTILS.reporting.logComment("Using target telephone number " + self.contact_2["tel"]["value"])
        self.contacts.edit_contact(self.contact_1["name"], self.contact_2)

        # Re-launch messages app.
        self.messages.launch()

        # Verify the thread now contains the name of the contact instead of the phone number
        self.UTILS.reporting.logComment("Trying to open the thread with name: " + self.contact_2["name"])
        self.messages.openThread(self.contact_2["name"])
Esempio n. 39
0
    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.gallery = Gallery(self)
        self.music = Music(self)

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.UTILS.reporting.logComment("Sending mms to telephone number " +
                                        self.phone_number)

        # Load files into the device.
        self.UTILS.general.add_file_to_device('./tests/_resources/80x60.jpg')
        self.UTILS.general.add_file_to_device('./tests/_resources/AMR.amr')
Esempio n. 40
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. 41
0
class test_main(GaiaTestCase):

    test_msgs = ["First message", "Second message", "Third message"]

    def setUp(self):

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

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.UTILS.reporting.logComment("Sending sms to telephone number " +
                                        self.phone_number)
        self.data_layer.delete_all_sms()

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

    def test_run(self):
        self.UTILS.statusbar.clearAllStatusBarNotifs()
        """
        Launch messages app & delete all Threads
        Make sure we have no threads
        """

        self.messages.launch()
        time.sleep(2)

        for i in range(3):
            self.UTILS.reporting.debug("** Sending [{}]".format(
                self.test_msgs[i]))
            self.data_layer.send_sms(self.phone_number, self.test_msgs[i])
            self.UTILS.statusbar.wait_for_notification_toaster_detail(
                self.test_msgs[i], timeout=120)

        self.UTILS.reporting.debug("** Opening thread to check messages")
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
        self.messages.openThread(self.phone_number)

        # Check how many elements are there
        original_count = self.messages.countMessagesInThisThread()
        self.UTILS.reporting.logResult("info", "Before deletion there were {} messages in this thread.".\
                                       format(original_count))

        # Select the messages to be deleted.
        self.messages.deleteMessagesInThisThread([1])

        # Check message isn't there anymore.
        msg_list = self.UTILS.element.getElements(DOM.Messages.message_list,
                                                  "Messages")
        final_count = len(msg_list)
        real_count = original_count - 1
        self.UTILS.test.test(final_count == (original_count - 1),
                        "After deleting the message, there were {} messages in this thread ({}) found).".\
                        format(real_count, final_count))
Esempio n. 42
0
class test_main(GaiaTestCase):
    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.target_number = self.UTILS.general.get_config_variable(
            "target_call_number", "common")
        self.test_msg = "Test message."
        self.data_layer.delete_all_sms()

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

    def test_run(self):

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

        # Create and send a new test message.
        expected = "Test {} number.".format(self.target_number)
        self.messages.create_and_send_sms([self.phone_number], expected)
        send_time = self.messages.last_sent_message_timestamp()
        self.messages.wait_for_message(send_time=send_time)
        self.messages.check_last_message_contents(expected)

        # Tap the header.
        x = self.UTILS.element.getElement(DOM.Messages.message_header,
                                          "Thread header")
        x.tap()

        # Verify that each expected item is present.
        self.UTILS.element.waitForElements(DOM.Messages.header_call_btn,
                                           "Call button")
        self.UTILS.element.waitForElements(
            DOM.Messages.header_create_new_contact_btn,
            "Create new contact button")
        self.UTILS.element.waitForElements(
            DOM.Messages.header_add_to_contact_btn,
            "Add to existing contact button")
        self.UTILS.element.waitForElements(DOM.Messages.contact_cancel_btn,
                                           "Cancel button")
        screenshot = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult('info', "Screenshot", screenshot)
Esempio n. 43
0
    def setUp(self):

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

        # Establish which phone number to use.
        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.incoming_number = self.UTILS.general.get_config_variable(
            "sms_platform_numbers", "common").split(',')
        self.UTILS.reporting.logComment("Sending sms to telephone number " +
                                        self.phone_number)
        self.emails = ["*****@*****.**", "*****@*****.**"]
        self.test_msg = "Test with email addresses: {} and {} at {}".format(
            self.emails[0], self.emails[1], time.time())
        self.data_layer.delete_all_sms()
Esempio n. 44
0
class test_main(GaiaTestCase):
    def setUp(self):

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

        # Prepare the contact we're going to insert.
        self.contact = MockContact()
        self.UTILS.general.insertContact(self.contact)

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

    def test_run(self):

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

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

        # Tap the sms button in the view details screen to go to the sms page.
        smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button,
                                               "Send SMS button")
        smsBTN.tap()
        """
        Switch to the 'Messages' app frame (or marionette will still be watching the
        'Contacts' app!).
        """

        time.sleep(2)
        self.marionette.switch_to_frame()
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
        """
        test: this automatically opens the 'send SMS' screen, so
        check the correct name is in the 'to' field of this sms.
        """

        self.messages.checkIsInToField(self.contact['name'])
Esempio n. 45
0
    def setUp(self):

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

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.test_msg = "Test message at {}".format(time.time())

        self.contact = MockContact(tel={
            'type': 'Mobile',
            'value': self.phone_number
        })
        self.UTILS.general.insertContact(self.contact)
        self.data_layer.delete_all_sms()
        self.UTILS.statusbar.clearAllStatusBarNotifs()