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) # 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.UTILS.statusbar.clearAllStatusBarNotifs() # Create and send a new test message. 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) 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) # 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 = "This text has multiple spaces 1 2 3 4 5." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) # Remove number and import contact. 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) 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.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator) # Check the receievd message. self.messages.check_last_message_contents(self.test_msg)
class test_main(GaiaTestCase): test_msg = "This text has multiple spaces 1 2 3 4 5." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) # Remove number and import contact. 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) 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.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title( title, DOM.Messages.frame_locator) # Check the receievd message. self.messages.check_last_message_contents(self.test_msg)
class test_main(GaiaTestCase): test_msg = "Hello World" def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.gallery = Gallery(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number) self.test_msg = "Test message for test 31727" self.UTILS.general.add_file_to_device('./tests/_resources/300x300.png') def tearDown(self): self.UTILS.general.remove_files() self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() self.messages.startNewSMS() self.messages.addNumbersInToField([self.phone_number]) self.messages.enterSMSMsg(self.test_msg) self.messages.create_mms_image() self.gallery.click_on_thumbnail_at_position_mms(0) self.messages.sendSMS() self.messages.wait_for_message() self.messages.check_last_message_contents(self.test_msg, mms=True) self.messages.verify_mms_received('img', self.phone_number)
class test_main(GaiaTestCase): test_msg = "Test." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Prepare the contact we're going to insert. self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.contact = MockContact(givenName='AAAAAAAAAAAAAAAALEX', familyName='SMITHXXXXXXXX', name='AAAAAAAAAAAAAAAALEX SMITHXXXXXXXX', tel={ 'type': 'Mobile', 'value': self.phone_number }) self.UTILS.general.insertContact(self.contact) self.cp_incoming_number = self.UTILS.general.get_config_variable( "sms_platform_numbers", "common").split(',') self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() self.UTILS.messages.create_incoming_sms(self.contact["tel"]["value"], self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail( self.test_msg, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles( self.cp_incoming_number, timeout=5) self.UTILS.statusbar.click_on_notification_title( title, DOM.Messages.frame_locator) # Launch contacts app. self.contacts.launch() # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the sms button in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button") smsBTN.tap() time.sleep(2) self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) self.messages.check_last_message_contents(self.test_msg)
class test_main(GaiaTestCase): test_msg = "Test." def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) self.target_mms_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.contact_1 = MockContact(tel={ 'type': 'Mobile', 'value': self.target_mms_number }) self.UTILS.reporting.logComment("Using target telephone number " + self.contact_1["tel"]["value"]) self.UTILS.general.insertContact(self.contact_1) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() self.contacts.view_contact(self.contact_1['name']) # Tap the sms button in the view details screen to go to the sms page. sms_button = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button") sms_button.tap() self.apps.switch_to_displayed_app() time.sleep(10) self.wait_for_condition( lambda m: m.find_element(*DOM.Messages.target_numbers ).text == self.contact_1['name'], timeout=10, message="To field is already prepulated with our contact info") # Create SMS. self.messages.enterSMSMsg(self.test_msg) self.messages.sendSMS() # Wait for the last message in this thread to be a 'received' one. self.UTILS.statusbar.wait_for_notification_toaster_detail( self.test_msg, timeout=120) self.UTILS.statusbar.click_on_notification_detail( self.test_msg, DOM.Messages.frame_locator) self.messages.check_last_message_contents(self.test_msg)
class test_main(GaiaTestCase): test_msg = "Test." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Prepare the contact we're going to insert. self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.contact = MockContact(givenName='AAAAAAAAAAAAAAAALEX', familyName='SMITHXXXXXXXX', name='AAAAAAAAAAAAAAAALEX SMITHXXXXXXXX', tel={'type': 'Mobile', 'value': self.phone_number}) self.UTILS.general.insertContact(self.contact) self.cp_incoming_number = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',') self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() self.UTILS.messages.create_incoming_sms(self.contact["tel"]["value"], self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.cp_incoming_number, timeout=5) self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator) # Launch contacts app. self.contacts.launch() # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the sms button in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button") smsBTN.tap() time.sleep(2) self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) self.messages.check_last_message_contents(self.test_msg)
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.cp_incoming_number = self.UTILS.general.get_config_variable( "sms_platform_numbers", "common").split(',') self.data_layer.delete_all_sms() self.url1 = "www.google.com" self.url2 = "www.wikipedia.org" def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.data_layer.connect_to_wifi() # Open the browser app. self.browser.launch() # Open our URL. self.browser.open_url(self.url1) test_msg = "This is a test message sent at {} while connected to a wifi".format( time.time()) self.UTILS.messages.create_incoming_sms(self.num, 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) self.messages.check_last_message_contents(test_msg) 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) 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) 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): test_msg = "Test." def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) self.target_mms_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.contact_1 = MockContact(tel={'type': 'Mobile', 'value': self.target_mms_number}) self.UTILS.reporting.logComment("Using target telephone number " + self.contact_1["tel"]["value"]) self.UTILS.general.insertContact(self.contact_1) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() self.contacts.view_contact(self.contact_1['name']) # Tap the sms button in the view details screen to go to the sms page. sms_button = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button") sms_button.tap() self.apps.switch_to_displayed_app() time.sleep(10) self.wait_for_condition(lambda m: m.find_element(*DOM.Messages.target_numbers).text == self.contact_1['name'], timeout=10, message="To field is already prepulated with our contact info") # Create SMS. self.messages.enterSMSMsg(self.test_msg) self.messages.sendSMS() # Wait for the last message in this thread to be a 'received' one. self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120) self.UTILS.statusbar.click_on_notification_detail(self.test_msg, DOM.Messages.frame_locator) 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) # 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): 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 = "Hello World" def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.gallery = Gallery(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number) self.test_msg = "Test message for test 31727" self.UTILS.general.add_file_to_device('./tests/_resources/300x300.png') def tearDown(self): self.UTILS.general.remove_files() self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() self.messages.startNewSMS() self.messages.addNumbersInToField([self.phone_number]) self.messages.enterSMSMsg(self.test_msg) self.messages.create_mms_image() self.gallery.click_on_thumbnail_at_position_mms(0) self.messages.sendSMS() self.messages.wait_for_message() self.messages.check_last_message_contents(self.test_msg, mms=True) self.messages.verify_mms_received('img', self.phone_number)
class test_main(GaiaTestCase): test_msg = "Test." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Prepare the contact we're going to insert. self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.contact = MockContact(tel={ 'type': '', 'value': self.phone_number }) 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): # Launch contacts app. self.contacts.launch() # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the sms button in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button") smsBTN.tap() time.sleep(2) self.marionette.switch_to_frame() self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) # Create SMS. self.messages.enterSMSMsg(self.test_msg) # Click send. self.messages.sendSMS() 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) # 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)) # Phone Number is shown instead of carrier as the secondary header expect = self.contact["tel"]["value"] actual = self.messages.threadCarrier() self.UTILS.test.test(expect == actual, "The telephone number is: '{}' (subheader was '{}').".\ format(expect, actual))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.loop = Loop(self) self.messages = Messages(self) # Get details of our test contacts. self.contact = MockContact() self.contact['tel']['value'] = self.UTILS.general.get_config_variable("target_call_number", "common") self.UTILS.general.insertContact(self.contact) self.data_layer.connect_to_wifi() result = self.loop.initial_test_checks() if result: self.loop.phone_login() self.loop.allow_permission_phone_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.apps.kill_all() time.sleep(2) _ = setup_translations(self) self.expected_message = _("No problem! Just share the following link and they can call you back from"\ " any browser.") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() self.contacts.view_contact(self.contact['name']) video_btn = self.marionette.find_element(DOM.Contacts.view_contact_hello_option[0], DOM.Contacts.view_contact_hello_option[1].format("video")) video_btn.tap() self.loop.share_micro_and_camera() self.wait_for_element_displayed(*DOM.Loop.not_a_user_explanation, timeout=10) not_a_user_explanation = self.marionette.find_element(*DOM.Loop.not_a_user_explanation) self.UTILS.test.test(not_a_user_explanation.text == self.expected_message, "Message found: {} (Expected: {}".\ format(not_a_user_explanation.text, self.expected_message)) share_options = self.UTILS.element.getElements(DOM.Loop.share_link_options, "Sharing options") self.UTILS.test.test(len(share_options) == 3, "There are {} sharing options (Expected: 3)".\ format(len(share_options))) share_by_sms = self.UTILS.element.getElement(DOM.Loop.share_panel_sms_share, "Share by SMS") share_by_sms.tap() self.UTILS.iframe.switch_to_frame(*DOM.Messages.frame_locator) time.sleep(2) msg_body = self.UTILS.element.getElement(DOM.Messages.input_message_area, "Message body").text send_btn = self.UTILS.element.getElement(DOM.Messages.send_message_button, "Send button") send_btn.tap() self.messages.check_last_message_contents(msg_body) btn = self.UTILS.element.getElement(DOM.Messages.header_close_button, "Close button") btn.tap() self.UTILS.iframe.switch_to_frame(*DOM.Loop.frame_locator) self.UTILS.element.getElement(DOM.Loop.open_settings_btn, "Open settings 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) # Import some contacts. # Set the one we'll match to have a valid phone number. self.contact_1 = MockContact( tel={ "type": "Mobile", "value": self.UTILS.general.get_config_variable("phone_number", "custom") }) self.contact_2 = MockContact() self.contact_3 = MockContact(givenName="AAAAAAAAAAAAAAAALEX", familyName="SMITHXXXXXXXX", name="AAAAAAAAAAAAAAAALEX SMITHXXXXXXXX") self.contact_4 = MockContact(tel=[{ "type": "Mobile 1", "carrier": "MoviStar1", "value": "444444444" }, { "type": "Mobile 2", "carrier": "MoviStar2", "value": "555555555" }, { "type": "Mobile 3", "carrier": "MoviStar3", "value": "666666666" }]) self.contact_5 = MockContact(email=[{ "type": "", "value": "*****@*****.**" }, { "type": "", "value": "*****@*****.**" }, { "type": "", "value": "*****@*****.**" }]) # Set a couple of them to be favorites (including the one we'll use). self.contact_1["category"] = "favorite" self.contact_2["category"] = "favorite" # Insert all the contacts. self.UTILS.general.insertContact(self.contact_1) self.UTILS.general.insertContact(self.contact_2) self.UTILS.general.insertContact(self.contact_3) self.UTILS.general.insertContact(self.contact_4) self.UTILS.general.insertContact(self.contact_5) self.UTILS.reporting.logComment("Using target telephone number " + self.contact_1["tel"]["value"]) self.test_msg = "Test message at {}".format(time.time()) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() # Type a message containing the required string self.messages.startNewSMS() self.messages.enterSMSMsg(self.test_msg) # Search for our contact in the favourites section. self.messages.selectAddContactButton() self.UTILS.reporting.debug("*** Looking for contact named {}".format( self.contact_1['givenName'])) self.UTILS.iframe.switch_to_frame(*DOM.Contacts.frame_locator) cont = self.UTILS.element.getElement( (DOM.Contacts.favourite_by_name[0], DOM.Contacts.favourite_by_name[1].format( self.contact_1['givenName'])), "Favourite contact", timeout=20) cont.tap() self.UTILS.iframe.switch_to_frame(*DOM.Messages.frame_locator) # Now check the correct name is in the 'To' list. self.messages.checkIsInToField(self.contact_1["name"]) self.messages.sendSMS() send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time=send_time) self.messages.check_last_message_contents(self.test_msg)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.loop = Loop(self) self.messages = Messages(self) # Get details of our test contacts. self.contact = MockContact() self.contact['tel']['value'] = self.UTILS.general.get_config_variable( "target_call_number", "common") self.UTILS.general.insertContact(self.contact) self.data_layer.connect_to_wifi() result = self.loop.initial_test_checks() if result: self.loop.phone_login() self.loop.allow_permission_phone_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.apps.kill_all() time.sleep(2) _ = setup_translations(self) self.expected_message = _("No problem! Just share the following link and they can call you back from"\ " any browser.") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() self.contacts.view_contact(self.contact['name']) video_btn = self.marionette.find_element( DOM.Contacts.view_contact_hello_option[0], DOM.Contacts.view_contact_hello_option[1].format("video")) video_btn.tap() self.loop.share_micro_and_camera() self.wait_for_element_displayed(*DOM.Loop.not_a_user_explanation, timeout=10) not_a_user_explanation = self.marionette.find_element( *DOM.Loop.not_a_user_explanation) self.UTILS.test.test(not_a_user_explanation.text == self.expected_message, "Message found: {} (Expected: {}".\ format(not_a_user_explanation.text, self.expected_message)) share_options = self.UTILS.element.getElements( DOM.Loop.share_link_options, "Sharing options") self.UTILS.test.test(len(share_options) == 3, "There are {} sharing options (Expected: 3)".\ format(len(share_options))) share_by_sms = self.UTILS.element.getElement( DOM.Loop.share_panel_sms_share, "Share by SMS") share_by_sms.tap() self.UTILS.iframe.switch_to_frame(*DOM.Messages.frame_locator) time.sleep(2) msg_body = self.UTILS.element.getElement( DOM.Messages.input_message_area, "Message body").text send_btn = self.UTILS.element.getElement( DOM.Messages.send_message_button, "Send button") send_btn.tap() self.messages.check_last_message_contents(msg_body) btn = self.UTILS.element.getElement(DOM.Messages.header_close_button, "Close button") btn.tap() self.UTILS.iframe.switch_to_frame(*DOM.Loop.frame_locator) self.UTILS.element.getElement(DOM.Loop.open_settings_btn, "Open settings 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) # Import some contacts. # Set the one we'll match to have a valid phone number. self.contact_1 = MockContact(tel={"type": "Mobile", "value": self.UTILS.general.get_config_variable("phone_number", "custom")}) self.contact_2 = MockContact() self.contact_3 = MockContact(givenName="AAAAAAAAAAAAAAAALEX", familyName="SMITHXXXXXXXX", name="AAAAAAAAAAAAAAAALEX SMITHXXXXXXXX") self.contact_4 = MockContact(tel=[{"type": "Mobile 1", "carrier": "MoviStar1", "value": "444444444"}, {"type": "Mobile 2", "carrier": "MoviStar2", "value": "555555555"}, {"type": "Mobile 3", "carrier": "MoviStar3", "value": "666666666"}]) self.contact_5 = MockContact(email=[{"type": "", "value": "*****@*****.**"}, {"type": "", "value": "*****@*****.**"}, {"type": "", "value": "*****@*****.**"}]) # Set a couple of them to be favorites (including the one we'll use). self.contact_1["category"] = "favorite" self.contact_2["category"] = "favorite" # Insert all the contacts. self.UTILS.general.insertContact(self.contact_1) self.UTILS.general.insertContact(self.contact_2) self.UTILS.general.insertContact(self.contact_3) self.UTILS.general.insertContact(self.contact_4) self.UTILS.general.insertContact(self.contact_5) self.UTILS.reporting.logComment("Using target telephone number " + self.contact_1["tel"]["value"]) self.test_msg = "Test message at {}".format(time.time()) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() # Type a message containing the required string self.messages.startNewSMS() self.messages.enterSMSMsg(self.test_msg) # Search for our contact in the favourites section. self.messages.selectAddContactButton() self.UTILS.reporting.debug("*** Looking for contact named {}".format(self.contact_1['givenName'])) self.UTILS.iframe.switch_to_frame(*DOM.Contacts.frame_locator) cont = self.UTILS.element.getElement((DOM.Contacts.favourite_by_name[0], DOM.Contacts.favourite_by_name[1].format(self.contact_1['givenName'])), "Favourite contact", timeout=20) cont.tap() self.UTILS.iframe.switch_to_frame(*DOM.Messages.frame_locator) # Now check the correct name is in the 'To' list. self.messages.checkIsInToField(self.contact_1["name"]) self.messages.sendSMS() send_time = self.messages.last_sent_message_timestamp() self.messages.wait_for_message(send_time=send_time) self.messages.check_last_message_contents(self.test_msg)
class test_main(GaiaTestCase): test_msg = "Test." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Prepare the contact we're going to insert. self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.contact = MockContact(tel={'type': '', 'value': self.phone_number}) 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): # Launch contacts app. self.contacts.launch() # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the sms button in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button") smsBTN.tap() time.sleep(2) self.marionette.switch_to_frame() self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) # Create SMS. self.messages.enterSMSMsg(self.test_msg) # Click send. self.messages.sendSMS() 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) # 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)) # Phone Number is shown instead of carrier as the secondary header expect = self.contact["tel"]["value"] actual = self.messages.threadCarrier() self.UTILS.test.test(expect == actual, "The telephone number is: '{}' (subheader was '{}').".\ format(expect, actual))