Example #1
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)
Example #2
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.")
Example #3
0
class test_main(GaiaTestCase):

    test_msg = "Test."

    def setUp(self):

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

        # Import contact (adjust to the correct number).
        self.test_num = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.cont = MockContact(tel={"type": "Mobile", "value": self.test_num})
        self.UTILS.reporting.logComment("Using target telephone number " + self.cont["tel"]["value"])

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

    def test_run(self):
        self.UTILS.general.add_file_to_device('./tests/_resources/imgd.jpg')

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

        # Create a new SMS
        self.messages.startNewSMS()

        # Insert the phone number in the To field
        self.messages.addNumbersInToField([self.test_num])

        # Create MMS.
        self.messages.enterSMSMsg(self.test_msg)

        self.messages.create_mms_image()
        self.gallery.click_on_thumbnail_at_position_mms(0)

        # Click send and wait for the message to be received
        self.messages.sendSMS()
        send_time = self.messages.last_sent_message_timestamp()
        """
        Open contacts app and create a contact with the same phone number used to send the MMS in the
        previous step
        """

        self.contacts.launch()
        self.contacts.create_contact(self.cont)

        # Switch back to the messages app.
        self.UTILS.home.goHome()
        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.cont["name"])
        self.messages.openThread(self.cont["name"])
        self.messages.wait_for_message(send_time)
Example #4
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.contact = MockContact(givenName="Name", familyName="Surname", name="Name Surname")
        self.UTILS.general.insertContact(self.contact)

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

    def test_run(self):

        self.messages.launch()

        self.messages.startNewSMS()

        self.messages.addContactToField(self.contact["name"])

        self.UTILS.reporting.logResult("info", "Correct name is in the 'To' list.")
Example #5
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)
Example #6
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)
Example #7
0
class test_main(GaiaTestCase):

    test_msg = "Hello World {}".format(time.time())

    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)
        self.video = Video(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()
        self.expected_sizes = ["4.8", "62.3", "175.6"]
        self.expected_names = ["80x60.jpg", "30k_basic_AMR.amr", "mpeg4.3gp"]

        self.UTILS.general.add_file_to_device('./tests/_resources/80x60.jpg')
        self.UTILS.general.add_file_to_device('./tests/_resources/30k_basic_AMR.amr')
        self.UTILS.general.add_file_to_device('./tests/_resources/mpeg4.mp4')

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

    def test_run(self):

        self.messages.launch()

        self.messages.startNewSMS()
        self.messages.addNumbersInToField([self.phone_number])
        self.messages.enterSMSMsg(self.test_msg)

        self.messages.create_mms_image()
        self.gallery.click_on_thumbnail_at_position_mms(0)

        self.messages.create_mms_music()
        self.music.click_on_song_mms()

        self.messages.create_mms_video()
        self.video.click_on_video_at_position_mms(0)

        # Click send and wait for the message to be received
        self.messages.sendSMS()
        last_msg = self.messages.wait_for_message()
        attachments = self.messages.get_mms_attachments_info(last_msg)
        self.UTILS.reporting.debug("*** ATTACHMENTS: {}".format(attachments))

        # Check the names and sizes of all attachments are as expected
        for (i, att) in enumerate(attachments):
            self.UTILS.test.test(self.expected_names[i] == att["name"] and self.expected_sizes[i] == att["size"],
                                 "Attachment [{}] ({}kb)     Expected [{}] ({}kb)".\
                                 format(self.expected_names[i], self.expected_sizes[i],
                                        att["name"], att["size"]))
Example #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"])
Example #9
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.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.
        self.messages.create_and_send_sms([self.phone_number], "Test message.")
        x = self.messages.wait_for_message()

        # Tap the header to create a contact.
        self.messages.header_createContact()

        # Fill in some details.
        contFields = self.contacts.get_contact_fields()
        self.contacts.replace_str(contFields['givenName'], "Test")
        self.contacts.replace_str(contFields['familyName'], "Testerton")

        # Press the Done button.
        x = self.UTILS.element.getElement(DOM.Contacts.done_button,
                                          "Done button")
        x.tap()

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

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

        # Verify the header is now the name,
        x = self.UTILS.element.getElement(DOM.Messages.message_header,
                                          "Message header")
        self.UTILS.test.test(
            x.text == "Test Testerton",
            "Message header has been changed to match the contact (it was '{}')."
            .format(x.text))

        # Go back to the threads view and check the message name there too.
        self.messages.go_back()
        self.messages.openThread("Test Testerton")
Example #10
0
class test_main(GaiaTestCase):

    test_msg = "Test message\n\nwith line breaks."

    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.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.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.incoming_sms_num, timeout=5)
        self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)

        # Check the received message.
        self.messages.check_last_message_contents(self.test_msg)
