class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.email = Email(self) self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common") self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common") self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common") self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.emailAddy = self.UTILS.general.get_config_variable("gmail_2_email", "common") self.connect_to_network() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.email.launch() self.email.setup_account(self.email_user, self.email_address, self.email_pass) # Create and send a new test message. self.messages.launch() test_msg = "Email address {} test at {}".format(self.emailAddy, time.time()) self.data_layer.send_sms(self.phone_number, test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg, timeout=120) self.UTILS.statusbar.click_on_notification_detail(test_msg, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() # Verify that the email address opens the email app. link = sms.find_element("tag name", "a") link.tap() self.wait_for_element_displayed(*DOM.Messages.header_send_message_btn, timeout=30) cancel = self.UTILS.element.getElement(DOM.Messages.contact_cancel_btn, "Cancel button") cancel.tap() # Go into edit mode. edit_btn = self.UTILS.element.getElement(DOM.Messages.edit_messages_icon, "Edit button") edit_btn.tap() # Select Messages mode select_msgs_btn = self.UTILS.element.getElement(DOM.Messages.edit_msgs_select_btn, "Select messages button") select_msgs_btn.tap() self.UTILS.element.waitForElements(DOM.Messages.edit_msgs_header, "Edit messages mode header") # Verify that the email address does not open the email app. sms = self.messages.last_message_in_this_thread() link = sms.find_element("tag name", "a") link.tap() # Now try to find the email app iframe. self.wait_for_element_not_displayed(*DOM.Messages.header_send_message_btn, timeout=30)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.dialer = Dialer(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',') self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() # Create and send a new test message containing all of our numbers.. nums = ["12345678", "123456789", "01234567", "012345678"] sms_msg = "Test numbers {}".format(", ".join(nums)) self.UTILS.messages.create_incoming_sms(self.phone_number, sms_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(sms_msg, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() # Tap the numbers to call. msg_nums = sms.find_elements("tag name", "a") for i in range(len(msg_nums)): num = msg_nums[i] num.tap() num_text = num.text call_btn = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button") call_btn.tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) # Dialer is started with the number already filled in. time.sleep(1) x = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number") self.UTILS.test.test(num_text == x.get_attribute("value"), "The dialer number contains '{}' (expected '{}').".\ format(num_text, x.get_attribute("value"))) # Switch back to messaging app (without killing anything) etc ... self.messages.launch() # We need to recover the last message and the numbers, since the reference is lost in # the frame changes sms = self.messages.last_message_in_this_thread() msg_nums = sms.find_elements("tag name", "a")
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) # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.incoming_number = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',') self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number) self.link = "www.wikipedia.org" self.test_msg = "Test with link {} at {}".format(self.link, time.time()) 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.connect_to_network() self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120) self.UTILS.statusbar.click_on_notification_detail(self.test_msg, frame_to_change=DOM.Messages.frame_locator) self.UTILS.reporting.debug("Checking last message in thread") #Verify that a valid URL appears highlight msg = self.messages.last_message_in_this_thread() 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 __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.Email = Email(self) self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common") self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common") self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common") self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.emailAddy = self.UTILS.general.get_config_variable("gmail_2_email", "common") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Set up email account. self.connect_to_network() self.Email.launch() self.Email.setup_account(self.email_user, self.email_address, self.email_pass) # Launch messages app. self.messages.launch() # Create and send a new test message. msg_text = "Email one [email protected], two {} , three [email protected] at {}".\ format(self.emailAddy, time.time()) self.data_layer.send_sms(self.phone_number, msg_text) self.UTILS.statusbar.wait_for_notification_toaster_detail(msg_text, timeout=120) self.UTILS.statusbar.click_on_notification_detail(msg_text, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() time.sleep(1) # Tap the 2nd email link. self.UTILS.reporting.logResult("info", "Click the email address in this message: '{}'.".format(sms.text)) _link = sms.find_elements("tag name", "a")[1] _link.tap() # Click on "Send email" button from the overlay send_btn = self.UTILS.element.getElement(DOM.Messages.header_send_email_btn, "Send email button") send_btn.tap() # Switch to email frame and verify the email address is in the To field. self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator) x = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts, "To field") self.UTILS.test.test(x.text == self.emailAddy, "To field contains '{}' (it was '{}').".format(self.emailAddy, self.emailAddy))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',') def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Create and send a new test message. msg_text = "Nine 123456789 numbers." self.UTILS.messages.create_incoming_sms(self.phone_number, msg_text) self.UTILS.statusbar.wait_for_notification_toaster_detail(msg_text, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() # Long press the embedded number link. link = sms.find_element("tag name", "a") link.tap() # Select create new contact. btn = self.UTILS.element.getElement(DOM.Messages.header_create_new_contact_btn, "Create new contact button") btn.tap() self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) contFields = self.contacts.get_contact_fields() # Verify the number is in the number field. self.UTILS.test.test("123456789" in contFields['tel'].get_attribute("value"), "Our target number is in the telephone field (expected {}).".\ format(contFields['tel'].get_attribute("value"))) """ Put the contact details into each of the fields (this method clears each field first). """ self.contacts.replace_str(contFields['givenName'], "Test27000") self.contacts.replace_str(contFields['familyName'], "Testerton") x = self.UTILS.element.getElement(DOM.Contacts.done_button, "Done button") x.tap() # Wait for the contacts app to go away. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@src, '{}')]".\ format(DOM.Contacts.frame_locator[1])), "Contacts iframe") # Verify that the sms app is still running. self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.email = Email(self) self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common") self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common") self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common") self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.dest_email = self.UTILS.general.get_config_variable("gmail_2_email", "common") self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Create and send a new test message. test_msg = "email address {} test at {}".format(self.dest_email, time.time()) self.data_layer.send_sms(self.phone_number, test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg, timeout=120) self.UTILS.statusbar.click_on_notification_detail(test_msg, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() time.sleep(1) # Tap the 2nd email link. self.UTILS.reporting.logResult("info", u"Click the email address in this message: '{}'.".format(sms.text)) _link = sms.find_element("tag name", "a") _link.tap() send_btn = self.UTILS.element.getElement(DOM.Messages.header_send_email_btn, "Send email button") send_btn.tap() time.sleep(4) self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator) setup_confirm = self.UTILS.element.getElement(DOM.Email.email_not_setup_ok, "Set up account confirmation") setup_confirm.tap() # Try to set up the account - Since there is no connection, it will fail. self.email.setup_account_first_step(self.email_user, self.email_address) time.sleep(5) self.UTILS.iframe.switch_to_frame("data-url", "google") self.UTILS.element.getElement(('css selector', 'h1[data-l10n-id=unable-to-connect]'), "Unable to connect message")
class test_main(GaiaTestCase): links = ["www.google.com", "www.hotmail.com", "www.wikipedia.org"] test_msg = "Test " + " ".join(links) + " this." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.browser = Browser(self) # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.connect_to_network() # Create and send a new test message. self.data_layer.send_sms(self.phone_number, self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail( self.test_msg, timeout=120) map(self.try_link, range(len(self.links)), self.links) def try_link(self, link_number, link): self.UTILS.reporting.logResult("info", "Tapping <b>{}</b> ...".format(link)) # Switch to messaging app. self.messages.launch() self.messages.openThread(self.phone_number) time.sleep(1) # Get last message. msg = self.messages.last_message_in_this_thread() # Find all URLs l = msg.find_element("xpath", "//a[text()='{}']".format(link)) # Tap on required link. self.UTILS.element.simulateClick(l) self.marionette.switch_to_frame() self.browser.wait_for_page_to_load() self.UTILS.test.test( link in self.browser.loaded_url(), "Web page loaded #{} correctly.".format(link_number + 1))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.actions = Actions(self.marionette) # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.incoming_sms_num = self.UTILS.general.get_config_variable( "sms_platform_numbers", "common").split(',') self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number) self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() timestamp = " {}".format(time.time()) sms_message = "0123456789" * 5 + timestamp self.UTILS.reporting.logComment("Message length sent: {}".format( (len(sms_message)))) self.UTILS.messages.create_incoming_sms(self.phone_number, sms_message) self.UTILS.statusbar.wait_for_notification_toaster_detail(timestamp, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles( self.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title( title, DOM.Messages.frame_locator) # Open sms option with longtap on it self.UTILS.reporting.logResult("info", "Open sms option with longtap on it") sms = self.messages.last_message_in_this_thread() body = self.marionette.find_element(*DOM.Messages.last_message_body, id=sms.id) self.actions.long_press(body, 2).perform() # Press cancel button self.UTILS.reporting.logResult("info", "Clicking cancel button") time.sleep(2) cancel_btn = self.UTILS.element.getElement( DOM.Messages.cancel_btn_msg_opt, "Cancel button is displayed") self.UTILS.reporting.debug("*** Cancel button: {} text: {}".format( cancel_btn, cancel_btn.text)) self.UTILS.element.simulateClick(cancel_btn)
class test_main(GaiaTestCase): test_num = "0781234567890" 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") self.cp_incoming_number = self.UTILS.general.get_config_variable( "sms_platform_numbers", "common").split(',') self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail( self.test_msg, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles( self.cp_incoming_number, timeout=5) self.UTILS.statusbar.click_on_notification_title( title, DOM.Messages.frame_locator) last_msg = self.messages.last_message_in_this_thread() last_msg.find_element("tag name", "a").tap() x = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button") x.tap() time.sleep(5) 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_num = "089123456" test_msg = "Testing " + test_num + " number." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.Dialer = Dialer(self) self.contacts = Contacts(self) # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.cp_incoming_number = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',') self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number) self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.connect_to_network() self.UTILS.statusbar.clearAllStatusBarNotifs() # Launch messages app. self.messages.launch() self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.cp_incoming_number, timeout=5) self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator) last_msg = self.messages.last_message_in_this_thread() num = last_msg.find_element("tag name", "a") num.tap() call_btn = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button") call_btn.tap() time.sleep(5) # Create a contact from this number. self.Dialer.createContactFromThisNum() # Make sure the number is automatically in the contact details. number_field = self.UTILS.element.getElement(("id", "number_0"), "Mobile number field") self.UTILS.test.test(number_field.get_attribute("value") == self.test_num, "The correct number is automatically entered in the new contact's number field.")
class test_main(GaiaTestCase): links = ["www.google.com", "www.hotmail.com", "www.wikipedia.org"] test_msg = "Test " + " ".join(links) + " this." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.browser = Browser(self) # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.connect_to_network() # Create and send a new test message. self.data_layer.send_sms(self.phone_number, self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120) map(self.try_link, range(len(self.links)), self.links) def try_link(self, link_number, link): self.UTILS.reporting.logResult("info", "Tapping <b>{}</b> ...".format(link)) # Switch to messaging app. self.messages.launch() self.messages.openThread(self.phone_number) time.sleep(1) # Get last message. msg = self.messages.last_message_in_this_thread() # Find all URLs l = msg.find_element("xpath", "//a[text()='{}']".format(link)) # Tap on required link. self.UTILS.element.simulateClick(l) self.marionette.switch_to_frame() self.browser.wait_for_page_to_load() self.UTILS.test.test( link in self.browser.loaded_url(), "Web page loaded #{} correctly.".format(link_number + 1))
class test_main(GaiaTestCase): test_msg = "Test." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") # Put the phone into airplane mode. self.data_layer.set_setting('airplaneMode.enabled', True) self.data_layer.delete_all_sms() self.UTILS.statusbar.clearAllStatusBarNotifs() def tearDown(self): self.data_layer.set_setting('airplaneMode.enabled', False) self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() # Create a new SMS self.messages.startNewSMS() # Insert the phone number in the To field self.messages.addNumbersInToField([self.phone_number]) # Create SMS. self.messages.enterSMSMsg(self.test_msg) # Click send. self.messages.sendSMS() time.sleep(3) # Check that popup appears. self.messages.checkAirplaneModeWarning() # Check an error indication is shown in message self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) msg = self.messages.last_message_in_this_thread() indication = msg.get_attribute("class").index("error") != -1 self.UTILS.test.test(indication == True, "An indication error was found")
class test_main(GaiaTestCase): test_num = "0781234567890" 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") self.cp_incoming_number = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',') self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.cp_incoming_number, timeout=5) self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator) last_msg = self.messages.last_message_in_this_thread() last_msg.find_element("tag name", "a").tap() x = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button") x.tap() time.sleep(5) 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): link = "www.google.com" test_msg = "Open this URL: " + link def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.gallery = Gallery(self) self.browser = Browser(self) # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number) self.data_layer.delete_all_sms() self.UTILS.statusbar.clearAllStatusBarNotifs() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.data_layer.connect_to_cell_data() self.messages.create_and_send_mms('image', [self.phone_number], self.test_msg) self.messages.wait_for_message() last_msg = self.messages.last_message_in_this_thread() tags = last_msg.find_elements("tag name", "a") # Tap on required link. tags[0].tap() """ Give the browser time to start up, then switch to the browser frame and check the page loaded. """ time.sleep(3) self.marionette.switch_to_frame() self.browser.wait_for_page_to_load() self.UTILS.test.test(self.link in self.browser.loaded_url(), "Web page loaded correctly.")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.actions = Actions(self.marionette) # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',') self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number) self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() timestamp = " {}".format(time.time()) sms_message = "0123456789" * 5 + timestamp self.UTILS.reporting.logComment("Message length sent: {}".format((len(sms_message)))) self.UTILS.messages.create_incoming_sms(self.phone_number, sms_message) self.UTILS.statusbar.wait_for_notification_toaster_detail(timestamp, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator) # Open sms option with longtap on it self.UTILS.reporting.logResult("info", "Open sms option with longtap on it") sms = self.messages.last_message_in_this_thread() body = self.marionette.find_element(*DOM.Messages.last_message_body, id=sms.id) self.actions.long_press(body, 2).perform() # Press cancel button self.UTILS.reporting.logResult("info", "Clicking cancel button") time.sleep(2) cancel_btn = self.UTILS.element.getElement(DOM.Messages.cancel_btn_msg_opt, "Cancel button is displayed") self.UTILS.reporting.debug("*** Cancel button: {} text: {}".format(cancel_btn, cancel_btn.text)) self.UTILS.element.simulateClick(cancel_btn)
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) # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.incoming_number = self.UTILS.general.get_config_variable( "sms_platform_numbers", "common").split(',') self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number) self.link = "www.wikipedia.org" self.test_msg = "Test with link {} at {}".format( self.link, time.time()) 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.connect_to_network() self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail( self.test_msg, timeout=120) self.UTILS.statusbar.click_on_notification_detail( self.test_msg, frame_to_change=DOM.Messages.frame_locator) self.UTILS.reporting.debug("Checking last message in thread") #Verify that a valid URL appears highlight msg = self.messages.last_message_in_this_thread() 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.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): 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.cp_incoming_number = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',') self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number) self.connect_to_network() self.UTILS.statusbar.clearAllStatusBarNotifs() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.cp_incoming_number, timeout=5) self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator) last_msg = self.messages.last_message_in_this_thread() last_msg.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. 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): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.email = Email(self) self.email_user = self.UTILS.general.get_config_variable( "gmail_1_user", "common") self.email_address = self.UTILS.general.get_config_variable( "gmail_1_email", "common") self.email_pass = self.UTILS.general.get_config_variable( "gmail_1_pass", "common") self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.dest_email = 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() # Create and send a new test message. test_msg = "email address {} test at {}".format( self.dest_email, time.time()) self.data_layer.send_sms(self.phone_number, test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg, timeout=120) self.UTILS.statusbar.click_on_notification_detail( test_msg, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() time.sleep(1) # Tap the 2nd email link. self.UTILS.reporting.logResult( "info", "Click the email address in this message: '{}'.".format(sms.text)) _link = sms.find_element("tag name", "a") _link.tap() # Tap on "Send email" button from the overlay send_btn = self.UTILS.element.getElement( DOM.Messages.header_send_email_btn, "Send email button") send_btn.tap() time.sleep(4) self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator) # Confirm we want to setUp our email account confirm = self.UTILS.element.getElement(DOM.Email.email_not_setup_ok, "Set up account confirmation") confirm.tap() self.email.setup_account(self.email_user, self.email_address, self.email_pass, via_activity=True) # Verify the email address is in the To field. to_field = self.UTILS.element.getElement( DOM.Email.compose_to_from_contacts, "To field") self.UTILS.test.test( to_field.text == self.dest_email, "To field contains '{0}' (it was '{0}').".format(self.dest_email)) # Fill in the details and send the email. self.UTILS.general.typeThis(DOM.Email.compose_subject, "'Subject' field", "Test email", True, False) self.UTILS.general.typeThis(DOM.Email.compose_msg, "Message field", "Just a test", True, False, False) send_btn = self.UTILS.element.getElement(DOM.Email.compose_send_btn, "Send button") send_btn.tap() self.UTILS.element.waitForNotElements(DOM.Messages.send_email_failed, "Sending email error message", timeout=10)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.incoming_sms_num = self.UTILS.general.get_config_variable( "sms_platform_numbers", "common").split(',') self.contact = MockContact() self.UTILS.general.insertContact(self.contact) 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. msg_text = "Nine 111111111 numbers." self.UTILS.messages.create_incoming_sms(self.phone_number, msg_text) self.UTILS.statusbar.wait_for_notification_toaster_detail(msg_text, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles( self.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title( title, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() # Long press the embedded number link. num = sms.find_element("tag name", "a") num.tap() # Select add to existing contact. add_btn = self.UTILS.element.getElement( DOM.Messages.header_add_to_contact_btn, "Add to existing contact button") add_btn.tap() self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) # Select our contact. self.contacts.view_contact(self.contact["givenName"], False) # Check the phone number. num = self.UTILS.element.getElement(("id", "number_1"), "2nd phone number.") self.UTILS.test.test( num.get_attribute("value") == "111111111", "Contact now has a 2nd number which is '111111111' (it was '{}').". format(num.get_attribute("value"))) # Press the update button. update_btn = self.UTILS.element.getElement( DOM.Contacts.edit_update_button, "Update button") update_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)
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.Dialer = Dialer(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.dummy_nums = ["00342222222", "+343333333"] self.incoming_sms_num = self.UTILS.general.get_config_variable( "sms_platform_numbers", "common").split(',') def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Create and send a new test message containing all of our CORRECT numbers.. msg_app = self.messages.launch() msg_text = "International num: {}, and {}.".format( self.dummy_nums[0], self.dummy_nums[1]) self.UTILS.messages.create_incoming_sms(self.phone_number, msg_text) self.UTILS.statusbar.wait_for_notification_toaster_detail(msg_text, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles( self.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title( title, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() # Tap the number to call. msg_nums = sms.find_elements("tag name", "a") self.UTILS.test.test(len(msg_nums) == 2, "There are <b>{}</b> numbers highlighted in the received text (expected <b>2</b>).".\ format(len(msg_nums))) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "SMS in app", x) self.try_number(msg_nums, 1) # Kill everything, then re-launch the messaging app etc ... self.apps.kill(msg_app) time.sleep(3) self.messages.launch() self.messages.openThread(title) x = self.messages.last_message_in_this_thread() msg_nums = x.find_elements("tag name", "a") self.try_number(msg_nums, 0) def try_number(self, p_msgs, p_num): link_num = self.dummy_nums[p_num] self.UTILS.reporting.logResult( "info", "Tapping link to number: {}.".format(link_num)) self.UTILS.reporting.logResult( "info", "Link text is '{}'.".format(p_msgs[p_num].text)) p_msgs[p_num].tap() time.sleep(1) x = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button") x.tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) time.sleep(2) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot of dialer after clicking the link for number {}".\ format(link_num), x) x = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number") x_num = x.get_attribute("value") self.UTILS.test.test(link_num in x_num, "Expected number ({}) matches number in dialer ({}).".\ format(link_num, x_num))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.dialer = Dialer(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.incoming_sms_num = self.UTILS.general.get_config_variable( "sms_platform_numbers", "common").split(',') self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() # Create and send a new test message containing all of our numbers.. nums = ["12345678", "123456789", "01234567", "012345678"] sms_msg = "Test numbers {}".format(", ".join(nums)) self.UTILS.messages.create_incoming_sms(self.phone_number, sms_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(sms_msg, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles( self.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title( title, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() # Tap the numbers to call. msg_nums = sms.find_elements("tag name", "a") for i in range(len(msg_nums)): num = msg_nums[i] num.tap() num_text = num.text call_btn = self.UTILS.element.getElement( DOM.Messages.header_call_btn, "Call button") call_btn.tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) # Dialer is started with the number already filled in. time.sleep(1) x = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number") self.UTILS.test.test(num_text == x.get_attribute("value"), "The dialer number contains '{}' (expected '{}').".\ format(num_text, x.get_attribute("value"))) # Switch back to messaging app (without killing anything) etc ... self.messages.launch() # We need to recover the last message and the numbers, since the reference is lost in # the frame changes sms = self.messages.last_message_in_this_thread() msg_nums = sms.find_elements("tag name", "a")
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.Dialer = Dialer(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.dummy_nums = ["00342222222", "+343333333"] self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',') def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Create and send a new test message containing all of our CORRECT numbers.. msg_app = self.messages.launch() msg_text = "International num: {}, and {}.".format(self.dummy_nums[0], self.dummy_nums[1]) self.UTILS.messages.create_incoming_sms(self.phone_number, msg_text) self.UTILS.statusbar.wait_for_notification_toaster_detail(msg_text, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() # Tap the number to call. msg_nums = sms.find_elements("tag name", "a") self.UTILS.test.test(len(msg_nums) == 2, "There are <b>{}</b> numbers highlighted in the received text (expected <b>2</b>).".\ format(len(msg_nums))) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "SMS in app", x) self.try_number(msg_nums, 1) # Kill everything, then re-launch the messaging app etc ... self.apps.kill(msg_app) time.sleep(3) self.messages.launch() self.messages.openThread(title) x = self.messages.last_message_in_this_thread() msg_nums = x.find_elements("tag name", "a") self.try_number(msg_nums, 0) def try_number(self, p_msgs, p_num): link_num = self.dummy_nums[p_num] self.UTILS.reporting.logResult("info", "Tapping link to number: {}.".format(link_num)) self.UTILS.reporting.logResult("info", "Link text is '{}'.".format(p_msgs[p_num].text)) p_msgs[p_num].tap() time.sleep(1) x = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button") x.tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) time.sleep(2) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot of dialer after clicking the link for number {}".\ format(link_num), x) x = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number") x_num = x.get_attribute("value") self.UTILS.test.test(link_num in x_num, "Expected number ({}) matches number in dialer ({}).".\ format(link_num, x_num))
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.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',') self.UTILS.reporting.logComment("Sending messages to telephone number " + self.phone_number) self.data_layer.delete_all_sms() self.UTILS.statusbar.clearAllStatusBarNotifs() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Create and send a new test message containing all of our CORRECT numbers.. self.UTILS.reporting.logResult("info", "<b>Check CORRECT numbers are ok ...</b>") nums = ["12345678", "123456789"] self.check_numbers(nums, range(2)) self.UTILS.reporting.logResult("info", "<b>Check INCORRECT numbers are ok ...</b>") nums = ["123", "1234"] self.check_numbers(nums, []) self.UTILS.reporting.logResult("info", "<b>Check MIXED numbers are ok ...</b>") nums = ["123", "12345678", "1234"] self.check_numbers(nums, [1]) def check_numbers(self, nums, tappables): # Generate a string of the type: "Test0 <number> Test1 <number>...." fill_text = ["Test{}".format(i) for i in range(len(nums))] sms_msg = "Test numbers: {}".format(" ".join([item for sublist in map(None, fill_text, nums) for item in sublist])) # Start each test run from scratch. self.apps.kill_all() self.UTILS.messages.create_incoming_sms(self.phone_number, sms_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(sms_msg, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() # Get the numbers in the SMS msg_nums = sms.find_elements("tag name", "a") description = "There are <b>{}</b> numbers highlighted in the received text (expected <b>{}</b>)." self.UTILS.test.test(len(msg_nums) == len(tappables), description.format(len(msg_nums), len(tappables))) for i in range(len(msg_nums)): msg_nums[i].tap() # Press Call button from options overlay x = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button") x.tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) # Dialer is started with the number already filled in. time.sleep(1) number = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number").get_attribute("value") description = "The phone number is '{}' (expected '{}').".format(number, nums[tappables[i]]) self.UTILS.test.test(nums[tappables[i]] == number, description) # Kill everything, then re-launch the messaging app etc ... self.messages.launch() sms = self.messages.last_message_in_this_thread() msg_nums = sms.find_elements("tag name", "a")
class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.email = Email(self) self.email_user = self.UTILS.general.get_config_variable( "gmail_1_user", "common") self.email_address = self.UTILS.general.get_config_variable( "gmail_1_email", "common") self.email_pass = self.UTILS.general.get_config_variable( "gmail_1_pass", "common") self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.emailAddy = self.UTILS.general.get_config_variable( "gmail_2_email", "common") self.connect_to_network() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.email.launch() self.email.setup_account(self.email_user, self.email_address, self.email_pass) # Create and send a new test message. self.messages.launch() test_msg = "Email address {} test at {}".format( self.emailAddy, time.time()) self.data_layer.send_sms(self.phone_number, test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg, timeout=120) self.UTILS.statusbar.click_on_notification_detail( test_msg, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() # Verify that the email address opens the email app. link = sms.find_element("tag name", "a") link.tap() self.wait_for_element_displayed(*DOM.Messages.header_send_message_btn, timeout=30) cancel = self.UTILS.element.getElement(DOM.Messages.contact_cancel_btn, "Cancel button") cancel.tap() # Go into edit mode. edit_btn = self.UTILS.element.getElement( DOM.Messages.edit_messages_icon, "Edit button") edit_btn.tap() # Select Messages mode select_msgs_btn = self.UTILS.element.getElement( DOM.Messages.edit_msgs_select_btn, "Select messages button") select_msgs_btn.tap() self.UTILS.element.waitForElements(DOM.Messages.edit_msgs_header, "Edit messages mode header") # Verify that the email address does not open the email app. sms = self.messages.last_message_in_this_thread() link = sms.find_element("tag name", "a") link.tap() # Now try to find the email app iframe. self.wait_for_element_not_displayed( *DOM.Messages.header_send_message_btn, timeout=30)
class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.email = Email(self) self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common") self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common") self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common") self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.dest_email = 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() # Create and send a new test message. test_msg = "email address {} test at {}".format(self.dest_email, time.time()) self.data_layer.send_sms(self.phone_number, test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg, timeout=120) self.UTILS.statusbar.click_on_notification_detail(test_msg, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() time.sleep(1) # Tap the 2nd email link. self.UTILS.reporting.logResult("info", "Click the email address in this message: '{}'.".format(sms.text)) _link = sms.find_element("tag name", "a") _link.tap() # Tap on "Send email" button from the overlay send_btn = self.UTILS.element.getElement(DOM.Messages.header_send_email_btn, "Send email button") send_btn.tap() time.sleep(4) self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator) # Confirm we want to setUp our email account confirm = self.UTILS.element.getElement(DOM.Email.email_not_setup_ok, "Set up account confirmation") confirm.tap() self.email.setup_account(self.email_user, self.email_address, self.email_pass, via_activity=True) # Verify the email address is in the To field. to_field = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts, "To field") self.UTILS.test.test(to_field.text == self.dest_email, "To field contains '{0}' (it was '{0}').".format(self.dest_email)) # Fill in the details and send the email. self.UTILS.general.typeThis(DOM.Email.compose_subject, "'Subject' field", "Test email", True, False) self.UTILS.general.typeThis(DOM.Email.compose_msg, "Message field", "Just a test", True, False, False) send_btn = self.UTILS.element.getElement(DOM.Email.compose_send_btn, "Send button") send_btn.tap() self.UTILS.element.waitForNotElements(DOM.Messages.send_email_failed, "Sending email error message", timeout=10)
class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.Email = Email(self) self.email_user = self.UTILS.general.get_config_variable( "gmail_1_user", "common") self.email_address = self.UTILS.general.get_config_variable( "gmail_1_email", "common") self.email_pass = self.UTILS.general.get_config_variable( "gmail_1_pass", "common") self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.emailAddy = self.UTILS.general.get_config_variable( "gmail_2_email", "common") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Set up email account. self.connect_to_network() self.Email.launch() self.Email.setup_account(self.email_user, self.email_address, self.email_pass) # Launch messages app. self.messages.launch() # Create and send a new test message. msg_text = "Email one [email protected], two {} , three [email protected] at {}".\ format(self.emailAddy, time.time()) self.data_layer.send_sms(self.phone_number, msg_text) self.UTILS.statusbar.wait_for_notification_toaster_detail(msg_text, timeout=120) self.UTILS.statusbar.click_on_notification_detail( msg_text, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() time.sleep(1) # Tap the 2nd email link. self.UTILS.reporting.logResult( "info", "Click the email address in this message: '{}'.".format(sms.text)) _link = sms.find_elements("tag name", "a")[1] _link.tap() # Click on "Send email" button from the overlay send_btn = self.UTILS.element.getElement( DOM.Messages.header_send_email_btn, "Send email button") send_btn.tap() # Switch to email frame and verify the email address is in the To field. self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator) x = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts, "To field") self.UTILS.test.test( x.text == self.emailAddy, "To field contains '{}' (it was '{}').".format( self.emailAddy, self.emailAddy))
class test_main(GaiaTestCase): test_num = "089123456" test_msg = "Testing " + test_num + " number." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.Dialer = Dialer(self) self.contacts = Contacts(self) # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.cp_incoming_number = self.UTILS.general.get_config_variable( "sms_platform_numbers", "common").split(',') self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number) self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.connect_to_network() self.UTILS.statusbar.clearAllStatusBarNotifs() # Launch messages app. self.messages.launch() self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail( self.test_msg, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles( self.cp_incoming_number, timeout=5) self.UTILS.statusbar.click_on_notification_title( title, DOM.Messages.frame_locator) last_msg = self.messages.last_message_in_this_thread() num = last_msg.find_element("tag name", "a") num.tap() call_btn = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button") call_btn.tap() time.sleep(5) # Create a contact from this number. self.Dialer.createContactFromThisNum() # Make sure the number is automatically in the contact details. number_field = self.UTILS.element.getElement(("id", "number_0"), "Mobile number field") self.UTILS.test.test( number_field.get_attribute("value") == self.test_num, "The correct number is automatically entered in the new contact's number field." )