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.num = self.UTILS.general.get_config_variable("phone_number", "custom") 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) # Press the add to contacts button, then select 'add to existing contact'. x = self.UTILS.element.getElement(DOM.Dialer.add_to_contacts_button, "Add to contacts button") x.tap() x = self.UTILS.element.getElement(DOM.Dialer.add_to_existing_contact_btn, "Add to existing contact button") x.tap() # You should now see the error message. self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) self.UTILS.element.waitForElements( ("xpath", "//*[contains(text(), 'Cannot add to contact')]"), "Warning that there are no contacts.", True, 5, False) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screen shot of current position:", x)
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.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") # Remove the phone number from the contact and insert it. self.test_contact = MockContact(tel={'type': '', 'value': ''}) self.UTILS.general.insertContact(self.test_contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Add a number and add it to an existing contact. self.dialer.launch() self.dialer.enterNumber(self.phone_number) self.dialer.addThisNumberToContact(self.test_contact["name"]) self.UTILS.test.test(self.apps.displayed_app.name == self.dialer.app_name, "After adding number to contact we are taken back to Dialer") # Verify that this contact has been modified in contacts. self.apps.kill_all() self.contacts.launch() self.contacts.view_contact(self.test_contact["name"]) contact_phone_number = self.UTILS.element.getElement(DOM.Contacts.view_contact_tel_field, "Contact telephone number") self.UTILS.test.test(self.phone_number in contact_phone_number.text, "Contact correctly updated with new phone number")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.cont1 = MockContact(tel=[{ "type": "Mobile", "value": "111111111" }]) self.UTILS.general.insertContact(self.cont1) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber("123") time.sleep(1) self.UTILS.element.waitForNotElements(DOM.Dialer.suggestion_count, "Suggestion count") self.UTILS.element.waitForNotElements(DOM.Dialer.suggestion_item, "Suggestion item") self.dialer.enterNumber("4") time.sleep(1) self.UTILS.element.waitForNotElements(DOM.Dialer.suggestion_count, "Suggestion count") self.UTILS.element.waitForNotElements(DOM.Dialer.suggestion_item, "Suggestion item")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.cont1 = MockContact(tel=[{ "type": "Mobile", "value": "111111111" }]) self.UTILS.general.insertContact(self.cont1) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber("1111") x = self.UTILS.element.getElement(DOM.Dialer.suggestion_item_single, "Suggestion item") self.UTILS.test.test( self.cont1["tel"][0]["value"] in x.text, "'{}' is shown as a suggestion (it was '{}').".format( self.cont1["tel"][0]["value"], x.text)) self.dialer.enterNumber("2") self.UTILS.element.waitForNotElements( DOM.Dialer.suggestion_item_single, "Suggestion item")
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) _ = setup_translations(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.test_contact = MockContact() self.UTILS.general.insertContact(self.test_contact) # Generate an entry in the call log 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 add to our contact, cancelling the process self.dialer.callLog_addToContact(self.phone_number, self.test_contact["name"], cancel_process=True) # Check we're back in the call log. self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) call_info_header = self.UTILS.element.getElement( DOM.Dialer.call_info_title, "Call info header") self.UTILS.test.test(call_info_header.text == self.phone_number, "We are back to call info screen")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.cont1 = MockContact(tel=[{"type": "Mobile", "value": "111111111"}]) self.UTILS.general.insertContact(self.cont1) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber("123") time.sleep(1) self.UTILS.element.waitForNotElements(DOM.Dialer.suggestion_count, "Suggestion count") self.UTILS.element.waitForNotElements(DOM.Dialer.suggestion_item, "Suggestion item") self.dialer.enterNumber("4") time.sleep(1) self.UTILS.element.waitForNotElements(DOM.Dialer.suggestion_count, "Suggestion count") self.UTILS.element.waitForNotElements(DOM.Dialer.suggestion_item, "Suggestion item")
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.test_number = "123456789" def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber(self.test_number) add_to_contacts_button = self.UTILS.element.getElement( DOM.Dialer.add_to_contacts_button, "Add to contacts button") add_to_contacts_button.tap() cancel_button = self.UTILS.element.getElement(DOM.Dialer.cancel_action, "Cancel button") cancel_button.tap() phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field", False) dialer_num = phone_field.get_attribute("value") self.UTILS.test.test(str(self.test_number) in dialer_num, "After cancelling, phone number field still contains '%s' (it was %s)." % \ (self.test_number,dialer_num))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.test_number = "123456789" def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber(self.test_number) add_to_contacts_button = self.UTILS.element.getElement(DOM.Dialer.add_to_contacts_button, "Add to contacts button") add_to_contacts_button.tap() cancel_button = self.UTILS.element.getElement(DOM.Dialer.cancel_action, "Cancel button") cancel_button.tap() phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field", False) dialer_num = phone_field.get_attribute("value") self.UTILS.test.test(str(self.test_number) in dialer_num, "After cancelling, phone number field still contains '%s' (it was %s)." % \ (self.test_number,dialer_num))
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.given_name = "John" self.family_name = "Doe" def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber("123456789") self.dialer.createContactFromThisNum() contFields = self.contacts.get_contact_fields() self.contacts.replace_str(contFields['givenName'], self.given_name) self.contacts.replace_str(contFields['familyName'], self.family_name) done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "Done button") done_button.tap() time.sleep(2) self.UTILS.reporting.logResult('info', "displayed_app: {}".format(self.apps.displayed_app.name)) self.UTILS.test.test(self.apps.displayed_app.name == "Phone", "The dialer app is now displayed.")
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) _ = setup_translations(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.test_contact = MockContact() self.UTILS.general.insertContact(self.test_contact) # Generate an entry in the call log 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 add to our contact, cancelling the process self.dialer.callLog_addToContact(self.phone_number, self.test_contact["name"], cancel_process=True) # Check we're back in the call log. self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) call_info_header = self.UTILS.element.getElement(DOM.Dialer.call_info_title, "Call info header") self.UTILS.test.test(call_info_header.text == self.phone_number, "We are back to call info screen")
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.prefixes = ["0034", "+34"] self.test_numbers = [ prefix + self.phone_number for prefix in self.prefixes ] def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def _do_the_call(self, number): self.dialer.enterNumber(number) self.dialer.call_this_number_and_hangup(5) def test_run(self): # Launch dialer app. self.dialer.launch() map(self._do_the_call, self.test_numbers)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.createMultipleCallLogEntries( self.UTILS.general.get_config_variable("phone_number", "custom"), 3) screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot of multiple entries:", screenshot) self.dialer.callLog_clearSome([1, 2]) time.sleep(5) screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot of some entries removed:", screenshot)
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) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Enter a number in the dialer. self.dialer.launch() x = self.UTILS.element.getElement(DOM.Dialer.option_bar_keypad, "Keypad option") x.tap() self.UTILS.element.waitForElements(DOM.Dialer.keypad, "Keypad") x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot of keypad:", x)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.createMultipleCallLogEntries(self.UTILS.general.get_config_variable("phone_number", "custom"), 3) screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot of multiple entries:", screenshot) self.dialer.callLog_clearSome([1, 2]) time.sleep(5) screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot of some entries removed:", screenshot)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.cont1 = MockContact(tel=[{"type": "Mobile", "value": "111111111"}]) self.UTILS.general.insertContact(self.cont1) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber("1111") x = self.UTILS.element.getElement(DOM.Dialer.suggestion_item_single, "Suggestion item") self.UTILS.test.test(self.cont1["tel"][0]["value"] in x.text, "'{}' is shown as a suggestion (it was '{}').".format(self.cont1["tel"][0]["value"], x.text)) self.dialer.enterNumber("2") self.UTILS.element.waitForNotElements(DOM.Dialer.suggestion_item_single, "Suggestion item")
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.dialer = Dialer(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.phone_number2 = self.UTILS.general.get_config_variable("short_phone_number", "custom") self.test_contact = MockContact(tel={'type': 'Mobile', 'value': self.phone_number2}) self.UTILS.general.insertContact(self.test_contact) # Generate an entry in the call log 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 add to our contact. self.dialer.callLog_addToContact(self.phone_number, self.test_contact["name"]) # Verify that this contact has been modified in contacts. self.contacts.launch() self.contacts.view_contact(self.test_contact["name"]) self.UTILS.element.waitForElements(("xpath", DOM.Contacts.view_contact_tels_xpath.format(self.phone_number)), "Telephone number {} in contact".format(self.phone_number))
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.prefixes = ["0034", "+34"] self.test_numbers = [prefix + self.phone_number for prefix in self.prefixes] def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def _do_the_call(self, number): self.dialer.enterNumber(number) self.dialer.call_this_number_and_hangup(5) def test_run(self): # Launch dialer app. self.dialer.launch() map(self._do_the_call, self.test_numbers)
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.element.getElement(DOM.Dialer.hangup_bar_locator, "Hangup button") x.tap() self.marionette.switch_to_frame() x = DOM.Dialer.frame_locator_calling self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@%s,'%s')]" % (x[0],x[1])), "Calling iframe", True, 5)
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): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.contacts = Contacts(self) self.test_contacts = [MockContact() for i in range(3)] self.test_contacts[0]["tel"]["value"] = "+34111111111" map(self.data_layer.insert_contact, self.test_contacts) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber("1111") suggestion_item = self.UTILS.element.getElement( DOM.Dialer.suggestion_item_single, "Suggestion item") self.UTILS.test.test( self.test_contacts[0]["tel"]["value"] in suggestion_item.text, "'{}' is shown as a suggestion".format( self.test_contacts[0]["tel"]["value"]))
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() self.num = self.UTILS.general.get_config_variable( "phone_number", "custom") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Enter a number in the dialer. self.dialer.launch() self.dialer.enterNumber(self.num) # Press the add to contacts button, then select 'add to existing contact'. x = self.UTILS.element.getElement(DOM.Dialer.add_to_contacts_button, "Add to contacts button") x.tap() x = self.UTILS.element.getElement(DOM.Dialer.create_new_contact_btn, "Create new contact button") x.tap() # Enter the details of the new contact. self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) contFields = self.contacts.get_contact_fields() self.contacts.replace_str(contFields['givenName'], self.Contact_1["givenName"]) self.contacts.replace_str(contFields['familyName'], self.Contact_1["familyName"]) done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button") done_button.tap() # Verify that the contacts app is closed and we are returned to the call log. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@{}, '{}')]".\ format(DOM.Contacts.frame_locator[0], DOM.Contacts.frame_locator[1])), "Contacts frame") self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) # Verify that this contact has been created in contacts. self.apps.kill_all() self.contacts.launch() self.contacts.view_contact(self.Contact_1["name"]) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Final screenshot and html dump:", x)
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): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) _ = setup_translations(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") # Fill the call log with some entries self.dialer.launch() self.dialer.createMultipleCallLogEntries(self.phone_number, 1) self.data_layer.set_setting("airplaneMode.enabled", True) self.wait_for_condition( lambda m: self.data_layer.get_setting("airplaneMode.enabled"), timeout=30, message="No airplane mode enabled") def tearDown(self): self.data_layer.set_setting("airplaneMode.enabled", False) self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.open_call_log() elem = ("xpath", DOM.Dialer.call_log_number_xpath.format(self.phone_number)) entry = self.UTILS.element.getElement( elem, "The call log for number {}".format(self.phone_number)) entry.tap() warning_header = (DOM.GLOBAL.confirmation_msg_header[0], DOM.GLOBAL.confirmation_msg_header[1].format( _("Airplane mode activated"))) _content = _( "To make a call you need to disable airplane mode in settings.") warning_content = ( DOM.GLOBAL.confirmation_msg_content[0], DOM.GLOBAL.confirmation_msg_content[1].format(_content)) self.UTILS.element.getElement(warning_header, "Airplane mode warning [header]") self.UTILS.element.getElement(warning_content, "Airplane mode warning [content]") ok_btn = self.UTILS.element.getElement( DOM.GLOBAL.confirmation_msg_ok_btn, "OK button") ok_btn.tap() self.UTILS.element.waitForElements(DOM.Dialer.call_log_filter, "Call log filter")
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) num = self.UTILS.general.get_config_variable("phone_number", "custom") self.test_contact = MockContact(tel={'type': 'Mobile', 'value': num}) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.callLog_clearAll() self.dialer.createMultipleCallLogEntries( self.test_contact["tel"]["value"], 1) self.dialer.open_call_log() _number_el = DOM.Dialer.call_log_number_xpath.format( self.test_contact["tel"]["value"]) elem = ('xpath', _number_el) self.UTILS.element.waitForElements( elem, "The number {} in the call log".format( self.test_contact["tel"]["value"])) self.UTILS.element.waitForNotElements( ("xpath", "{}//*[text()='{}']".format(_number_el, self.test_contact["name"])), "The name {} in the call log".format(self.test_contact["name"])) screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult( "info", "Call log <i>before</i> adding contact details for this number:", screenshot) self.contacts.launch() self.contacts.create_contact(self.test_contact) self.dialer.launch() self.dialer.open_call_log() self.UTILS.element.waitForElements( ("xpath", DOM.Dialer.call_log_name_xpath.format(self.test_contact["name"])), "The name {} in the call log".format(self.test_contact["name"])) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult( "info", "Call log <i>after</i> adding contact details for this number:", x)
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) _ = setup_translations(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.test_contact = MockContact() 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): self.dialer.callLog_createContact(self.phone_number) 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"]) done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button") done_button.tap() # Verify that the contacts app is closed and we are returned to the call log. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements( ("xpath", "//iframe[contains(@{}, '{}')]".format( DOM.Contacts.frame_locator[0], DOM.Contacts.frame_locator[1])), "Contacts frame") self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) header = ('xpath', DOM.GLOBAL.app_head_specific.format(_("Call log"))) self.UTILS.element.waitForElements(header, "Call log header") # Verify that the call log now shows the contact name, x = self.UTILS.element.getElement( ("xpath", DOM.Dialer.call_log_number_xpath.format( self.phone_number)), "The call log for phone_number {}".format(self.phone_number)) self.UTILS.test.test( self.test_contact["name"] in x.text, "Call log now shows '{}'.".format(self.test_contact["name"]))
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() self.num = self.UTILS.general.get_config_variable("phone_number", "custom") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Enter a number in the dialer. self.dialer.launch() self.dialer.enterNumber(self.num) # Press the add to contacts button, then select 'add to existing contact'. x = self.UTILS.element.getElement(DOM.Dialer.add_to_contacts_button, "Add to contacts button") x.tap() x = self.UTILS.element.getElement(DOM.Dialer.create_new_contact_btn, "Create new contact button") x.tap() # Enter the details of the new contact. self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) contFields = self.contacts.get_contact_fields() self.contacts.replace_str(contFields['givenName'], self.Contact_1["givenName"]) self.contacts.replace_str(contFields['familyName'], self.Contact_1["familyName"]) done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button") done_button.tap() # Verify that the contacts app is closed and we are returned to the call log. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@{}, '{}')]".\ format(DOM.Contacts.frame_locator[0], DOM.Contacts.frame_locator[1])), "Contacts frame") self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) # Verify that this contact has been created in contacts. self.apps.kill_all() self.contacts.launch() self.contacts.view_contact(self.Contact_1["name"]) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Final screenshot and html dump:", x)
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): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.test_num = ["666666666666", "555555555555"] self.test_contacts = [MockContact(tel={'type': 'Mobile', 'value': self.test_num[i]}) for i in range(2)] self.test_contacts[0]["givenName"] = "LongGivennamexxxxxxxxxxx" self.test_contacts[1]["familyName"] = "LongFamilynamexxxxxxxxxxx" """ 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) self.dialer.launch() self.dialer.callLog_clearAll() for contact in self.test_contacts: self.dialer.createMultipleCallLogEntries(contact["tel"]["value"], 2) self.dialer.open_call_log() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): entries = self.UTILS.element.getElements(DOM.Dialer.call_log_numbers, "Call log entries", False) self.UTILS.reporting.logResult("info", "{} entries found.".format(len(entries))) for entry in entries: item = entry.find_element("xpath", "//span[@class='primary-info-main']") value = self.UTILS.element.get_css_value(item, "text-overflow") isEllipsis = self.UTILS.element.is_ellipsis_active(item) self.UTILS.reporting.logResult("info", "Value of css property: {}".format(value)) self.UTILS.reporting.logResult("info", "isEllipsisActive? {}".format(isEllipsis)) self.UTILS.test.test( value == "ellipsis" and isEllipsis, "Long entry in call log displays the ellipsis (...)")
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): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.test_contact = MockContact(tel={ 'type': 'Mobile', 'value': self.phone_number }) self.UTILS.general.insertContact(self.test_contact) # Generate an entry in the call log 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): self.dialer.open_call_log() self.dialer.callLog_long_tap(self.test_contact["tel"]["value"]) call_info = self.UTILS.element.getElement( DOM.Dialer.call_log_numtap_call_info, "Call information button") call_info.tap() call_info_header = self.UTILS.element.getElement( DOM.Dialer.call_info_title, "Call info title") self.UTILS.test.test( call_info_header.text == self.test_contact['name'], 'Header title matches with contact') go_to_contact_details_button = self.UTILS.element.getElement( DOM.Dialer.call_info_contact_go_to_contact_details, "Go to contact detail") self.UTILS.element.waitForElements(("xpath", "//button[contains(@class,'remark') and @data-tel='{}']".\ format(self.test_contact["tel"]["value"])), "Highlighted number") screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Final screenshot:", screenshot)
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.dialer = Dialer(self) # Get own number and incoming self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.UTILS.reporting.logComment("Calling to " + self.phone_number) self.incoming_number = self.UTILS.general.get_config_variable( "incoming_call_number", "common") # Generate the incoming call self.marionette.switch_to_frame() self.data_layer.send_sms(self.incoming_number, "Call:" + self.phone_number) self.dialer.wait_for_incoming_call( self.incoming_number.split("+34")[-1]) self.dialer.answer_and_hangup(2) self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() keypad_option = self.UTILS.element.getElement( DOM.Dialer.option_bar_keypad, "Keypad Option") keypad_option.tap() call_button = self.UTILS.element.getElement( DOM.Dialer.call_number_button, "Call button") call_button.tap() # Make sure that after tapping, we get the last outgoing call in the call log phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field", False) dialer_num = phone_field.get_attribute("value") self.UTILS.test.test(dialer_num == "", "Nothing in the input area")
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.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.test_contact = MockContact(tel={ 'type': 'Mobile', 'value': self.phone_number }) self.UTILS.general.insertContact(self.test_contact) # Generate an entry in the call log for this contact self.dialer.launch() self.dialer.callLog_clearAll() self.dialer.createMultipleCallLogEntries(self.phone_number, 2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): kepad_option = self.UTILS.element.getElement( DOM.Dialer.option_bar_keypad, "Keypad Option") kepad_option.tap() call_btn = self.UTILS.element.getElement(DOM.Dialer.call_number_button, "Call button") call_btn.tap() # Make sure that after tapping, we get the last outgoing call in the call log phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field", False) dialer_num = phone_field.get_attribute("value") self.UTILS.test.test( self.test_contact["tel"]["value"] in dialer_num, "After calling '{}', and tapping call button, phone number field contains '{}'." .format(self.test_contact["tel"]["value"], dialer_num)) y = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult( "info", "Screen shot of the result of tapping call button", y)
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): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.contacts = Contacts(self) _ = setup_translations(self) self.contact_1 = MockContact() self.phone_number = "0034" + self.UTILS.general.get_config_variable("target_call_number", "common") # Generate an entry in the call log 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 create a contact for our number. self.dialer.callLog_createContact(self.phone_number) contFields = self.contacts.get_contact_fields() self.contacts.replace_str(contFields['givenName'], self.contact_1["givenName"]) self.contacts.replace_str(contFields['familyName'], self.contact_1["familyName"]) done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button") done_button.tap() # Verify that the contacts app is closed and we are returned to the call log. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@{}, '{}')]". format(DOM.Contacts.frame_locator[0], DOM.Contacts.frame_locator[1])), "Contacts frame") self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) header = ('xpath', DOM.GLOBAL.app_head_specific.format(_("Call log"))) self.UTILS.element.waitForElements(header, "Call log header") # Verify that this contact has been created in contacts. self.apps.kill_all() self.contacts.launch() self.contacts.view_contact(self.contact_1["name"])
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) _ = setup_translations(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.test_contact = MockContact() 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): self.dialer.callLog_createContact(self.phone_number) 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"]) done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button") done_button.tap() # Verify that the contacts app is closed and we are returned to the call log. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@{}, '{}')]". format(DOM.Contacts.frame_locator[0], DOM.Contacts.frame_locator[1])), "Contacts frame") self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) header = ('xpath', DOM.GLOBAL.app_head_specific.format(_("Call log"))) self.UTILS.element.waitForElements(header, "Call log header") # Verify that the call log now shows the contact name, x = self.UTILS.element.getElement(("xpath", DOM.Dialer.call_log_number_xpath.format(self.phone_number)), "The call log for phone_number {}".format(self.phone_number)) self.UTILS.test.test(self.test_contact["name"] in x.text, "Call log now shows '{}'.". format(self.test_contact["name"]))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.dialer = Dialer(self) self.test_contacts = [MockContact() for i in range(3)] self.test_numbers = [self.test_contacts[i]["tel"]["value"] for i in range(len(self.test_contacts))] def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def _do_the_call(self, number): self.dialer.enterNumber(number, validate=False) self.dialer.call_this_number_and_hangup(5) def test_run(self): self.dialer.launch() # Delete all call log self.dialer.callLog_clearAll() # Call each number map(self._do_the_call, self.test_numbers) self.dialer.callLog_clearAll() # Go back to dialer keypad keypad_options = self.UTILS.element.getElement(DOM.Dialer.option_bar_keypad, "Keypad Option") keypad_options.tap() # Tap call button call_button = self.UTILS.element.getElement(DOM.Dialer.call_number_button, "Call button") call_button.tap() # Assert that nothing is presented in the input area phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field") dialer_num = phone_field.get_attribute("value") self.assertEqual(dialer_num, "", "Nothing in the input area") screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screen shot of the result of tapping call button", screenshot)
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( "phone_number", "custom") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.createMultipleCallLogEntries(self.phone_number, 4) self.dialer.callLog_clearAll()
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): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.dialer = Dialer(self) self.test_contacts = [MockContact() for i in range(3)] self.test_numbers = [ self.test_contacts[i]["tel"]["value"] for i in range(len(self.test_contacts)) ] def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() # Delete all call log self.dialer.callLog_clearAll() # Call each number map(self._do_the_call, self.test_numbers) # Tapping call button call_button = self.UTILS.element.getElement( DOM.Dialer.call_number_button, "Call button") call_button.tap() # Make sure that after tapping, we get the last outgoing call in the call log dialed_num = self.marionette.execute_script( "return window.wrappedJSObject.KeypadManager._phoneNumber") self.UTILS.reporting.logResult(u'info', "Dialer num: {}".format(dialed_num)) self.UTILS.test.test( str(self.test_contacts[-1]["tel"]["value"]) == dialed_num, "After calling several contacts, if we press 'Call' button, we get the last one's phone_number" ) def _do_the_call(self, number): self.dialer.enterNumber(number, validate=False) self.dialer.call_this_number_and_hangup(5)
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("phone_number", "custom") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.createMultipleCallLogEntries(self.phone_number, 4) self.dialer.callLog_clearAll()
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) num = self.UTILS.general.get_config_variable("phone_number", "custom") self.test_contact = MockContact(tel={'type': 'Mobile', 'value': num}) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.callLog_clearAll() self.dialer.createMultipleCallLogEntries(self.test_contact["tel"]["value"], 1) self.dialer.open_call_log() _number_el = DOM.Dialer.call_log_number_xpath.format(self.test_contact["tel"]["value"]) elem = ('xpath', _number_el) self.UTILS.element.waitForElements(elem, "The number {} in the call log".format(self.test_contact["tel"]["value"])) self.UTILS.element.waitForNotElements(("xpath", "{}//*[text()='{}']". format(_number_el, self.test_contact["name"])), "The name {} in the call log".format(self.test_contact["name"])) screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult( "info", "Call log <i>before</i> adding contact details for this number:", screenshot) self.contacts.launch() self.contacts.create_contact(self.test_contact) self.dialer.launch() self.dialer.open_call_log() self.UTILS.element.waitForElements(("xpath", DOM.Dialer.call_log_name_xpath.format(self.test_contact["name"])), "The name {} in the call log".format(self.test_contact["name"])) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Call log <i>after</i> adding contact details for this number:", x)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) _ = setup_translations(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") def tearDown(self): self.data_layer.set_setting("airplaneMode.enabled", False) self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.data_layer.set_setting("airplaneMode.enabled", True) self.wait_for_condition( lambda m: self.data_layer.get_setting("airplaneMode.enabled"), timeout=30, message="No airplane mode enabled") self.dialer.launch() self.dialer.enterNumber(self.phone_number) call_button = self.UTILS.element.getElement( DOM.Dialer.call_number_button, "Call number button") call_button.tap() warning_header = (DOM.GLOBAL.confirmation_msg_header[0], DOM.GLOBAL.confirmation_msg_header[1].format( _("Airplane mode activated"))) self.UTILS.element.getElement(warning_header, "Airplane mode warning [header]") ok_btn = self.UTILS.element.getElement( DOM.GLOBAL.confirmation_msg_ok_btn, "OK button") ok_btn.tap() phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field", False) dialer_number = phone_field.get_attribute("value") self.UTILS.test.test( str(self.phone_number) in dialer_number, "After cancelling, phone number field still contains '{}'".format( self.phone_number))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) _ = setup_translations(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") # Fill the call log with some entries self.dialer.launch() self.dialer.createMultipleCallLogEntries(self.phone_number, 1) self.data_layer.set_setting("airplaneMode.enabled", True) self.wait_for_condition(lambda m: self.data_layer.get_setting("airplaneMode.enabled"), timeout=30, message="No airplane mode enabled") def tearDown(self): self.data_layer.set_setting("airplaneMode.enabled", False) self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.open_call_log() elem = ("xpath", DOM.Dialer.call_log_number_xpath.format(self.phone_number)) entry = self.UTILS.element.getElement(elem, "The call log for number {}".format(self.phone_number)) entry.tap() warning_header = (DOM.GLOBAL.confirmation_msg_header[0], DOM.GLOBAL.confirmation_msg_header[1].format(_("Airplane mode activated"))) _content = _("To make a call you need to disable airplane mode in settings.") warning_content = (DOM.GLOBAL.confirmation_msg_content[0], DOM.GLOBAL.confirmation_msg_content[1].format(_content)) self.UTILS.element.getElement(warning_header, "Airplane mode warning [header]") self.UTILS.element.getElement(warning_content, "Airplane mode warning [content]") ok_btn = self.UTILS.element.getElement(DOM.GLOBAL.confirmation_msg_ok_btn, "OK button") ok_btn.tap() self.UTILS.element.waitForElements(DOM.Dialer.call_log_filter, "Call log filter")
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.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") # Create a call log entry self.dialer.launch() self.dialer.callLog_clearAll() self.dialer.createMultipleCallLogEntries(self.phone_number, 2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Open the call log and select Add to Contact. self.dialer.open_call_log() edit_btn = self.UTILS.element.getElement(DOM.Dialer.call_log_edit_btn, "Edit button") edit_btn.tap() # Now tap the number and verify that we're not taken to the menu, entry = self.UTILS.element.getElement( ("xpath", DOM.Dialer.call_log_number_xpath.format( self.phone_number)), "The call log for number {}".format(self.phone_number)) entry.tap() self.UTILS.reporting.logResult( "info", "Checking that the call to [{}] is not set up".format( self.phone_number)) self.apps.switch_to_displayed_app() self.UTILS.element.waitForNotElements(DOM.Dialer.hangup_bar_locator, "Not calling in edit mode", timeout=10)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber("123456789") self.dialer.createContactFromThisNum()
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.dialer = Dialer(self) # Get own number and incoming self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.UTILS.reporting.logComment("Calling to " + self.phone_number) self.incoming_number = self.UTILS.general.get_config_variable("incoming_call_number", "common") # Generate the incoming call self.marionette.switch_to_frame() self.data_layer.send_sms(self.incoming_number, "Call:" + self.phone_number) self.dialer.wait_for_incoming_call(self.incoming_number.split("+34")[-1]) self.dialer.answer_and_hangup(2) self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() keypad_option = self.UTILS.element.getElement(DOM.Dialer.option_bar_keypad, "Keypad Option") keypad_option.tap() call_button = self.UTILS.element.getElement(DOM.Dialer.call_number_button, "Call button") call_button.tap() # Make sure that after tapping, we get the last outgoing call in the call log phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field", False) dialer_num = phone_field.get_attribute("value") self.UTILS.test.test(dialer_num == "", "Nothing in the input area")
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) _ = setup_translations(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.test_contact = MockContact() self.UTILS.general.insertContact(self.test_contact) 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): self.dialer.callLog_addToContact(self.phone_number, self.test_contact["name"]) self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) # Re-open the call log and Verify that it now shows the contact name, self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@{}, '{}')]". format(DOM.Contacts.frame_locator[0], DOM.Contacts.frame_locator[1])), "Contacts frame") self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator) header = ('xpath', DOM.GLOBAL.app_head_specific.format(_("Call log"))) self.UTILS.element.waitForElements(header, "Call log header") x = self.UTILS.element.getElement(("xpath", DOM.Dialer.call_log_number_xpath.format(self.phone_number)), "The call log for number {}".format(self.phone_number)) self.UTILS.test.test( self.test_contact["name"] in x.text, "Call log now shows '{}'".format(self.test_contact["name"]))
class test_main(GaiaTestCase): _testNum = "123456789" def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.dialer = Dialer(self) self.contacts = Contacts(self) self.test_contact = MockContact(tel={'type': 'Mobile', 'value': '111111111'}) self.UTILS.general.insertContact(self.test_contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.dialer.launch() self.dialer.enterNumber(self._testNum) # Press the add to contacts button, then select 'add to existing contact'. x = self.UTILS.element.getElement(DOM.Dialer.add_to_contacts_button, "Add to contacts button") x.tap() x = self.UTILS.element.getElement(DOM.Dialer.add_to_existing_contact_btn, "Add to existing contact button") x.tap() self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) self.contacts.view_contact(self.test_contact["givenName"], header_check=False) x = self.UTILS.element.getElement(("name", "tel[0][value]"), "Phone number 1") self.UTILS.test.test(x.get_attribute("value") == self.test_contact["tel"]["value"], "1st number is {} (it was {}).".format(self.test_contact["tel"]["value"], x.get_attribute("value"))) x = self.UTILS.element.getElement(("name", "tel[1][value]"), "Phone number 2") self.UTILS.test.test(x.get_attribute("value") == self._testNum, "2nd number is {} (it was {}).".format(self._testNum, x.get_attribute("value"))) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Final screenshot:", x)
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.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.test_contact = MockContact(tel={'type': 'Mobile', 'value': self.phone_number}) self.UTILS.general.insertContact(self.test_contact) # Generate an entry in the call log for this contact self.dialer.launch() self.dialer.callLog_clearAll() self.dialer.createMultipleCallLogEntries(self.phone_number, 2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): kepad_option = self.UTILS.element.getElement(DOM.Dialer.option_bar_keypad, "Keypad Option") kepad_option.tap() call_btn = self.UTILS.element.getElement(DOM.Dialer.call_number_button, "Call button") call_btn.tap() # Make sure that after tapping, we get the last outgoing call in the call log phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field", False) dialer_num = phone_field.get_attribute("value") self.UTILS.test.test(self.test_contact["tel"]["value"] in dialer_num, "After calling '{}', and tapping call button, phone number field contains '{}'.". format(self.test_contact["tel"]["value"], dialer_num)) y = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screen shot of the result of tapping call button", y)