Example #11
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.test_num = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.contact1 = MockContact(givenName="Name 1", familyName="Surname 1",
                                    name="Name 1 Surname 1", tel={"type": "Mobile", "value": self.test_num})
        self.UTILS.reporting.logComment("Using target telephone number " + self.contact1["tel"]["value"])
        self.UTILS.general.insertContact(self.contact1)

        self.call_number = self.UTILS.general.get_config_variable("incoming_call_number", "common")
        self.data_layer.delete_all_sms()
        self.UTILS.statusbar.clearAllStatusBarNotifs()
        _ = setup_translations(self)

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

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

        self.messages.startNewSMS()

        self.messages.addContactToField(self.contact1["name"])

        # Insert the phone number in the To field
        self.messages.addNumbersInToField([self.call_number])

        search_str = _("2 recipients")
        self.UTILS.element.headerCheck(search_str)

        # Enter the message.
        self.UTILS.reporting.logResult("info", "Enter the message.")
        self.messages.enterSMSMsg("Test 29911")

        # Send the message.
        self.messages.sendSMS()
        self.UTILS.statusbar.wait_for_notification_toaster_title(self.contact1["name"])
        self.UTILS.iframe.switch_to_frame(*DOM.Messages.frame_locator)

        # Verify the number is shown in the header as there is no contact name
        self.messages.openThread(self.call_number)
        self.messages.checkThreadHeader(self.call_number)

        self.UTILS.reporting.logResult("info", "Verify the number is shown in the header as there is no contact name")

        # Return to main SMS page.
        self.messages.closeThread()

        # Verify the thread now contains the name of the contact instead of the phone number
        self.UTILS.reporting.logResult("info", "Trying to open the thread with name: " + self.contact1["name"])
        self.messages.openThread(self.contact1["name"])
        self.messages.checkThreadHeaderWithNameSurname(self.contact1["name"])
Example #12
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)
Example #13
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.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()

        # Examine the header.
        self.UTILS.element.headerCheck(self.telNum)

        # Close the thread and check we can find it again with this number.
        self.messages.closeThread()
        self.messages.openThread(self.telNum)
Example #14
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()

        # Send several messages to have something in the threads
        for i in range(4):
            sms_message = "Message {} " + "0123456789" * 5
            sms_message = sms_message.format(i)
            self.UTILS.messages.create_incoming_sms(self.phone_number, sms_message)
            self.UTILS.statusbar.wait_for_notification_toaster_detail(sms_message, timeout=120)

        self.messages.launch()
        self.messages.openThread(self.incoming_sms_num[0])
        self.messages.forwardMessage("sms", self.phone_number)
Example #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)

        # Import contact (adjust the correct number).
        self.contact = MockContact()
        self.UTILS.general.insertContact(self.contact)

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

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

        # Start a new SMS and add the message and contact name.
        self.messages.startNewSMS()
        self.messages.selectAddContactButton()
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.contacts.view_contact(self.contact["givenName"], False)
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
        self.messages.checkIsInToField(self.contact["name"], True)

        # Remove it.
        self.messages.removeContactFromToField(self.contact["name"])

        # Verify the contact name is no longer present before removing it.
        self.messages.checkIsInToField(self.contact["name"], False)
