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