class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.contacts = Contacts(self) self.Contact_1 = MockContact(tel={'type': 'Mobile', 'value': '665666666'}) self.num = self.Contact_1["tel"]["value"] def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Enter a number in the dialer. self.dialer.launch() self.dialer.enterNumber(self.num) self.dialer.call_this_number() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot of call being made:", x) self.dialer.hangUp()
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.dialer = Dialer(self) # Get details of our test contacts. self.test_contact = MockContact() self.UTILS.general.insertContact(self.test_contact) self.contact_name = self.test_contact["givenName"] def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() contacts_option_btn = self.UTILS.element.getElement(DOM.Dialer.option_bar_contacts, "Contacts option") contacts_option_btn.tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.contacts_sub_iframe, via_root_frame=False) self.contacts.view_contact(self.contact_name, header_check=False) phone_field = self.UTILS.element.getElement(DOM.Contacts.view_contact_tel_field, "Telephone number") phone_field.tap() # The call is tested. self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) self.UTILS.element.waitForElements(("xpath", DOM.Dialer.outgoing_call_numberXP.format(self.test_contact["name"])), "Outgoing call found with number matching {}".format(self.test_contact["name"])) self.dialer.hangUp()
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.contacts = Contacts(self) self.Contact_1 = MockContact(tel={ 'type': 'Mobile', 'value': '665666666' }) self.num = self.Contact_1["tel"]["value"] def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Enter a number in the dialer. self.dialer.launch() self.dialer.enterNumber(self.num) self.dialer.call_this_number() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot of call being made:", x) self.dialer.hangUp()
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.dialer = Dialer(self) # Get details of our test contacts. self.test_contact = MockContact(tel={'type': 'Mobile', 'value': '665666666'}) self.UTILS.general.insertContact(self.test_contact) self._name = self.test_contact["name"] self.phone_number = self.test_contact["tel"]["value"] def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber(self.phone_number) self.dialer.call_this_number() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) outgoing_number = self.UTILS.element.getElement(DOM.Dialer.outgoing_call_number, "Outgoing number").text.encode("utf-8") self.UTILS.reporting.logResult('info', 'Outgoing number: {}'.format(outgoing_number)) # We use 'in' since it's possible that the displayed outgoing contact name is ellipsed self.UTILS.test.test(outgoing_number in self._name, "Outgoing call found with name matches '{}'".format(self._name)) time.sleep(2) self.dialer.hangUp()
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.names = ["Aname", "Bname", "Cname"] self.values = ["991234999", "999123499", "999912349"] self.test_contacts = [MockContact(givenName=self.names[i], tel=[{"type": "mobile", "value": self.values[i]}]) for i in range(3)] """ This has to be done due to a MockContact malfunction. It does not update the name field to the specified values of givenName and familyName """ for c in self.test_contacts: c["name"] = c["givenName"] + " " + c["familyName"] map(self.UTILS.general.insertContact, self.test_contacts) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber("1234") suggestion_count_btn = self.UTILS.element.getElement(DOM.Dialer.suggestion_count, "Suggestion count") # We are using this since normal .tap() method does not seem to be working self.UTILS.element.simulateClick(suggestion_count_btn) self.UTILS.element.waitForElements(DOM.Dialer.suggestion_list, 'Suggestion list') items = self.UTILS.element.getElements(DOM.Dialer.suggestion_item_name, "Suggestion items", timeout=10) self.UTILS.test.test(len(items) == 3, "There are 3 contacts listed.") i = 0 for c in self.test_contacts: self.UTILS.test.test(c["name"] in items[i].text, "The contact ({}) in suggestion list contains appears in suggestion list ({})" .format(c["name"], items[i].text)) i += 1 self.UTILS.reporting.logResult("info", "Tapping 1st contact listed ...") items[0].tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) self.UTILS.element.waitForElements(("xpath", DOM.Dialer.outgoing_call_numberXP.format(self.test_contacts[0]["name"])), "Outgoing call found with number matching".format(self.test_contacts[0]["name"])) time.sleep(2) self.dialer.hangUp()
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): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) # # Get own number and incoming # self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.call_number = self.UTILS.general.get_config_variable( "target_call_number", "common") self.incoming_number = self.UTILS.general.get_config_variable( "incoming_call_number", "common") self.UTILS.statusbar.clearAllStatusBarNotifs() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch dialer app. self.dialer.launch() self.dialer.enterNumber(self.call_number) self.dialer.call_this_number_and_hangup(2) time.sleep(2) self.UTILS.messages.create_incoming_sms(self.incoming_number, "Call:" + self.phone_number) self.UTILS.iframe.switch_to_frame(*DOM.Dialer.frame_locator) self.dialer.answer_and_hangup(3) time.sleep(2) self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) time.sleep(2) self.dialer.enterNumber(self.call_number) self.dialer.call_this_number() self.UTILS.messages.create_incoming_sms(self.incoming_number, "Call:" + self.phone_number) self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) self.wait_for_element_displayed('id', 'incoming-answer', timeout=50) answer = self.marionette.find_element('id', 'incoming-answer') if answer: answer.tap() time.sleep(2) self.dialer.hangUp() time.sleep(5) self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) self.dialer.hangUp()
class test_main(GaiaTestCase): test_num = "123456789" test_msg = "Test number " + test_num + " for dialing." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.Dialer = Dialer(self) # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() # Create and send a new test message. self.messages.create_and_send_sms([self.phone_number], self.test_msg) """ Wait for the last message in this thread to be a 'received' one and click the link. """ x = self.messages.wait_for_message() self.UTILS.test.test(x, "Received a message.", True) a = x.find_element("tag name", "a") a.tap() x = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button") x.tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) # Dial the number. self.Dialer.call_this_number() # Wait 2 seconds, then hangup. time.sleep(2) self.Dialer.hangUp() self.data_layer.kill_active_call()
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.contacts = Contacts(self) self.test_contact = MockContact(tel={'type': 'Mobile', 'value': "665666666"}) # Generate an entry in the call log self.dialer.launch() self.dialer.callLog_clearAll() self.dialer.createMultipleCallLogEntries(self.test_contact["tel"]["value"], 1) # Create contact with image self.UTILS.general.add_file_to_device('./tests/_resources/contact_face.jpg') self.dialer.callLog_createContact(self.test_contact["tel"]["value"]) contFields = self.contacts.get_contact_fields() self.contacts.replace_str(contFields['givenName'], self.test_contact["givenName"]) self.contacts.replace_str(contFields['familyName'], self.test_contact["familyName"]) self.contacts.add_gallery_image_to_contact(0) done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button") done_button.tap() time.sleep(1) self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.general.remove_files() self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.open_call_log() entry = self.UTILS.element.getElement(("xpath", DOM.Dialer.call_log_number_xpath.format(self.test_contact["tel"]["value"])), "The call log for number {}".format(self.test_contact["tel"]["value"])) entry.tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) self.UTILS.element.waitForElements(("xpath", DOM.Dialer.outgoing_call_numberXP.format(self.test_contact["name"])), "Outgoing call found with number matching {}".format(self.test_contact["name"])) time.sleep(2) self.dialer.hangUp()
class test_main(GaiaTestCase): test_num = "123456789" test_msg = "Test number " + test_num + " for dialing." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.Dialer = Dialer(self) # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() # Create and send a new test message. self.messages.create_and_send_sms([self.phone_number], self.test_msg) """ Wait for the last message in this thread to be a 'received' one and click the link. """ x = self.messages.wait_for_message() self.UTILS.test.test(x, "Received a message.", True) a = x.find_element("tag name", "a") a.tap() x = self.UTILS.element.getElement(DOM.Messages.header_call_btn, "Call button") x.tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) # Dial the number. self.Dialer.call_this_number() # Wait 2 seconds, then hangup. time.sleep(2) self.Dialer.hangUp() self.data_layer.kill_active_call()
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) # # Get own number and incoming # self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.call_number = self.UTILS.general.get_config_variable("target_call_number", "common") self.incoming_number = self.UTILS.general.get_config_variable("incoming_call_number", "common") self.UTILS.statusbar.clearAllStatusBarNotifs() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch dialer app. self.dialer.launch() self.dialer.enterNumber(self.call_number) self.dialer.call_this_number_and_hangup(2) time.sleep(2) self.UTILS.messages.create_incoming_sms(self.incoming_number, "Call:" + self.phone_number) self.UTILS.iframe.switch_to_frame(*DOM.Dialer.frame_locator) self.dialer.answer_and_hangup(3) time.sleep(2) self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) time.sleep(2) self.dialer.enterNumber(self.call_number) self.dialer.call_this_number() self.UTILS.messages.create_incoming_sms(self.incoming_number, "Call:" + self.phone_number) self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) self.wait_for_element_displayed('id', 'incoming-answer', timeout=50) answer = self.marionette.find_element('id', 'incoming-answer') if answer: answer.tap() time.sleep(2) self.dialer.hangUp() time.sleep(5) self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) self.dialer.hangUp()
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): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.dialer = Dialer(self) # Get details of our test contacts. self.num = self.UTILS.general.get_config_variable("phone_number", "custom") self.Contact_1 = MockContact(tel={'type': 'Mobile', 'value': self.num}) self.UTILS.general.insertContact(self.Contact_1) self.contact_name = self.Contact_1["name"] self.contact_given_name = self.Contact_1["givenName"] self.contact_number = self.Contact_1["tel"]["value"] def tearDown(self): # Delete the contact. (REVISAR) self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch dialer app. self.dialer.launch() # Call self.dialer.enterNumber(self.contact_number) self.dialer.call_this_number() time.sleep(2) # Hang Up self.dialer.hangUp() x = self.UTILS.element.getElement(DOM.Dialer.option_bar_keypad, "Keypad Option") x.tap() x = self.UTILS.element.getElement(DOM.Dialer.call_number_button, "Call button") x.tap() # Make sure that after tapping, we get the last outgoing call in the call log x = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field", False) dialer_num = x.get_attribute("value") self.UTILS.test.test(True, "Dialer_num: {}".format(dialer_num))
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.dialer = Dialer(self) # Get details of our test contacts. self.test_contact = MockContact() self.UTILS.general.insertContact(self.test_contact) self.contact_name = self.test_contact["givenName"] def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() contacts_option_btn = self.UTILS.element.getElement( DOM.Dialer.option_bar_contacts, "Contacts option") contacts_option_btn.tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.contacts_sub_iframe, via_root_frame=False) self.contacts.view_contact(self.contact_name, header_check=False) phone_field = self.UTILS.element.getElement( DOM.Contacts.view_contact_tel_field, "Telephone number") phone_field.tap() # The call is tested. self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) self.UTILS.element.waitForElements( ("xpath", DOM.Dialer.outgoing_call_numberXP.format( self.test_contact["name"])), "Outgoing call found with number matching {}".format( self.test_contact["name"])) self.dialer.hangUp()
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.phone_number = self.UTILS.general.get_config_variable("target_call_number", "common") self.dialer.launch() self.dialer.callLog_clearAll() self.dialer.createMultipleCallLogEntries(self.phone_number, 1) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Open the call log and tap on the phone_number. self.dialer.open_call_log() self.dialer.callLog_call(self.phone_number) time.sleep(3) self.dialer.hangUp()
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.contacts = Contacts(self) self.test_contact = MockContact(tel={ 'type': 'Mobile', 'value': "665666666" }) # Generate an entry in the call log self.dialer.launch() self.dialer.callLog_clearAll() self.dialer.createMultipleCallLogEntries( self.test_contact["tel"]["value"], 1) # Create contact with image self.UTILS.general.add_file_to_device( './tests/_resources/contact_face.jpg') self.dialer.callLog_createContact(self.test_contact["tel"]["value"]) contFields = self.contacts.get_contact_fields() self.contacts.replace_str(contFields['givenName'], self.test_contact["givenName"]) self.contacts.replace_str(contFields['familyName'], self.test_contact["familyName"]) self.contacts.add_gallery_image_to_contact(0) done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button") done_button.tap() time.sleep(1) self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.general.remove_files() self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.open_call_log() entry = self.UTILS.element.getElement( ("xpath", DOM.Dialer.call_log_number_xpath.format( self.test_contact["tel"]["value"])), "The call log for number {}".format( self.test_contact["tel"]["value"])) entry.tap() self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling) self.UTILS.element.waitForElements( ("xpath", DOM.Dialer.outgoing_call_numberXP.format( self.test_contact["name"])), "Outgoing call found with number matching {}".format( self.test_contact["name"])) time.sleep(2) self.dialer.hangUp()