Example #16
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)
Example #17
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 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()

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

    def test_run(self):

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

        self.test_msg = "Test message at {}".format(time.time())

        # Send a message to myself (long and short number to get a few threads).
        self.messages.create_and_send_sms([self.num1], self.test_msg)
        self.UTILS.messages.create_incoming_sms(self.num1, self.test_msg)
        self.messages.go_back()
        self.UTILS.statusbar.wait_for_notification_toaster_detail(
            self.test_msg, timeout=120)
        incoming_num = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(
            self.incoming_sms_num,
            frame_to_change=DOM.Messages.frame_locator,
            timeout=5)

        # Check the threads for the required elements: name, time and excerpt
        for num in [self.contact["name"], incoming_num]:
            thread = self.UTILS.element.getElementByXpath(
                DOM.Messages.thread_selector_xpath.format(num))
            name = self.marionette.find_element(*DOM.Messages.threads,
                                                id=thread.id).text
            self.UTILS.test.test(
                num == name,
                "Expected thread name: {} Actual value: {}".format(num, name))
            thread_time = self.marionette.find_element('css selector',
                                                       'p.summary time',
                                                       id=thread.id).text
            self.UTILS.test.test(thread_time,
                                 "Thread time found: {}".format(thread_time))
            excerpt = self.marionette.find_element('css selector',
                                                   'p.summary span.body-text',
                                                   id=thread.id)
            self.UTILS.test.test(excerpt,
                                 "Thread excerpt found: {}".format(excerpt))
Example #18
0
class test_main(GaiaTestCase):

    test_str = "abcdefghijklmnopqrstuvwxyz"

    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()
        """
        Type a message containing the required string 
        (the test is already included in 'enterSMSMsg' because it uses 'typeThis()').
        """

        self.messages.startNewSMS()

        self.messages.enterSMSMsg(self.test_str, False)

        self.UTILS.debug.screenShot("5968")
Example #19
0
class test_main(GaiaTestCase):

    test_msg = "Hello World"

    def setUp(self):

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

        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.test_msg = "Test message for test 31727"
        self.UTILS.general.add_file_to_device('./tests/_resources/300x300.png')

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

    def test_run(self):
        self.messages.launch()
        self.messages.startNewSMS()
        self.messages.addNumbersInToField([self.phone_number])
        self.messages.enterSMSMsg(self.test_msg)
        self.messages.create_mms_image()
        self.gallery.click_on_thumbnail_at_position_mms(0)
        self.messages.sendSMS()

        self.messages.wait_for_message()
        self.messages.check_last_message_contents(self.test_msg, mms=True)
        self.messages.verify_mms_received('img', self.phone_number)
Example #20
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)
Example #21
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.contact = MockContact(givenName="Name",
                                   familyName="Surname",
                                   name="Name Surname")
        self.UTILS.general.insertContact(self.contact)

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

    def test_run(self):

        self.messages.launch()

        self.messages.startNewSMS()

        self.messages.addContactToField(self.contact["name"])

        self.UTILS.reporting.logResult("info",
                                       "Correct name is in the 'To' list.")
Example #22
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)
Example #23
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)
Example #24
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)
Example #25
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)
Example #26
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))
Example #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.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))
Example #28
0
class test_main(GaiaTestCase):

    test_msg = "Test."

    def setUp(self):

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

        # Import contact (adjust to the correct number).
        self.test_num = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.cont = MockContact(tel={"type": "Mobile", "value": self.test_num})
        self.UTILS.reporting.logComment("Using target telephone number " +
                                        self.cont["tel"]["value"])

        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 a new SMS
        self.messages.startNewSMS()

        # Insert the phone number in the To field
        self.messages.addNumbersInToField([self.test_num])

        # Create SMS.
        self.messages.enterSMSMsg(self.test_msg)

        # Click send and wait for the message to be received
        self.messages.sendSMS()
        self.messages.wait_for_message()
        self.messages.go_back()
        """
        Open contacts app and create a contact with the same phone number used to send the SMS in the
        previous step
        """

        self.contacts.launch()
        self.contacts.create_contact(self.cont)

        # Switch back to the messages app.
        # self.UTILS.app.switchToApp("Messages")
        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.cont["name"])
        self.messages.openThread(self.cont["name"])
