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"])
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))
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)
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)
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)
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): 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)
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)
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")
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"])
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)
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")
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))
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): 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")
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")
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")
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)
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_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()
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")
class test_main(GaiaTestCase): test_msg = "Test message." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.Email = Email(self) self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common") self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common") self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common") self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.emailAddy = self.UTILS.general.get_config_variable("gmail_2_email", "common") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Set up email account. self.connect_to_network() self.Email.launch() self.Email.setup_account(self.email_user, self.email_address, self.email_pass) # Launch messages app. self.messages.launch() # Create and send a new test message. self.messages.create_and_send_sms([self.phone_number], "Email {} one.".format(self.emailAddy)) send_time = self.messages.last_sent_message_timestamp() last_msg = self.messages.wait_for_message(send_time) # Tap the email link. link = last_msg.find_element("tag name", "a") link.tap() edit_btn = self.UTILS.element.getElement(DOM.Messages.header_send_email_btn, "Edit button") edit_btn.tap() # Switch to email frame and verify the email address is in the To field. self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator) to_field = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts, "To field") self.UTILS.test.test(to_field.text == self.emailAddy, "To field contains '{0}' (it was '{0}').".format(self.emailAddy))
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()
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): 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))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.target_number = self.UTILS.general.get_config_variable( "target_call_number", "common") self.test_msg = "Test message." self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() # Create and send a new test message. expected = "Test {} number.".format(self.target_number) self.messages.create_and_send_sms([self.phone_number], expected) send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time=send_time) self.messages.check_last_message_contents(expected) # Tap the header. x = self.UTILS.element.getElement(DOM.Messages.message_header, "Thread header") x.tap() # Verify that each expected item is present. self.UTILS.element.waitForElements(DOM.Messages.header_call_btn, "Call button") self.UTILS.element.waitForElements( DOM.Messages.header_create_new_contact_btn, "Create new contact button") self.UTILS.element.waitForElements( DOM.Messages.header_add_to_contact_btn, "Add to existing contact button") self.UTILS.element.waitForElements(DOM.Messages.contact_cancel_btn, "Cancel button") screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult('info', "Screenshot", screenshot)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.emailAddy = self.UTILS.general.get_config_variable( "gmail_1_email", "common") self.test_msg = "Email {} one, email {} two, email {} three.".\ format("*****@*****.**", self.emailAddy, "*****@*****.**") 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. self.messages.create_and_send_sms([self.phone_number], self.test_msg) send_time = self.messages.last_sent_message_timestamp() x = self.messages.wait_for_message(send_time=send_time) # Long press the 2nd email link. link = x.find_elements("tag name", "a") link[1].tap() # Click 'create new contact'. x = self.UTILS.element.getElement( DOM.Messages.header_create_new_contact_btn, "Create new contact button") x.tap() # Verify that the email is in the email field. self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) x = self.UTILS.element.getElement(("id", "email_0"), "Email field") x_txt = x.get_attribute("value") self.UTILS.test.test( x_txt == self.emailAddy, "Email is '{}' (expected '{}')".format(x_txt, self.emailAddy))
class test_main(GaiaTestCase): test_msg = "Test message." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) # Establish which phone number to use 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': num }) for num in self.nums ] map(self.UTILS.general.insertContact, self.test_contacts) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() # Send a message to myself (long and short number to get a few threads). self.messages.create_and_send_sms(self.nums, "Test message") thread_names = self.UTILS.element.getElements( DOM.Messages.thread_target_names, "Threads target names") contacts_names = [elem["name"] for elem in self.test_contacts] bools = [title.text in contacts_names for title in thread_names] msgs = [ "A thread exists for {}".format(elem) for elem in contacts_names ] map(self.UTILS.test.test, bools, msgs)
class test_main(GaiaTestCase): link = "www.wikipedia.o" 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) boolOK=False try: x.find_element("tag name", "a") except: boolOK = True self.UTILS.test.test(boolOK, "The web address is not a link in the text message")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") 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 = "Four 1234 seven 1234567 eight 12345678 nine 123456789 numbers." self.messages.create_and_send_sms([self.phone_number], test_str) x = self.messages.wait_for_message() # Check how many are links. fnam = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot (for reference):", fnam) y = x.find_elements("tag name", "a") bool7OK = False bool8OK = False bool9OK = False for i in y: self.UTILS.reporting.logResult("info", "FYI: %s is highlighted." % i.text) if i.text == "1234567": bool7OK = True if i.text == "12345678": bool8OK = True if i.text == "123456789": bool9OK = True self.UTILS.test.test(bool7OK, "The 8-digit number is highlighted.") self.UTILS.test.test(bool8OK, "The 8-digit number is highlighted.") self.UTILS.test.test(bool9OK, "The 9-digit number is highlighted.")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") 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 = "Four 1234 seven 1234567 eight 12345678 nine 123456789 numbers." self.messages.create_and_send_sms([self.phone_number], test_str) x = self.messages.wait_for_message() # Check how many are links. fnam = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot (for reference):", fnam) y = x.find_elements("tag name", "a") bool7OK = False bool8OK = False bool9OK = False for i in y: self.UTILS.reporting.logResult("info", "FYI: %s is highlighted." % i.text) if i.text == "1234567": bool7OK = True if i.text == "12345678": bool8OK = True if i.text == "123456789": bool9OK = True self.UTILS.test.test(bool7OK, "The 8-digit number is highlighted.") self.UTILS.test.test(bool8OK, "The 8-digit number is highlighted.") self.UTILS.test.test(bool9OK, "The 9-digit number is highlighted.")
class test_main(GaiaTestCase): link = "www.wikipedia.o" 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) boolOK = False try: x.find_element("tag name", "a") except: boolOK = True self.UTILS.test.test( boolOK, "The web address is not a link in the text message")
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))
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))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.own_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.nums = [ self.own_number, self.UTILS.general.get_config_variable("short_phone_number", "custom") ] self.data_layer.delete_all_sms() self.UTILS.statusbar.clearAllStatusBarNotifs() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.data_layer.remove_all_contacts() # Launch messages app. self.messages.launch() for num in self.nums: test_msg = "Test message at {} for {}".format(time.time(), num) self.messages.create_and_send_sms([num], test_msg) if num == self.own_number: send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time=send_time) else: self.UTILS.statusbar.wait_for_notification_toaster_detail( test_msg, timeout=120) self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) self.messages.go_back() target_names = self.UTILS.element.getElements( DOM.Messages.thread_target_names, "Threads target names") bools = [title.text in self.nums for title in target_names] msgs = ["A thread exists for {}".format(elem) for elem in self.nums] map(self.UTILS.test.test, bools, msgs)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) # Prepare the contact we're going to insert. self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.contact_1 = MockContact(tel={'type': '', 'value': self.phone_number}) self.contact_2 = MockContact(tel={'type': '', 'value': self.phone_number}) self.UTILS.general.insertContact(self.contact_1) self.UTILS.reporting.logComment("Using target telephone number " + self.contact_1["tel"]["value"]) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() """ Send a message to create a thread (use number, not name as this avoids some blocking bugs just now). """ self.messages.create_and_send_sms([self.contact_1["tel"]["value"]], "Test message.") self.messages.wait_for_message() # Open contacts app and modify the contact used to send the SMS in the previous step self.contacts.launch() self.UTILS.reporting.logComment("Using target telephone number " + self.contact_2["tel"]["value"]) self.contacts.edit_contact(self.contact_1["name"], self.contact_2) # Re-launch messages app. self.messages.launch() # Verify the thread now contains the name of the contact instead of the phone number self.UTILS.reporting.logComment("Trying to open the thread with name: " + self.contact_2["name"]) self.messages.openThread(self.contact_2["name"])
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) self.browser = Browser(self) self.messages = Messages(self) self.num = self.UTILS.general.get_config_variable( "phone_number", "custom") self.url1 = "www.google.com" self.url2 = "www.wikipedia.org" self.test_msg = "Test message" def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.data_layer.connect_to_wifi() # Open the first url self.browser.launch() self.browser.open_url(self.url1) self.marionette.switch_to_frame() self.browser.wait_for_page_to_load() self.UTILS.test.test(self.url1 in self.browser.loaded_url(), "Web page loaded correctly.") # Open the SMS app, send a message then jump back to the browser. self.messages.launch() self.messages.create_and_send_sms([self.num], self.test_msg) send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time) self.apps.kill_all() time.sleep(2) self.browser.launch() self.browser.open_url(self.url2) self.marionette.switch_to_frame() self.browser.wait_for_page_to_load() self.UTILS.test.test(self.url2 in self.browser.loaded_url(), "Web page loaded correctly.")
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.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) self.link = "www.wikipedia.org" self.test_msg = "Test with link: {} at {}".format( self.link, time.time()) self.data_layer.delete_all_sms() 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) # Get the link of the first message msg = self.UTILS.element.getElement(DOM.Messages.last_sent_message, "Last sent message") # Verify that a valid URL appears highlight y = msg.find_element("tag name", "a") self.UTILS.test.test( y.text == self.link, "The web link is highlighted in the text 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.phone_number = self.UTILS.general.get_config_variable("short_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") # The returned message won't come to this thread, so just tap the header. x = self.UTILS.element.getElement(DOM.Messages.message_header, "Thread header (edit header)") x.tap() # Verify that the options appear. self.UTILS.element.waitForElements(DOM.Messages.header_call_btn, "Call button") self.UTILS.element.waitForElements(DOM.Messages.header_create_new_contact_btn, "Create new contact button") self.UTILS.element.waitForElements(DOM.Messages.header_add_to_contact_btn, "Add to existing contact button") self.UTILS.element.waitForElements(DOM.Messages.contact_cancel_btn, "Cancel button")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.emailAddy = self.UTILS.general.get_config_variable("gmail_1_email", "common") self.test_msg = "Hello {} old bean at {}.".format(self.emailAddy, time.time()) 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() msg = self.messages.wait_for_message(send_time=send_time) self.messages.check_last_message_contents(self.test_msg) # Tap on 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 button") select_btn.tap() # Long press the email link. _link = msg.find_element("tag name", "a") self.actions = Actions(self.marionette) self.actions.long_press(_link, 2).perform() # Check the email address is not a link in edit mode. self.UTILS.element.waitForNotElements(DOM.Messages.header_create_new_contact_btn, "Create new contact button")
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.") send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time=send_time) # Examine the carrier. expect = self.contact["tel"]["type"] actual = self.messages.threadType() self.UTILS.test.test(expect == actual, "The type is listed as: '{}' (subheader was '{}').".\ format(expect, actual)) expect = self.contact["tel"]["value"] actual = self.messages.threadCarrier() self.UTILS.test.test(expect == actual, "The carrier is listed as: '{}' (subheader was '{}').".\ format(expect, actual))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.target_number = self.UTILS.general.get_config_variable("target_call_number", "common") self.test_msg = "Test message." self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() # Create and send a new test message. expected = "Test {} number.".format(self.target_number) self.messages.create_and_send_sms([self.phone_number], expected) send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time=send_time) self.messages.check_last_message_contents(expected) # Tap the header. x = self.UTILS.element.getElement(DOM.Messages.message_header, "Thread header") x.tap() # Verify that each expected item is present. self.UTILS.element.waitForElements(DOM.Messages.header_call_btn, "Call button") self.UTILS.element.waitForElements(DOM.Messages.header_create_new_contact_btn, "Create new contact button") self.UTILS.element.waitForElements(DOM.Messages.header_add_to_contact_btn, "Add to existing contact button") self.UTILS.element.waitForElements(DOM.Messages.contact_cancel_btn, "Cancel button") screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult('info', "Screenshot", screenshot)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) self.browser = Browser(self) self.messages = Messages(self) self.num = self.UTILS.general.get_config_variable("phone_number", "custom") self.url1 = "www.google.com" self.url2 = "www.wikipedia.org" self.test_msg = "Test message" def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.data_layer.connect_to_wifi() # Open the first url self.browser.launch() self.browser.open_url(self.url1) self.marionette.switch_to_frame() self.browser.wait_for_page_to_load() self.UTILS.test.test(self.url1 in self.browser.loaded_url(), "Web page loaded correctly.") # Open the SMS app, send a message then jump back to the browser. self.messages.launch() self.messages.create_and_send_sms([self.num], self.test_msg) send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time) self.apps.kill_all() time.sleep(2) self.browser.launch() self.browser.open_url(self.url2) self.marionette.switch_to_frame() self.browser.wait_for_page_to_load() self.UTILS.test.test(self.url2 in self.browser.loaded_url(), "Web page loaded correctly.")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) # Get the correct number for the sms device. self.num = 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() """ Send a message to a valid number to create a thread with just an outgoing message """ msg_text = str(time.time()) self.messages.create_and_send_sms([self.num], msg_text) self.messages.wait_for_message() # Add another message to the same thread msg_text = str(time.time()) self.messages.enterSMSMsg(msg_text) self.messages.sendSMS() self.messages.wait_for_message() # Return to the threads view. self.messages.go_back() # Get the preview txt for our test. preview_text = self.messages.getThreadText(self.num) self.UTILS.test.test(preview_text in msg_text, "Preview text (" + preview_text + ") is in the original message text(" + msg_text + ").")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) # Start with no SMS. self.data_layer.delete_all_sms() # Get the correct number for the sms device. 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() """ Send a message to an invalid number to create a thread with just an outgoing message.. """ msg_text = str(time.time()) self.messages.create_and_send_sms([self.phone_number], msg_text) self.messages.wait_for_message() # Return to the threads view. self.messages.go_back() # Get the preview txt for our test. preview_text = self.messages.getThreadText(self.phone_number) self.UTILS.test.test( preview_text in msg_text, "Preview text ({}) is in the original message text({}).".format( preview_text, msg_text))
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.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Sometimes causes a problem if not cleared. self.UTILS.statusbar.clearAllStatusBarNotifs() # Create message - 20 x 10 chars. sms_message = "0123456789" * 20 sms_message_length = len(sms_message) self.UTILS.reporting.logComment("Message length sent: " + str(sms_message_length)) # Launch messages app. self.messages.launch() # Create and send a new test message. self.messages.create_and_send_sms([self.phone_number], sms_message) # Check that this last message is not marked as failed. time.sleep(1) x = self.messages.last_message_in_this_thread() self.UTILS.test.test( "error" not in x.get_attribute("class"), "The last message in this thread is not marked with error icon.")
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.phone_number = self.UTILS.general.get_config_variable( "short_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") # The returned message won't come to this thread, so just tap the header. x = self.UTILS.element.getElement(DOM.Messages.message_header, "Thread header (edit header)") x.tap() # Verify that the options appear. self.UTILS.element.waitForElements(DOM.Messages.header_call_btn, "Call button") self.UTILS.element.waitForElements( DOM.Messages.header_create_new_contact_btn, "Create new contact button") self.UTILS.element.waitForElements( DOM.Messages.header_add_to_contact_btn, "Add to existing contact button") self.UTILS.element.waitForElements(DOM.Messages.contact_cancel_btn, "Cancel button")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") prefix = "+34" if not phone_number.startswith("+34") else "" self.num1 = prefix + phone_number 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 to this contact. self.messages.create_and_send_sms([self.num1], "Test message") self.messages.wait_for_message() # Tap the header. x = self.UTILS.element.getElement(DOM.Messages.message_header, "Thread header") x.tap() # Verify that each expected item is present. self.UTILS.element.waitForElements(DOM.Messages.header_call_btn, "Call button") self.UTILS.element.waitForElements( DOM.Messages.header_create_new_contact_btn, "Create new contact button") self.UTILS.element.waitForElements( DOM.Messages.header_add_to_contact_btn, "Add to existing contact button") self.UTILS.element.waitForElements(DOM.Messages.contact_cancel_btn, "Cancel button")
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.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Sometimes causes a problem if not cleared. self.UTILS.statusbar.clearAllStatusBarNotifs() # Create message - 20 x 10 chars. sms_message = "0123456789" * 20 # Launch messages app. self.messages.launch() # Create and send a new test message. self.messages.create_and_send_sms([self.phone_number], sms_message) 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(sms_message)
class test_main(GaiaTestCase): test_msg = "First 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. self.messages.launch() # Create and send some new tests messages. self.messages.create_and_send_sms([self.phone_number], self.test_msg) self.messages.wait_for_message() self.messages.go_back() # Delete this thread. self.messages.deleteThreads([self.phone_number]) # Check thread isn't there anymore. self.UTILS.element.waitForNotElements( ("xpath", DOM.Messages.thread_selector_xpath.format(self.phone_number)), "Thread")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") 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) x = self.messages.wait_for_message() # Long press the emedded number link. y = x.find_element("tag name", "a") y.tap() # Verufy everything's there. fnam = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot (for reference):", fnam) self.UTILS.element.waitForElements( DOM.Messages.header_create_new_contact_btn, "Create new contact button") self.UTILS.element.waitForElements( DOM.Messages.header_add_to_contact_btn, "Add to existing contact button") self.UTILS.element.waitForElements(DOM.Messages.contact_cancel_btn, "Cancel button")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) # Start with no SMS. self.data_layer.delete_all_sms() # Get the correct number for the sms device. 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() """ Send a message to an invalid number to create a thread with just an outgoing message.. """ msg_text = str(time.time()) self.messages.create_and_send_sms([self.phone_number], msg_text) self.messages.wait_for_message() # Return to the threads view. self.messages.go_back() # Get the preview txt for our test. preview_text = self.messages.getThreadText(self.phone_number) self.UTILS.test.test(preview_text in msg_text, "Preview text ({}) is in the original message text({}).".format(preview_text, msg_text))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.own_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.nums = [self.own_number, self.UTILS.general.get_config_variable("short_phone_number", "custom")] self.data_layer.delete_all_sms() self.UTILS.statusbar.clearAllStatusBarNotifs() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.data_layer.remove_all_contacts() # Launch messages app. self.messages.launch() for num in self.nums: test_msg = "Test message at {} for {}".format(time.time(), num) self.messages.create_and_send_sms([num], test_msg) if num == self.own_number: send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time=send_time) else: self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg, timeout=120) self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) self.messages.go_back() target_names = self.UTILS.element.getElements(DOM.Messages.thread_target_names, "Threads target names") bools = [title.text in self.nums for title in target_names] msgs = ["A thread exists for {}".format(elem) for elem in self.nums] map(self.UTILS.test.test, bools, msgs)
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.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) self.link = "www.wikipedia.org" self.test_msg = "Test with link: {} at {}".format(self.link, time.time()) self.data_layer.delete_all_sms() 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) # Get the link of the first message msg = self.UTILS.element.getElement(DOM.Messages.last_sent_message, "Last sent message") # Verify that a valid URL appears highlight y = msg.find_element("tag name", "a") self.UTILS.test.test(y.text == self.link, "The web link is highlighted in the text message")
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.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.contact = MockContact(tel={'type': '', 'value': self.phone_number}) self.test_msg = "Test." self.UTILS.general.insertContact(self.contact) self.UTILS.reporting.logComment("Using target telephone number " + self.contact["tel"]["value"]) self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): msgapp = self.messages.launch() self.messages.create_and_send_sms([self.phone_number], "Test") send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time=send_time) self.messages.go_back() self.messages.openThread(self.contact["name"]) # Delete the contact self.apps.kill(msgapp) self.contacts.launch() self.contacts.delete_contact(self.contact["name"]) # Go back to SMS app and try to open the thread by phone number self.messages.launch() self.messages.openThread(self.contact["tel"]["value"])