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)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Get details of our test contacts. self.contact = MockContact(tel=[{ 'type': 'Mobile', 'value': '11111111' }, { 'type': 'Mobile', 'value': '222222222' }]) """ We're not testing adding a contact, so just stick one into the database. """ self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the 2nd sms button (index=1) in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement( ("id", DOM.Contacts.sms_button_specific_id.format(0)), "1st send SMS button") smsBTN.tap() """ Switch to the 'Messages' app frame (or marionette will still be watching the 'Contacts' app!). """ self.marionette.switch_to_frame() self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) time.sleep(2) """ test: this automatically opens the 'send SMS' screen, so check the correct name is in the header of this sms. """ self.UTILS.element.headerCheck("1 recipient") # Check this is the right number. self.messages.checkIsInToField(self.contact["name"]) self.messages.checkNumberIsInToField(self.contact["tel"][0]["value"])
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Get details of our test contacts. self.contact = MockContact(tel=[{'type': 'Mobile', 'value': '11111111'}, {'type': 'Mobile', 'value': '222222222'}]) """ We're not testing adding a contact, so just stick one into the database. """ self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # Select our contact. # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the 2nd sms button (index=1) in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement(("id", DOM.Contacts.sms_button_specific_id.format(1)), "2nd send SMS button") smsBTN.tap() """ Switch to the 'Messages' app frame (or marionette will still be watching the 'Contacts' app!). """ self.marionette.switch_to_frame() self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) time.sleep(3) """ test: this automatically opens the 'send SMS' screen, so check the correct name is in the header of this sms. """ self.UTILS.element.headerCheck("1 recipient") # Check this is the right number. self.messages.checkIsInToField(self.contact["name"]) self.messages.checkNumberIsInToField(self.contact["tel"][1]["value"])
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")))
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()
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()
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()
class test_main(GaiaTestCase): test_msg = "Test text - please ignore." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Prepare the contact we're going to insert. self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.contact = MockContact(tel={ 'type': 'Mobile', 'value': self.phone_number }) self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the sms button in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button") smsBTN.tap() """ Switch to the 'Messages' app frame (or marionette will still be watching the 'Contacts' app!). """ time.sleep(5) self.marionette.switch_to_frame() self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) self.UTILS.element.headerCheck("1 recipient") self.messages.checkIsInToField(self.contact['name'])
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.Dialer = Dialer(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom").split("+34")[-1] self.contact = MockContact(tel={'type': 'Mobile', 'value': self.phone_number}) 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. 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() send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time=send_time) # Tap the header to call. self.messages.header_call() # Dialer is started with the number already filled in. time.sleep(2) phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field", False) dialer_num = phone_field.get_attribute("value") self.UTILS.test.test(self.phone_number == dialer_num, "The phone is '{}' (expected '{}').".\ format(dialer_num, self.phone_number))
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")))
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()
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Prepare the contact we're going to insert. self.contact = MockContact() self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the sms button in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button") smsBTN.tap() """ Switch to the 'Messages' app frame (or marionette will still be watching the 'Contacts' app!). """ time.sleep(2) self.marionette.switch_to_frame() self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) """ test: this automatically opens the 'send SMS' screen, so check the correct name is in the 'to' field of this sms. """ self.messages.checkIsInToField(self.contact['name'])
class test_main(GaiaTestCase): test_msg = "Test text - please ignore." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Prepare the contact we're going to insert. self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.contact = MockContact(tel={'type': 'Mobile', 'value': self.phone_number}) self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the sms button in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button") smsBTN.tap() """ Switch to the 'Messages' app frame (or marionette will still be watching the 'Contacts' app!). """ time.sleep(5) self.marionette.switch_to_frame() self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) self.UTILS.element.headerCheck("1 recipient") self.messages.checkIsInToField(self.contact['name'])
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.contacts = [] for i in range(3): given_name = "Name {}".format(i) family_name = "Surname {}".format(i) contact = MockContact(givenName=given_name, familyName=family_name, name="{} {}".format(given_name, family_name)) self.contacts.append(contact) self.UTILS.general.insertContact(contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() self.messages.startNewSMS() for c in self.contacts: self.messages.addContactToField(c["name"]) # Remove it. self.messages.removeContactFromToField(self.contacts[1]["name"]) # Verify the contact name is not present after removal self.messages.checkIsInToField(self.contacts[1]["name"], False) self.UTILS.reporting.logResult("info", "It is not the 'To' list.")
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.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) # Search the contacts list for our contact. contact_list = self.UTILS.element.getElements(DOM.Contacts.view_all_contact_list, "Contacts list") for c in contact_list: if c.text == self.contact["name"]: self.UTILS.reporting.logResult("info", "Tapping ...") c.tap() break time.sleep(2) self.apps.switch_to_displayed_app() self.messages.checkIsInToField("", True)
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) # Import some contacts. # Set the one we'll match to have a valid phone number. self.contact_1 = MockContact( tel={ "type": "Mobile", "value": self.UTILS.general.get_config_variable("phone_number", "custom") }) self.contact_2 = MockContact() self.contact_3 = MockContact(givenName="AAAAAAAAAAAAAAAALEX", familyName="SMITHXXXXXXXX", name="AAAAAAAAAAAAAAAALEX SMITHXXXXXXXX") self.contact_4 = MockContact(tel=[{ "type": "Mobile 1", "carrier": "MoviStar1", "value": "444444444" }, { "type": "Mobile 2", "carrier": "MoviStar2", "value": "555555555" }, { "type": "Mobile 3", "carrier": "MoviStar3", "value": "666666666" }]) self.contact_5 = MockContact(email=[{ "type": "", "value": "*****@*****.**" }, { "type": "", "value": "*****@*****.**" }, { "type": "", "value": "*****@*****.**" }]) # Set a couple of them to be favorites (including the one we'll use). self.contact_1["category"] = "favorite" self.contact_2["category"] = "favorite" # Insert all the contacts. self.UTILS.general.insertContact(self.contact_1) self.UTILS.general.insertContact(self.contact_2) self.UTILS.general.insertContact(self.contact_3) self.UTILS.general.insertContact(self.contact_4) self.UTILS.general.insertContact(self.contact_5) self.UTILS.reporting.logComment("Using target telephone number " + self.contact_1["tel"]["value"]) self.test_msg = "Test message at {}".format(time.time()) 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(self.test_msg) # Search for our contact in the favourites section. self.messages.selectAddContactButton() self.UTILS.reporting.debug("*** Looking for contact named {}".format( self.contact_1['givenName'])) self.UTILS.iframe.switch_to_frame(*DOM.Contacts.frame_locator) cont = self.UTILS.element.getElement( (DOM.Contacts.favourite_by_name[0], DOM.Contacts.favourite_by_name[1].format( self.contact_1['givenName'])), "Favourite contact", timeout=20) cont.tap() self.UTILS.iframe.switch_to_frame(*DOM.Messages.frame_locator) # Now check the correct name is in the 'To' list. self.messages.checkIsInToField(self.contact_1["name"]) self.messages.sendSMS() send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time=send_time) self.messages.check_last_message_contents(self.test_msg)
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Establish which phone number to use and set up the contacts. self.nums = [ self.UTILS.general.get_config_variable("phone_number", "custom"), self.UTILS.general.get_config_variable("short_phone_number", "custom") ] self.test_contacts = [ MockContact(tel={ 'type': 'Mobile', 'value': self.nums[i] }) for i in range(2) ] map(self.UTILS.general.insertContact, self.test_contacts) self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() # Now create and send a SMS to both contacts. self.messages.launch() self.messages.startNewSMS() for i in range(len(self.test_contacts)): self.messages.selectAddContactButton() self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) self.contacts.view_contact(self.test_contacts[i]["name"], False) self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) self.messages.checkIsInToField(self.test_contacts[i]["name"], True) test_msg = "Test message." self.messages.enterSMSMsg(test_msg) self.messages.sendSMS() # Since the destination number is the own, we will only receive one message, so we check it once self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg, timeout=120) self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) # We will also check there is one thread for each contact in the To field name_xpath = DOM.Messages.thread_selector_xpath.format( self.test_contacts[0]['name']) thread = self.UTILS.element.getElementByXpath(name_xpath) self.UTILS.test.test( thread, "Thread for {} found".format(self.test_contacts[0]['name'])) name_xpath = DOM.Messages.thread_selector_xpath.format( self.test_contacts[1]['name']) thread = self.UTILS.element.getElementByXpath(name_xpath) self.UTILS.test.test( thread, "Thread for {} found".format(self.test_contacts[1]['name']))
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) # Import some contacts. # Set the one we'll match to have a valid phone number. self.contact_1 = MockContact(tel={"type": "Mobile", "value": self.UTILS.general.get_config_variable("phone_number", "custom")}) self.contact_2 = MockContact() self.contact_3 = MockContact(givenName="AAAAAAAAAAAAAAAALEX", familyName="SMITHXXXXXXXX", name="AAAAAAAAAAAAAAAALEX SMITHXXXXXXXX") self.contact_4 = MockContact(tel=[{"type": "Mobile 1", "carrier": "MoviStar1", "value": "444444444"}, {"type": "Mobile 2", "carrier": "MoviStar2", "value": "555555555"}, {"type": "Mobile 3", "carrier": "MoviStar3", "value": "666666666"}]) self.contact_5 = MockContact(email=[{"type": "", "value": "*****@*****.**"}, {"type": "", "value": "*****@*****.**"}, {"type": "", "value": "*****@*****.**"}]) # Set a couple of them to be favorites (including the one we'll use). self.contact_1["category"] = "favorite" self.contact_2["category"] = "favorite" # Insert all the contacts. self.UTILS.general.insertContact(self.contact_1) self.UTILS.general.insertContact(self.contact_2) self.UTILS.general.insertContact(self.contact_3) self.UTILS.general.insertContact(self.contact_4) self.UTILS.general.insertContact(self.contact_5) self.UTILS.reporting.logComment("Using target telephone number " + self.contact_1["tel"]["value"]) self.test_msg = "Test message at {}".format(time.time()) 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(self.test_msg) # Search for our contact in the favourites section. self.messages.selectAddContactButton() self.UTILS.reporting.debug("*** Looking for contact named {}".format(self.contact_1['givenName'])) self.UTILS.iframe.switch_to_frame(*DOM.Contacts.frame_locator) cont = self.UTILS.element.getElement((DOM.Contacts.favourite_by_name[0], DOM.Contacts.favourite_by_name[1].format(self.contact_1['givenName'])), "Favourite contact", timeout=20) cont.tap() self.UTILS.iframe.switch_to_frame(*DOM.Messages.frame_locator) # Now check the correct name is in the 'To' list. self.messages.checkIsInToField(self.contact_1["name"]) self.messages.sendSMS() send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time=send_time) self.messages.check_last_message_contents(self.test_msg)