Example #29
0
class test_main(GaiaTestCase):

    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.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):

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

        # Create and send a new test message containing all of our numbers..
        nums = ["12345678", "123456789", "01234567", "012345678"]
        sms_msg = "Test numbers {}".format(", ".join(nums))
        self.UTILS.messages.create_incoming_sms(self.phone_number, sms_msg)
        self.UTILS.statusbar.wait_for_notification_toaster_detail(sms_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)
        sms = self.messages.last_message_in_this_thread()

        # Tap the numbers to call.
        msg_nums = sms.find_elements("tag name", "a")

        for i in range(len(msg_nums)):
            num = msg_nums[i]
            num.tap()
            num_text = num.text

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

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

            # Dialer is started with the number already filled in.
            time.sleep(1)
            x = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number")
            self.UTILS.test.test(num_text == x.get_attribute("value"),
                            "The dialer number contains '{}' (expected '{}').".\
                            format(num_text, x.get_attribute("value")))

            # Switch back to messaging app (without killing anything) etc ...
            self.messages.launch()

            # We need to recover the last message and the numbers, since the reference is lost in
            # the frame changes
            sms = self.messages.last_message_in_this_thread()
            msg_nums = sms.find_elements("tag name", "a")
Example #30
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)

        # 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.general.remove_files()
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.UTILS.statusbar.clearAllStatusBarNotifs()
        self.UTILS.general.add_file_to_device('./tests/_resources/80x60.jpg')

        # Create message.
        sms_message = "Test"

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

        # Create and send a new test message.
        self.messages.create_and_send_sms([self.phone_number], sms_message)
        self.messages.wait_for_message()
        self.messages.go_back()

        self.UTILS.element.waitForNotElements(DOM.Messages.mms_icon,
                                              "MMS Icon")

        self.messages.startNewSMS()

        # Insert the phone number in the To field
        self.messages.addNumbersInToField([self.phone_number])

        # Create MMS.
        self.messages.enterSMSMsg(sms_message)

        self.messages.create_mms_image()
        self.gallery.click_on_thumbnail_at_position_mms(0)

        # Click send and wait for the message to be received
        self.messages.sendSMS()
        self.messages.wait_for_message()

        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
        self.messages.go_back()

        self.messages.checkMMSIcon(self.phone_number)
Example #31
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)
Example #32
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")
Example #33
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))
Example #34
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):
        """
        Launch messages app & delete all Threads
        Make sure we have no threads
        """

        self.messages.launch()

        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.iframe.switchToFrame(*DOM.Messages.frame_locator)
        self.messages.openThread(self.phone_number)

        # Go into edit mode..
        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 messages button")
        select_btn.tap()

        # Select all
        select_all_btn = self.UTILS.element.getElement(DOM.Messages.check_all_messages_btn, "Select all button")
        select_all_btn.tap()

        # Tap delete
        self.messages.deleteSelectedMessages()

        # Check conversation isn't there anymore.
        self.UTILS.element.waitForNotElements(("xpath",
            DOM.Messages.thread_selector_xpath.format(self.phone_number)), "Thread")

        time.sleep(1)
        fnam = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot of final position:", fnam)
