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.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): 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): 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.messages = Messages(self) self.Dialer = Dialer(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.test_msg = "Test message at {}".format(time.time()) self.contact = MockContact(tel={ 'type': 'Mobile', 'value': self.phone_number }) self.UTILS.general.insertContact(self.contact) self.data_layer.delete_all_sms() self.UTILS.statusbar.clearAllStatusBarNotifs() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Create and send a new test message. self.data_layer.send_sms(self.phone_number, self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail( self.test_msg, timeout=120) self.UTILS.statusbar.click_on_notification_detail( self.test_msg, DOM.Messages.frame_locator) # Tap the header to call. self.messages.header_call() # Dialer is started with the number already filled in. current = self.UTILS.element.getElement( DOM.Dialer.phone_number, "Phone number").get_attribute("value") self.UTILS.test.test( self.phone_number == current, "The phone number contains '{}' (expected '{}').".format( current, self.phone_number)) # Dial the number. 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.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.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.messages = Messages(self) self.Dialer = Dialer(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.test_msg = "Test message at {}".format(time.time()) self.contact = MockContact(tel={'type': 'Mobile', 'value': self.phone_number}) self.UTILS.general.insertContact(self.contact) self.data_layer.delete_all_sms() self.UTILS.statusbar.clearAllStatusBarNotifs() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Create and send a new test message. self.data_layer.send_sms(self.phone_number, self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120) self.UTILS.statusbar.click_on_notification_detail(self.test_msg, DOM.Messages.frame_locator) # Tap the header to call. self.messages.header_call() # Dialer is started with the number already filled in. current = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number").get_attribute("value") self.UTILS.test.test(self.phone_number == current, "The phone number contains '{}' (expected '{}').".format(current, self.phone_number)) # Dial the number. self.Dialer.call_this_number_and_hangup(5)