class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) # Define target phone numbers num_prefix_plus = self.UTILS.general.get_config_variable( "phone_number", "custom") num_prefix_double_zero = num_prefix_plus.replace("+", "00") num_no_prefix = num_prefix_plus.replace("+34", "") self.target_numbers = [ num_prefix_plus, num_prefix_double_zero, num_no_prefix ] 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.messages.launch() for num in self.target_numbers: test_msg = "Hello World at {} for {}".format(time.time(), num) self.messages.create_and_send_mms("image", [num], test_msg) self.messages.wait_for_message() self.messages.closeThread() time.sleep(3) # Check how many elements are there count = self.messages.countNumberOfThreads() self.UTILS.reporting.logResult( "info", "Number of threads {} in list.".format(count)) self.UTILS.test.test( count == 1, "There are {} threads (expected {})".format(count, 1))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) # Define target phone numbers num_prefix_plus = self.UTILS.general.get_config_variable("phone_number", "custom") num_prefix_double_zero = num_prefix_plus.replace("+", "00") num_no_prefix = num_prefix_plus.replace("+34", "") self.target_numbers = [num_prefix_plus, num_prefix_double_zero, num_no_prefix] 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.messages.launch() for num in self.target_numbers: test_msg = "Hello World at {} for {}".format(time.time(), num) self.messages.create_and_send_mms("image", [num], test_msg) self.messages.wait_for_message() self.messages.closeThread() time.sleep(3) # Check how many elements are there count = self.messages.countNumberOfThreads() self.UTILS.reporting.logResult("info", "Number of threads {} in list.".format(count)) self.UTILS.test.test(count == 1, "There are {} threads (expected {})".format(count, 1))
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) self.test_msg = "Hello World" # Establish which phone number to use. num1 = self.UTILS.general.get_config_variable("phone_number", "custom") self.contact1 = MockContact(givenName="Name 1", familyName="Surname 1", name="Name 1 Surname 1", tel={ "type": "Mobile", "value": num1 }) self.UTILS.reporting.logComment("Using target telephone number " + self.contact1["tel"]["value"]) self.UTILS.general.insertContact(self.contact1) num2 = self.UTILS.general.get_config_variable("incoming_call_number", "common") self.contact2 = MockContact(givenName="Name 3", familyName="Surname 3", name="Name 3 Surname 3", tel={ "type": "Mobile", "value": num2 }) self.UTILS.reporting.logComment("Using target telephone number " + self.contact2["tel"]["value"]) self.UTILS.general.insertContact(self.contact2) self.data_layer.delete_all_sms() self.UTILS.statusbar.clearAllStatusBarNotifs() self.test_nums = [ self.contact1["tel"]["value"], self.contact2["tel"]["value"] ] def tearDown(self): self.UTILS.general.remove_files() self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() # Create a new SMS self.messages.startNewSMS() # Insert the phone numbers in the To field for num in self.test_nums: self.messages.addNumbersInToField([num]) # Create MMS. self.messages.enterSMSMsg(self.test_msg) # Add an image file self.UTILS.general.add_file_to_device('./tests/_resources/80x60.jpg') 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() send_time = self.messages.last_sent_message_timestamp() self.messages.closeThread() self.messages.openThread(self.contact1["name"]) self.messages.wait_for_message(send_time=send_time) # Obtaining file attached type img_type = self.UTILS.element.getElement( DOM.Messages.attach_preview_img_type, "preview type") typ = img_type.get_attribute("data-attachment-type") if typ != "img": self.UTILS.test.test(False, "Incorrect file type. The file must be img ") self.messages.closeThread() # Check how many elements are there self.UTILS.reporting.logResult("info", "Check how many threads are there") original_count = self.messages.countNumberOfThreads() self.UTILS.reporting.logResult( "info", "Number of threads {} in list.".format(original_count)) self.UTILS.test.test(original_count == 2, "Check how many threads are there")
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) self.test_msg = "Hello World" # Establish which phone number to use. num1 = self.UTILS.general.get_config_variable("phone_number", "custom") self.contact1 = MockContact(givenName="Name 1", familyName="Surname 1", name="Name 1 Surname 1", tel={"type": "Mobile", "value": num1}) self.UTILS.reporting.logComment("Using target telephone number " + self.contact1["tel"]["value"]) self.UTILS.general.insertContact(self.contact1) num2 = self.UTILS.general.get_config_variable("incoming_call_number", "common") self.contact2 = MockContact(givenName="Name 3", familyName="Surname 3", name="Name 3 Surname 3", tel={"type": "Mobile", "value": num2}) self.UTILS.reporting.logComment("Using target telephone number " + self.contact2["tel"]["value"]) self.UTILS.general.insertContact(self.contact2) self.data_layer.delete_all_sms() self.UTILS.statusbar.clearAllStatusBarNotifs() self.test_nums = [self.contact1["tel"]["value"], self.contact2["tel"]["value"]] def tearDown(self): self.UTILS.general.remove_files() self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() # Create a new SMS self.messages.startNewSMS() # Insert the phone numbers in the To field for num in self.test_nums: self.messages.addNumbersInToField([num]) # Create MMS. self.messages.enterSMSMsg(self.test_msg) # Add an image file self.UTILS.general.add_file_to_device('./tests/_resources/80x60.jpg') 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() send_time = self.messages.last_sent_message_timestamp() self.messages.closeThread() self.messages.openThread(self.contact1["name"]) self.messages.wait_for_message(send_time=send_time) # Obtaining file attached type img_type = self.UTILS.element.getElement(DOM.Messages.attach_preview_img_type, "preview type") typ = img_type.get_attribute("data-attachment-type") if typ != "img": self.UTILS.test.test(False, "Incorrect file type. The file must be img ") self.messages.closeThread() # Check how many elements are there self.UTILS.reporting.logResult("info", "Check how many threads are there") original_count = self.messages.countNumberOfThreads() self.UTILS.reporting.logResult("info", "Number of threads {} in list.".format(original_count)) self.UTILS.test.test(original_count == 2, "Check how many threads are there")