Example #35
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)

        # 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.general.remove_files()
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.UTILS.statusbar.clearAllStatusBarNotifs()
        self.UTILS.general.add_file_to_device('./tests/_resources/80x60.jpg')

        # Create message.
        sms_message = "Test"

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

        # Create and send a new test message.
        self.messages.create_and_send_sms([self.phone_number], sms_message)
        self.messages.wait_for_message()
        self.messages.go_back()

        self.UTILS.element.waitForNotElements(DOM.Messages.mms_icon, "MMS Icon")

        self.messages.startNewSMS()

        # Insert the phone number in the To field
        self.messages.addNumbersInToField([self.phone_number])

        # Create MMS.
        self.messages.enterSMSMsg(sms_message)

        self.messages.create_mms_image()
        self.gallery.click_on_thumbnail_at_position_mms(0)

        # Click send and wait for the message to be received
        self.messages.sendSMS()
        self.messages.wait_for_message()

        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
        self.messages.go_back()

        self.messages.checkMMSIcon(self.phone_number)
Example #36
0
class test_main(GaiaTestCase):

    test_msg = "Test."

    def setUp(self):

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

        # Import contact (adjust to the correct number).
        self.test_num = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.cont = MockContact(tel={"type": "Mobile", "value": self.test_num})
        self.UTILS.reporting.logComment("Using target telephone number " + self.cont["tel"]["value"])

        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 a new SMS
        self.messages.startNewSMS()

        # Insert the phone number in the To field
        self.messages.addNumbersInToField([self.test_num])

        # Create SMS.
        self.messages.enterSMSMsg(self.test_msg)

        # Click send and wait for the message to be received
        self.messages.sendSMS()
        self.messages.wait_for_message()
        self.messages.go_back()
        """
        Open contacts app and create a contact with the same phone number used to send the SMS in the
        previous step
        """

        self.contacts.launch()
        self.contacts.create_contact(self.cont)

        # Switch back to the messages app.
        # self.UTILS.app.switchToApp("Messages")
        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.cont["name"])
        self.messages.openThread(self.cont["name"])
Example #37
0
class test_main(GaiaTestCase):

    test_msg = "Test message."

    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()
        self.UTILS.general.insertContact(self.contact)

    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], "Test message.")
        self.messages.wait_for_message()

        # Tap the header to create a contact.
        self.messages.header_addToContact()

        # Select our contact.
        self.contacts.view_contact(self.contact["givenName"], False)

        # Check the phone number.
        second_phone = self.UTILS.element.getElement(("id", "number_1"), "2nd phone number.")
        self.UTILS.test.test(second_phone.get_attribute("value") == self.phone_number,
                             "Contact now has a 2nd number which is '{}' (it was '{}').".format(self.phone_number, second_phone.get_attribute("value")))

        # Press the Done button.
        done_btn = self.UTILS.element.getElement(DOM.Contacts.edit_update_button, "Update button")
        done_btn.tap()

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

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

        # Verify the header is now the name,
        header = self.UTILS.element.getElement(DOM.Messages.message_header, "Message header")
        self.UTILS.test.test(header.text == self.contact["name"],
                             "Message header has been changed to match the contact (it was '{}').".format(header.text))

        # Go back to the threads view and check the message name there too.
        self.messages.go_back()
        self.messages.openThread(self.contact["name"])
Example #38
0
class test_main(GaiaTestCase):

    test_msg = "Hello World"

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.gallery = Gallery(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)

        # Prepare the contact we're going to insert.
        self.contact = MockContact(tel={
            'type': '',
            'value': self.phone_number
        })
        self.UTILS.general.insertContact(self.contact)
        self.data_layer.delete_all_sms()
        self.UTILS.statusbar.clearAllStatusBarNotifs()

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

    def test_run(self):

        # Load an image file into the device.
        self.UTILS.general.add_file_to_device('./tests/_resources/80x60.jpg')

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

        # Create a new SMS
        self.messages.startNewSMS()

        # Insert the phone number in the To field
        self.messages.addNumbersInToField([self.phone_number])

        # Create MMS.
        self.messages.enterSMSMsg(self.test_msg)
        self.messages.create_mms_image()
        self.gallery.click_on_thumbnail_at_position_mms(0)

        # Click send and wait for the message to be received
        self.messages.sendSMS()
        self.messages.wait_for_message()

        self.messages.forwardMessageToContact("mms", self.contact["name"])
Example #39
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))
Example #40
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")
Example #41
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.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.
        self.messages.create_and_send_sms([self.phone_number], "Test message.")
        x = self.messages.wait_for_message()

        # Tap the header to create a contact.
        self.messages.header_createContact()

        # Fill in some details.
        contFields = self.contacts.get_contact_fields()
        self.contacts.replace_str(contFields['givenName'], "Test")
        self.contacts.replace_str(contFields['familyName'], "Testerton")

        # Press the Done button.
        x = self.UTILS.element.getElement(DOM.Contacts.done_button, "Done button")
        x.tap()

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

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

        # Verify the header is now the name,
        x = self.UTILS.element.getElement(DOM.Messages.message_header, "Message header")
        self.UTILS.test.test(x.text == "Test Testerton",
                        "Message header has been changed to match the contact (it was '{}').".format(x.text))

        # Go back to the threads view and check the message name there too.
        self.messages.go_back()
        self.messages.openThread("Test Testerton")
Example #42
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.contacts = Contacts(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))
        self.messages.wait_for_message()

        # Tap the header to create a contact.
        self.messages.header_createContact()
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)

        # Cancel the action.
        form_header = self.UTILS.element.getElement(
            DOM.Contacts.contact_form_header, "Contact form header")
        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")
Example #43
0
class test_main(GaiaTestCase):

    def setUp(self):

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

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        self.UTILS.statusbar.toggleViaStatusBar('airplane')

    def test_run(self):

        # Create a new SMS
        self.messages.launch()
        self.messages.startNewSMS()

        # Insert the phone number in the To field
        self.messages.addNumbersInToField([self.target_num])

        # Create SMS.
        self.messages.enterSMSMsg(self.test_msg)

        # Click send.
        self.messages.sendSMS()
        send_time = self.messages.last_sent_message_timestamp()

        # Wait for the SMS to arrive.
        self.messages.wait_for_message(send_time=send_time)

        self.UTILS.home.goHome()

        # Put the phone into airplane mode.
        self.UTILS.statusbar.toggleViaStatusBar('airplane')

        self.UTILS.reporting.debug("*** Launching messages again!!!")
        self.messages.launch()

        # Open sms app and go to the previous thread
        self.messages.openThread(self.target_num)

        # Create another SMS.
        self.messages.enterSMSMsg(self.test_msg)

        # Click send.
        self.messages.sendSMS()

        # Check that popup appears.
        self.messages.checkAirplaneModeWarning()
Example #44
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")
Example #45
0
class test_main(GaiaTestCase):

    test_msg = "Test."

    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)
        self.settings = Settings(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)

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

    def test_run(self):

        # Load files into the device.
        self.UTILS.general.add_file_to_device('./tests/_resources/imgd.jpg')
        self.UTILS.general.add_file_to_device('./tests/_resources/MP3.mp3')

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

        # Create a new SMS
        self.messages.startNewSMS()

        # Insert the phone number in the To field
        self.messages.addNumbersInToField([self.phone_number])

        # Create MMS.
        self.messages.enterSMSMsg(self.test_msg)

        self.messages.create_mms_image()
        self.gallery.click_on_thumbnail_at_position_mms(0)

        self.messages.create_mms_music()
        self.music.click_on_song_mms()

        # Click send and wait for the message to be received
        self.messages.sendSMS()
        self.messages.wait_for_message()
        self.messages.verify_mms_received('img', self.phone_number)
        self.messages.verify_mms_received('audio', self.phone_number)
Example #46
0
class test_main(GaiaTestCase):
    def setUp(self):

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

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        self.UTILS.statusbar.toggleViaStatusBar('airplane')

    def test_run(self):

        # Create a new SMS
        self.messages.launch()
        self.messages.startNewSMS()

        # Insert the phone number in the To field
        self.messages.addNumbersInToField([self.target_num])

        # Create SMS.
        self.messages.enterSMSMsg(self.test_msg)

        # Click send.
        self.messages.sendSMS()
        send_time = self.messages.last_sent_message_timestamp()

        # Wait for the SMS to arrive.
        self.messages.wait_for_message(send_time=send_time)

        self.UTILS.home.goHome()

        # Put the phone into airplane mode.
        self.UTILS.statusbar.toggleViaStatusBar('airplane')

        self.UTILS.reporting.debug("*** Launching messages again!!!")
        self.messages.launch()

        # Open sms app and go to the previous thread
        self.messages.openThread(self.target_num)

        # Create another SMS.
        self.messages.enterSMSMsg(self.test_msg)

        # Click send.
        self.messages.sendSMS()

        # Check that popup appears.
        self.messages.checkAirplaneModeWarning()
Example #47
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)
Example #48
0
class test_main(GaiaTestCase):

    test_msg = "Test message."

    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.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")

        self.test_contact = MockContact(email=[{"type": "Personal", "value": "*****@*****.**"},
                                               {"type": "Personal", "value": "*****@*****.**"},
                                               {"type": "Personal", "value": "*****@*****.**"}])
        self.UTILS.general.insertContact(self.test_contact)

        self.UTILS.general.add_file_to_device('./tests/_resources/contact_face.jpg')
        self.data_layer.delete_all_sms()

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

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

        self.messages.create_and_send_sms([self.phone_number], "Hello {} old bean.".format(self.email_address))
        send_time = self.messages.last_sent_message_timestamp()
        msg = self.messages.wait_for_message(send_time=send_time)

        # Press the email link.
        link = msg.find_element("tag name", "a")
        link.tap()

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

        # Verify that the email is in the email field.
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.contacts.view_contact(self.test_contact["givenName"], False)
        self.UTILS.element.waitForElements(("xpath",
                                            "//input[@type='email' and @value='{}']".format(self.email_address)),
                                           "New email address")

        self.contacts.add_gallery_image_to_contact(0)
        done_button = self.UTILS.element.getElement(DOM.Contacts.edit_update_button, "'Update' button")
        done_button.tap()

        # Check that the contacts iframe is now gone.
        self.marionette.switch_to_frame()
        self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@src,'contacts')]"),
                                              "Contact app iframe")
Example #49
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)
Example #50
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()
Example #51
0
class test_main(GaiaTestCase):

    def setUp(self):

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

        # 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 number in the target field.
        self.messages.addNumbersInToField([self.phone_number])

        # Enter a message the message area.
        test_msg = "test message"
        self.messages.enterSMSMsg(test_msg)

        # Check the 'Send' button is now enabled.
        send_btn = self.UTILS.element.getElement(DOM.Messages.send_message_button, "Send message button")
        self.UTILS.test.test(send_btn.is_enabled(), "Send button is enabled when everything's filled in.")
        """
        Delete the text (we should already be in the message area with the
        keyboard present, but we need to 'manually' use the keyboard for this).
        """

        for i in range(len(test_msg)):
            self.keyboard.tap_backspace()
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)

        msg_area = self.UTILS.element.getElement(DOM.Messages.input_message_area, "Message area")
        self.UTILS.test.test(msg_area.text == "", "Message area is clear after deleting all characters in it.")

        # Check the Send button isn't enabled any more.
        send_btn = self.UTILS.element.getElement(DOM.Messages.send_message_button, "Send message button")
        self.UTILS.test.test(not send_btn.is_enabled(), 
                        "Send button is not enabled after target number is supplied, but message still empty.")
Example #52
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.Dialer = Dialer(self)

        phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        prefix = "0034"
        self.num1 = prefix + phone_number if not phone_number.startswith(
            "+34") else prefix + phone_number[3:]
        self.num2 = phone_number[3:] if phone_number.startswith(
            "+34") else phone_number

        self.contact = MockContact(tel={'type': 'Mobile', 'value': self.num1})
        self.UTILS.general.insertContact(self.contact)

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

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

        # Create and send a new test message to this contact.
        self.messages.startNewSMS()
        self.messages.selectAddContactButton()
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.contacts.view_contact(self.contact["givenName"], False)
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
        self.messages.checkIsInToField(self.contact["name"], True)

        self.messages.enterSMSMsg("Test message.")
        self.messages.sendSMS()

        self.messages.wait_for_message()

        # Tap the header to call.
        self.messages.header_call()

        # Dialler is started with the number already filled in.
        phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number,
                                                    "Phone number")
        self.UTILS.test.test(
            self.num2 in phone_field.get_attribute("value"),
            "The phone number contains '{}' (it was '{}').".format(
                self.num1, phone_field.get_attribute("value")))
Example #53
0
class test_main(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.contacts = Contacts(self)
        self.gallery = Gallery(self)

        self.test_num = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.cont = MockContact(tel={"type": "Mobile", "value": self.test_num})

        self.UTILS.general.insertContact(self.cont)
        self.UTILS.general.add_file_to_device('./tests/_resources/imga.jpg')
        self.UTILS.reporting.logComment("Using target telephone number " +
                                        self.cont["tel"]["value"])

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

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

        self.messages.startNewSMS()
        self.messages.enterSMSMsg("Test")

        self.messages.create_mms_image()
        self.gallery.click_on_thumbnail_at_position_mms(0)

        # Search for our contact.
        time.sleep(5)
        self.messages.selectAddContactButton()
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)

        self.contacts.search(self.cont["name"])
        self.contacts.check_search_results(self.cont["name"])

        result = self.UTILS.element.getElements(
            DOM.Contacts.search_results_list, "Contacts search results")
        for contact in result:
            if contact.text == self.cont["name"]:
                contact.tap()
                break

        self.apps.switch_to_displayed_app()

        # Now check the correct name is in the 'To' list.
        self.messages.checkIsInToField(self.cont["name"])
        self.messages.sendSMS()
Example #54
0
class test_main(GaiaTestCase):
    def setUp(self):
        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 = 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()

        # 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.check_search_results(self.contact["name"])

        contact_list = self.UTILS.element.getElements(
            DOM.Contacts.search_results_list, "Contacts search results")
        for c in contact_list:
            if c.text == self.contact["name"]:
                c.tap()
                break

        # Switch back to the sms iframe.
        self.apps.switch_to_displayed_app()

        # Now check the correct name is in the 'To' list.
        self.messages.checkIsInToField(self.contact["name"])
        self.messages.sendSMS()
Example #55
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.
        """

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

        x.find_element("tag name", "a").tap()
        """
        Give the browser time to start up, then
        switch to the browser frame and check the page loaded.
        """
        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.".format(self.link))
Example #56
0
class test_main(GaiaTestCase):

    test_msg = "Test."

    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")

        # Put the phone into airplane mode.
        self.data_layer.set_setting('airplaneMode.enabled', True)
        self.data_layer.delete_all_sms()
        self.UTILS.statusbar.clearAllStatusBarNotifs()

    def tearDown(self):
        self.data_layer.set_setting('airplaneMode.enabled', False)
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        self.messages.launch()

        # Create a new SMS
        self.messages.startNewSMS()

        # Insert the phone number in the To field
        self.messages.addNumbersInToField([self.phone_number])

        # Create SMS.
        self.messages.enterSMSMsg(self.test_msg)

        # Click send.
        self.messages.sendSMS()

        time.sleep(3)

        # Check that popup appears.
        self.messages.checkAirplaneModeWarning()

        # Check an error indication is shown in message
        self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
        msg = self.messages.last_message_in_this_thread()
        indication = msg.get_attribute("class").index("error") != -1
        self.UTILS.test.test(indication == True, "An indication error was found")