def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.contacts = Contacts(self) self.settings = Settings(self) self.fxa_user = self.UTILS.general.get_config_variable( "fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable( "fxa_pass", "common") self.target_name = "QA" self.test_contacts = [MockContact() for i in range(3)] self.test_contacts[0]["givenName"] = self.target_name self.test_contacts[0]["familyName"] = "Automation" self.test_contacts[0]["name"] = "{} {}".format( self.test_contacts[0]["givenName"], self.test_contacts[0]["familyName"]) map(self.UTILS.general.insertContact, self.test_contacts) self.contacts.launch() self._add_contact_as_favorite(self.test_contacts[0]) self.connect_to_network() self.loop.initial_test_checks() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2)
def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.email_address = self.UTILS.general.get_config_variable( "gmail_1_email", "common") self.test_contact = MockContact(email=[{ "type": "Personal", "value": "*****@*****.**" }, { "type": "Personal", "value": "*****@*****.**" }, { "type": "Personal", "value": "*****@*****.**" }]) self.UTILS.general.insertContact(self.test_contact) self.UTILS.general.add_file_to_device( './tests/_resources/contact_face.jpg') self.data_layer.delete_all_sms()
def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.email = Email(self) # Get details of our test contacts. email1 = self.UTILS.general.get_config_variable( "gmail_1_email", "common") email2 = self.UTILS.general.get_config_variable( "gmail_2_email", "common") email3 = self.UTILS.general.get_config_variable( "hotmail_1_email", "common") self.contact = MockContact(email=[{ 'type': 'Personal', 'value': email1 }, { 'type': 'Personal', 'value': email2 }, { 'type': 'Personal', 'value': email3 }]) """ We're not testing adding a contact, so just stick one into the database. """ self.UTILS.general.insertContact(self.contact) self._email_subject = "test " + str(time.time()) self._email_message = "Test message"
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) # Get details of our test contacts. self.contact = MockContact() self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # Search for our new contact. self.contacts.view_contact(self.contact["name"]) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot of contact:", x)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() self.messages.launch() self.UTILS.home.touchHomeButton() time.sleep(1) self.UTILS.home.holdHomeButton() self.UTILS.element.waitForElements(DOM.Home.cards_view, "App 'cards' list (task switcher)") x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot:", x)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) # Get details of our test contacts. self.contact = MockContact() self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() self.contacts.view_contact(self.contact['name']) audio_btn = self.marionette.find_element(DOM.Contacts.view_contact_hello_option[0], DOM.Contacts.view_contact_hello_option[1].format("audio")) video_btn = self.marionette.find_element(DOM.Contacts.view_contact_hello_option[0], DOM.Contacts.view_contact_hello_option[1].format("video")) self.UTILS.test.test(audio_btn, "Audio button present in contact") self.UTILS.test.test(video_btn, "Video button present in contact")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.loop = Loop(self) # Get details of our test contacts. self.contact = MockContact() self.UTILS.general.insertContact(self.contact) self.data_layer.connect_to_wifi() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() self.contacts.view_contact(self.contact['name']) video_btn = self.marionette.find_element( DOM.Contacts.view_contact_hello_option[0], DOM.Contacts.view_contact_hello_option[1].format("video")) video_btn.tap() self.loop.share_micro_and_camera() header = self.marionette.find_element(*DOM.Loop.app_header) self.UTILS.test.test(header, "Firefox Hello launched successfully")
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.contacts = Contacts(self) self.connect_to_network() self.loop.initial_test_checks() self.contact = MockContact() self.UTILS.general.insertContact(self.contact) self.apps.kill_all() time.sleep(2) _ = setup_translations(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() self.contacts.view_contact(self.contact['name']) video_btn = self.marionette.find_element(DOM.Contacts.view_contact_hello_option[0], DOM.Contacts.view_contact_hello_option[1].format("video")) video_btn.tap() self.loop.share_micro_and_camera() header = self.marionette.find_element(*DOM.Loop.app_header) self.UTILS.test.test(header, "Firefox Hello launched successfully") self.UTILS.iframe.switch_to_frame(*DOM.Loop.frame_locator) phone_btn = self.marionette.find_element(*DOM.Loop.wizard_login_phone_number) self.UTILS.test.test(phone_btn, "Login using phone number button present")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.loop = Loop(self) # Insert test contact self.contact = MockContact() self.UTILS.general.insertContact(self.contact) _ = setup_translations(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() self.contacts.view_contact(self.contact['name']) video_btn = self.marionette.find_element(DOM.Contacts.view_contact_hello_option[0], DOM.Contacts.view_contact_hello_option[1].format("video")) video_btn.tap() self.loop.share_micro_and_camera() self.marionette.switch_to_frame() msg_dom = (DOM.Loop.connection_error_msg[0], DOM.Loop.connection_error_msg[1].format(_("connection failure"))) self.wait_for_element_displayed(*msg_dom, timeout=15) error_msg = self.marionette.find_element(*msg_dom) self.UTILS.test.test(error_msg, "Error message due to connection failure was found")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.loop = Loop(self) # Get details of our test contacts. self.contact = MockContact() self.contact['tel'] = None self.contact['email'] = None self.UTILS.general.insertContact(self.contact) self.data_layer.connect_to_wifi() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() self.contacts.view_contact(self.contact['name']) self.wait_for_element_not_present( DOM.Contacts.view_contact_hello_option[0], DOM.Contacts.view_contact_hello_option[1].format("audio"), timeout=5) self.UTILS.reporting.info("No audio call button present, as expected") self.wait_for_element_not_present( DOM.Contacts.view_contact_hello_option[0], DOM.Contacts.view_contact_hello_option[1].format("video"), timeout=5) self.UTILS.reporting.info("No video call button present, as expected")
class test_main(GaiaTestCase): test_msg = "Test." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.gallery = Gallery(self) # Import contact (adjust to the correct number). self.test_num = self.UTILS.general.get_config_variable("phone_number", "custom") self.cont = MockContact(tel={"type": "Mobile", "value": self.test_num}) self.UTILS.reporting.logComment("Using target telephone number " + self.cont["tel"]["value"]) def tearDown(self): self.UTILS.general.remove_files() self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.general.add_file_to_device('./tests/_resources/imgd.jpg') # Launch messages app. self.messages.launch() # Create a new SMS self.messages.startNewSMS() # Insert the phone number in the To field self.messages.addNumbersInToField([self.test_num]) # Create MMS. self.messages.enterSMSMsg(self.test_msg) self.messages.create_mms_image() self.gallery.click_on_thumbnail_at_position_mms(0) # Click send and wait for the message to be received self.messages.sendSMS() send_time = self.messages.last_sent_message_timestamp() """ Open contacts app and create a contact with the same phone number used to send the MMS in the previous step """ self.contacts.launch() self.contacts.create_contact(self.cont) # Switch back to the messages app. self.UTILS.home.goHome() self.messages.launch() # Verify the thread now contains the name of the contact instead of the phone number self.UTILS.reporting.logComment("Trying to open the thread with name: " + self.cont["name"]) self.messages.openThread(self.cont["name"]) self.messages.wait_for_message(send_time)
def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.contacts = Contacts(self) self.settings = Settings(self) self.fxa_user = self.UTILS.general.get_config_variable( "fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable( "fxa_pass", "common") self.connect_to_network() self.target_name = "QA" self.test_contacts = [MockContact() for i in range(5)] self.test_contacts[0]["givenName"] = self.target_name self.test_contacts[0]["familyName"] = "Automation" map(self.UTILS.general.insertContact, self.test_contacts) # Clean start if not self.loop.is_installed(): self.loop.install() else: self.loop.launch() # If already logged in, logout if not self.loop.wizard_or_login(): self.loop.open_settings() self.loop.logout() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2)
class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.settings = Settings(self) # Create test contacts. self.contact = MockContact() self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Set up to use data connection. self.connect_to_network() # Launch contacts app. self.contacts.launch() login_result = self.contacts.import_hotmail_login( "*****@*****.**", "wrongpass") self.UTILS.test.test(login_result == False, "Login failed.")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.contact = MockContact(tel={ 'type': '', 'value': self.phone_number }) self.UTILS.general.insertContact(self.contact) self.UTILS.reporting.logComment("Using target telephone number " + self.contact["tel"]["value"]) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() # Type a message containing the required string self.messages.startNewSMS() self.messages.enterSMSMsg("Test message") # Search for our contact. self.messages.selectAddContactButton() self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) self.contacts.search("Knot A Match") self.contacts.check_search_results("Knot A Match", False)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) # Create our test contacts. self.contact_list = [ MockContact(tel={ 'type': 'Mobile', 'value': "{}".format(i) * 9 }) for i in range(3) ] map(self.UTILS.general.insertContact, self.contact_list) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # Search for our new contact. self.contacts.search("999999999") # Verify that there are no results. self.UTILS.element.waitForElements( DOM.Contacts.search_no_contacts_found, "'No contacts found' message")
class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) # Create our test contacts. self.contact = MockContact() self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Set up to use data connection. self.connect_to_network() # Launch contacts app. self.contacts.launch() x = self.contacts.import_gmail_login("wrongname", "wrongpass") self.UTILS.test.test(x == False, "Login failed.")
def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.loop = Loop(self) # Get details of our test contacts. self.contact = MockContact() self.UTILS.general.insertContact(self.contact) self.data_layer.connect_to_wifi() result = self.loop.initial_test_checks() if result: self.loop.phone_login() self.loop.allow_permission_phone_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.apps.kill_all() time.sleep(2) _ = setup_translations(self) self.expected_message = _("No problem! Just share the following link and they can call you back from"\ " any browser.")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) # Create our test contacts. self.contact_list = [MockContact() for i in range(3)] map(self.UTILS.general.insertContact, self.contact_list) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # Search for our new contact. self.contacts.search(self.contact_list[0]["tel"]["value"]) # Verify that we're now in the 'search results' screen. self.UTILS.element.waitForElements(DOM.Contacts.search_results_list, "Search results list") # Cancel the search. x = self.UTILS.element.getElement(DOM.Contacts.search_cancel_btn, "Cancel search button") x.tap() # Verify that we're no longer in the 'search results' screen. self.UTILS.element.waitForNotElements(DOM.Contacts.search_results_list, "Search results list")
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.contacts = Contacts(self) # Get details of our test contacts. self.test_contacts = [MockContact() for i in range(3)] self.test_contacts[2]["familyName"] = "Tnameir" self.midWord = "name" map(self.UTILS.general.insertContact, self.test_contacts) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # Search for the sought contact. self.contacts.search(self.midWord) # Verify our contact is listed. self.contacts.check_search_results(self.test_contacts[2]["givenName"]) # Verify the other contact is NOT listed. self.contacts.check_search_results(self.test_contacts[1]["givenName"], False) self.contacts.check_search_results(self.test_contacts[0]["givenName"], False)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.loop = Loop(self) # Get details of our test contacts. self.contact = MockContact() self.UTILS.general.insertContact(self.contact) self.data_layer.connect_to_wifi() result = self.loop.initial_test_checks() if result: self.loop.phone_login() self.loop.allow_permission_phone_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.apps.kill_all() time.sleep(2) _ = setup_translations(self) self.expected_message = _("No problem! Just share the following link and they can call you back from"\ " any browser.") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() self.contacts.view_contact(self.contact['name']) video_btn = self.marionette.find_element(DOM.Contacts.view_contact_hello_option[0], DOM.Contacts.view_contact_hello_option[1].format("video")) video_btn.tap() self.loop.share_micro_and_camera() self.wait_for_element_displayed(*DOM.Loop.not_a_user_explanation, timeout=10) not_a_user_explanation = self.marionette.find_element(*DOM.Loop.not_a_user_explanation) self.UTILS.test.test(not_a_user_explanation.text == self.expected_message, "Message found: {} (Expected: {}".\ format(not_a_user_explanation.text, self.expected_message)) share_options = self.UTILS.element.getElements(DOM.Loop.share_link_options, "Sharing options") self.UTILS.test.test(len(share_options) == 3, "There are {} sharing options (Expected: 3)".\ format(len(share_options))) share_by_others = self.UTILS.element.getElement(DOM.Loop.share_panel_others_share, "Share by others") share_by_others.tap() self.marionette.switch_to_frame() self.UTILS.element.getElement((DOM.Loop.share_others_header[0], DOM.Loop.share_others_header[1].format(_("Share with:"))), "Share with Header") options = self.UTILS.element.getElements((DOM.Loop.share_others_options[0], DOM.Loop.share_others_options[1].\ format(_("Share with:"))), "Options buttons") self.UTILS.test.test(len(options) == 3, "There are {} options (Expected: 3)".format(len(options)))
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): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.contact = MockContact(tel={'type': '', 'value': self.phone_number}) self.UTILS.general.insertContact(self.contact) self.UTILS.reporting.logComment("Using target telephone number " + self.contact["tel"]["value"]) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() # Type a message containing the required string self.messages.startNewSMS() self.messages.enterSMSMsg("Test message") # Search for our contact. self.messages.selectAddContactButton() self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) self.contacts.search("Knot A Match") self.contacts.check_search_results("Knot A Match", False)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Import contact (adjust the correct number). self.contact = MockContact() self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() # Start a new SMS and add the message and contact name. self.messages.startNewSMS() self.messages.selectAddContactButton() self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) self.contacts.view_contact(self.contact["givenName"], False) self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) self.messages.checkIsInToField(self.contact["name"], True) # Remove it. self.messages.removeContactFromToField(self.contact["name"]) # Verify the contact name is no longer present before removing it. self.messages.checkIsInToField(self.contact["name"], False)
class test_main(GaiaTestCase): test_msg = "Test message." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(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): # Launch messages app. self.messages.launch() # Create and send a new test message. self.messages.create_and_send_sms([self.phone_number], "Test message.") x = self.messages.wait_for_message() # Tap the header to create a contact. self.messages.header_createContact() # Fill in some details. contFields = self.contacts.get_contact_fields() self.contacts.replace_str(contFields['givenName'], "Test") self.contacts.replace_str(contFields['familyName'], "Testerton") # Press the Done button. x = self.UTILS.element.getElement(DOM.Contacts.done_button, "Done button") x.tap() # Wait for contacts app to close and return to sms app. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements( ("xpath", "//iframe[contains(@src, '{}')]".format( DOM.Contacts.frame_locator[1])), "Contacts iframe") self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) # Verify the header is now the name, x = self.UTILS.element.getElement(DOM.Messages.message_header, "Message header") self.UTILS.test.test( x.text == "Test Testerton", "Message header has been changed to match the contact (it was '{}')." .format(x.text)) # Go back to the threads view and check the message name there too. self.messages.go_back() self.messages.openThread("Test Testerton")
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): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.settings = Settings(self) self.contact = MockContact() self.UTILS.general.insertContact(self.contact) self.connect_to_network() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() x = self.UTILS.element.getElement(DOM.Contacts.settings_button, "Settings button") x.tap() x = self.UTILS.element.getElement(DOM.Contacts.import_contacts, "Import button") time.sleep(1) x.tap() self.UTILS.element.waitForElements(DOM.Contacts.gmail_button, "Gmail button")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.settings = Settings(self) # Create test contacts. self.contact = MockContact() self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() x = self.UTILS.element.getElement(DOM.Contacts.settings_button, "Settings button") x.tap() x = self.UTILS.element.getElement(DOM.Contacts.import_contacts, "Import button") x.tap() # Wait for the Hotmail button. x = self.UTILS.element.getElement(DOM.Contacts.hotmail_button, "Hotmail button") x_dis = x.get_attribute("disabled") self.UTILS.test.test(x_dis == "true", "The Hotmail button is disabled ('disabled' was set to '{}').".format(x_dis)) x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot and details", x)
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.contact = MockContact(tel=[{'type': 'Mobile', 'value': '111111111'}, {'type': 'Mobile', 'value': '222222222'}]) self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() # Type a message containing the required string self.messages.startNewSMS() self.messages.enterSMSMsg("Test message") # Search for our contact. self.messages.selectAddContactButton() self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) self.contacts.search(self.contact['name']) self.contacts.select_search_result_several_phones(self.contact['name'], self.contact['tel'][0]['value'], cancel=True)
def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.contact = MockContact() self.UTILS.general.insertContact(self.contact)
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.contacts = Contacts(self) # Create our test contacts. self.contact_list = [MockContact(tel={'type': 'Mobile', 'value': "{}".format(i) * 9}) for i in range(3)] map(self.UTILS.general.insertContact, self.contact_list) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # Search for our new contact. self.contacts.search("999999999") # Verify that there are no results. self.UTILS.element.waitForElements(DOM.Contacts.search_no_contacts_found, "'No contacts found' message")
class test_main(GaiaTestCase): test_msg = "Test." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Prepare the contact we're going to insert. self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.contact = MockContact(givenName='AAAAAAAAAAAAAAAALEX', familyName='SMITHXXXXXXXX', name='AAAAAAAAAAAAAAAALEX SMITHXXXXXXXX', tel={ 'type': 'Mobile', 'value': self.phone_number }) self.UTILS.general.insertContact(self.contact) self.cp_incoming_number = self.UTILS.general.get_config_variable( "sms_platform_numbers", "common").split(',') self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() self.UTILS.messages.create_incoming_sms(self.contact["tel"]["value"], self.test_msg) self.UTILS.statusbar.wait_for_notification_toaster_detail( self.test_msg, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles( self.cp_incoming_number, timeout=5) self.UTILS.statusbar.click_on_notification_title( title, DOM.Messages.frame_locator) # Launch contacts app. self.contacts.launch() # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the sms button in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button") smsBTN.tap() time.sleep(2) self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) self.messages.check_last_message_contents(self.test_msg)
class test_main(GaiaTestCase): def __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.contacts = Contacts(self) self.hotmail_user = self.UTILS.general.get_config_variable("hotmail_2_email", "common") self.hotmail_passwd = self.UTILS.general.get_config_variable("hotmail_2_pass", "common") self.number_of_hotmail_contacts = 2 self.data_layer.connect_to_wifi() self.contact = MockContact() self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() login_result = self.contacts.import_hotmail_login(self.hotmail_user, self.hotmail_passwd) if not login_result: self.UTILS.reporting.logResult(False, "Cannot continue past this point without importing the contacts.") return self.UTILS.iframe.switchToFrame(*DOM.Contacts.hotmail_import_frame, via_root_frame=False) self.contacts.import_all() import_header = self.UTILS.element.getElement( DOM.Contacts.import_contacts_header, "Import Contacts Header", True, 10, True) time.sleep(1) import_header.tap(25, 25) self.wait_for_element_displayed(DOM.Contacts.settings_done_button[0], DOM.Contacts.settings_done_button[1], timeout=5) done = self.marionette.find_element(*DOM.Contacts.settings_done_button) self.UTILS.element.simulateClick(done) # Check our three contacts are in the list. prepopulated_contact = (DOM.Contacts.view_all_contact_specific_contact[0], DOM.Contacts.view_all_contact_specific_contact[1].format("OWD")) self.UTILS.element.waitForElements(prepopulated_contact, "Prepopulated Contact") # ... and the hotmail contacts ... hotmail_imported = (DOM.Contacts.view_all_contact_specific_contact[0], DOM.Contacts.view_all_contact_specific_contact[1].format("roy")) contacts = self.UTILS.element.getElements(hotmail_imported, "Gmail imported contacts") self.UTILS.test.test(len(contacts) == self.number_of_hotmail_contacts, "All gmail contacts has been imported") result = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot and details", result)
class test_main(GaiaTestCase): name = "Obi" surname = "Wan" def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # Click create new contact. self.contacts.start_create_new_contact() # Add some info. to the field. given_name = self.UTILS.element.getElement( DOM.Contacts.given_name_field, "Given name field") given_name.send_keys(self.name) # Press the 'x'. reset = self.UTILS.element.getElement( DOM.Contacts.given_name_reset_icon, "Given name reset icon") reset.tap() # Click the header, then verify that the field contains nothing. self.marionette.find_element("xpath", '//h1[@id="contact-form-title"]').tap() given_name = self.UTILS.element.getElement( DOM.Contacts.given_name_field, "Given name field") self.UTILS.test.test(given_name.text == "", "Given name field is empty after being cleared.") # Add some info. to the field. surname = self.UTILS.element.getElement(DOM.Contacts.family_name_field, "Surname field") surname.send_keys(self.surname) # Press the 'x'. reset = self.UTILS.element.getElement( DOM.Contacts.family_name_reset_icon, "Surname reset icon") reset.tap() # Click the header, then verify that the field contains nothing. self.marionette.find_element("xpath", '//h1[@id="contact-form-title"]').tap() surname = self.UTILS.element.getElement(DOM.Contacts.family_name_field, "Surname field") self.UTILS.test.test(surname.text == "", "Surname field is empty after being cleared.")
class test_main(GaiaTestCase): test_msg = "Test." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) # Import contact (adjust to the correct number). self.test_num = self.UTILS.general.get_config_variable( "phone_number", "custom") self.cont = MockContact(tel={"type": "Mobile", "value": self.test_num}) self.UTILS.reporting.logComment("Using target telephone number " + self.cont["tel"]["value"]) self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() # Create a new SMS self.messages.startNewSMS() # Insert the phone number in the To field self.messages.addNumbersInToField([self.test_num]) # Create SMS. self.messages.enterSMSMsg(self.test_msg) # Click send and wait for the message to be received self.messages.sendSMS() self.messages.wait_for_message() self.messages.go_back() """ Open contacts app and create a contact with the same phone number used to send the SMS in the previous step """ self.contacts.launch() self.contacts.create_contact(self.cont) # Switch back to the messages app. # self.UTILS.app.switchToApp("Messages") self.messages.launch() # Verify the thread now contains the name of the contact instead of the phone number self.UTILS.reporting.logComment( "Trying to open the thread with name: " + self.cont["name"]) self.messages.openThread(self.cont["name"])
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Get details of our test contacts. self.contact = MockContact(tel=[{ 'type': 'Mobile', 'value': '11111111' }, { 'type': 'Mobile', 'value': '222222222' }]) """ We're not testing adding a contact, so just stick one into the database. """ self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the 2nd sms button (index=1) in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement( ("id", DOM.Contacts.sms_button_specific_id.format(0)), "1st send SMS button") smsBTN.tap() """ Switch to the 'Messages' app frame (or marionette will still be watching the 'Contacts' app!). """ self.marionette.switch_to_frame() self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) time.sleep(2) """ test: this automatically opens the 'send SMS' screen, so check the correct name is in the header of this sms. """ self.UTILS.element.headerCheck("1 recipient") # Check this is the right number. self.messages.checkIsInToField(self.contact["name"]) self.messages.checkNumberIsInToField(self.contact["tel"][0]["value"])
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 setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.test_contact = MockContact() self.UTILS.general.add_file_to_device( './tests/_resources/contact_face.jpg')
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',') def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Create and send a new test message. msg_text = "Nine 123456789 numbers." self.UTILS.messages.create_incoming_sms(self.phone_number, msg_text) self.UTILS.statusbar.wait_for_notification_toaster_detail(msg_text, timeout=120) title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5) self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator) sms = self.messages.last_message_in_this_thread() # Long press the embedded number link. link = sms.find_element("tag name", "a") link.tap() # Select create new contact. btn = self.UTILS.element.getElement(DOM.Messages.header_create_new_contact_btn, "Create new contact button") btn.tap() self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) contFields = self.contacts.get_contact_fields() # Verify the number is in the number field. self.UTILS.test.test("123456789" in contFields['tel'].get_attribute("value"), "Our target number is in the telephone field (expected {}).".\ format(contFields['tel'].get_attribute("value"))) """ Put the contact details into each of the fields (this method clears each field first). """ self.contacts.replace_str(contFields['givenName'], "Test27000") self.contacts.replace_str(contFields['familyName'], "Testerton") x = self.UTILS.element.getElement(DOM.Contacts.done_button, "Done button") x.tap() # Wait for the contacts app to go away. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@src, '{}')]".\ format(DOM.Contacts.frame_locator[1])), "Contacts iframe") # Verify that the sms app is still running. self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.contact = MockContact() self.UTILS.general.insertContact(self.contact) self.data_layer.connect_to_wifi()
class test_main(GaiaTestCase): test_msg = "Test." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) # Import contact (adjust to the correct number). self.test_num = self.UTILS.general.get_config_variable("phone_number", "custom") self.cont = MockContact(tel={"type": "Mobile", "value": self.test_num}) self.UTILS.reporting.logComment("Using target telephone number " + self.cont["tel"]["value"]) self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch messages app. self.messages.launch() # Create a new SMS self.messages.startNewSMS() # Insert the phone number in the To field self.messages.addNumbersInToField([self.test_num]) # Create SMS. self.messages.enterSMSMsg(self.test_msg) # Click send and wait for the message to be received self.messages.sendSMS() self.messages.wait_for_message() self.messages.go_back() """ Open contacts app and create a contact with the same phone number used to send the SMS in the previous step """ self.contacts.launch() self.contacts.create_contact(self.cont) # Switch back to the messages app. # self.UTILS.app.switchToApp("Messages") self.messages.launch() # Verify the thread now contains the name of the contact instead of the phone number self.UTILS.reporting.logComment("Trying to open the thread with name: " + self.cont["name"]) self.messages.openThread(self.cont["name"])
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Get details of our test contacts. self.contact = MockContact(tel=[{'type': 'Mobile', 'value': '11111111'}, {'type': 'Mobile', 'value': '222222222'}]) """ We're not testing adding a contact, so just stick one into the database. """ self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # Select our contact. # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the 2nd sms button (index=1) in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement(("id", DOM.Contacts.sms_button_specific_id.format(1)), "2nd send SMS button") smsBTN.tap() """ Switch to the 'Messages' app frame (or marionette will still be watching the 'Contacts' app!). """ self.marionette.switch_to_frame() self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) time.sleep(3) """ test: this automatically opens the 'send SMS' screen, so check the correct name is in the header of this sms. """ self.UTILS.element.headerCheck("1 recipient") # Check this is the right number. self.messages.checkIsInToField(self.contact["name"]) self.messages.checkNumberIsInToField(self.contact["tel"][1]["value"])
class test_main(GaiaTestCase): test_msg = "Test message." def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.contact = MockContact() self.UTILS.general.insertContact(self.contact) 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], "Test message.") self.messages.wait_for_message() # Tap the header to create a contact. self.messages.header_addToContact() # Select our contact. self.contacts.view_contact(self.contact["givenName"], False) # Check the phone number. second_phone = self.UTILS.element.getElement(("id", "number_1"), "2nd phone number.") self.UTILS.test.test(second_phone.get_attribute("value") == self.phone_number, "Contact now has a 2nd number which is '{}' (it was '{}').".format(self.phone_number, second_phone.get_attribute("value"))) # Press the Done button. done_btn = self.UTILS.element.getElement(DOM.Contacts.edit_update_button, "Update button") done_btn.tap() # Wait for contacts app to close and return to sms app. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@src, '{}')]".format(DOM.Contacts.frame_locator[1])), "Contacts iframe") self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) # Verify the header is now the name, header = self.UTILS.element.getElement(DOM.Messages.message_header, "Message header") self.UTILS.test.test(header.text == self.contact["name"], "Message header has been changed to match the contact (it was '{}').".format(header.text)) # Go back to the threads view and check the message name there too. self.messages.go_back() self.messages.openThread(self.contact["name"])
class test_main(GaiaTestCase): add_fav_str = "Add as Favorite" remove_fav_str = "Remove as Favorite" def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.contact = MockContact() self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() # View the details of our contact and make him a favourite. self.UTILS.reporting.logResult("info", "<b>Setting up a contact in favourites ...</b>") self.contacts.view_contact(self.contact['name']) fav_btn = self.UTILS.element.getElement(DOM.Contacts.favourite_button, "Toggle favourite button (before tap)") self.UTILS.test.test(fav_btn.text == self.add_fav_str, "Toggle favourite button text is '{}'.". format(self.add_fav_str)) fav_btn.tap() fav_btn = self.UTILS.element.getElement(DOM.Contacts.favourite_button, "Toggle favourite button (after tap)") self.UTILS.test.test(fav_btn.text == self.remove_fav_str, "Toggle favourite button text is '{}'.". format(self.remove_fav_str)) self.contacts.go_back_from_contact_details() string = self.contact['givenName'] + self.contact['familyName'] favs = ("xpath", DOM.Contacts.favourites_list_xpath.format(string.upper())) self.UTILS.element.waitForElements(favs, "'" + self.contact['name'] + "' in the favourites list") screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot at this point", screenshot) self.UTILS.reporting.logResult("info", "<b>removing contact from favourites ...</b>") self.contacts.view_contact(self.contact['name']) fav_btn = self.UTILS.element.getElement(DOM.Contacts.favourite_button, "Toggle favourite button (before tap)") self.UTILS.test.test(fav_btn.text == self.remove_fav_str, "Toggle favourite button text is '{}'.". format(self.remove_fav_str)) fav_btn.tap() fav_btn = self.UTILS.element.getElement(DOM.Contacts.favourite_button, "Toggle favourite button (after tap)") self.UTILS.test.test(fav_btn.text == self.add_fav_str, "Toggle favourite button text is '{}'.". format(self.add_fav_str)) self.contacts.go_back_from_contact_details() time.sleep(1) string = self.contact['givenName'] + " " + self.contact['familyName'] favs = ("xpath", DOM.Contacts.favourites_list_xpath.format(string.upper())) self.UTILS.element.waitForNotElements(favs, "'" + self.contact['name'] + "' in the favourites list")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.contact = MockContact() self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() # View the contact details. self.contacts.view_contact(self.contact['name']) # Press the favourites button. fav_btn = self.UTILS.element.getElement(DOM.Contacts.favourite_button, "Favourite toggle button") fav_btn.tap() # Go back to view all contacts and check this contact is listed in the # 'favourites' section. self.contacts.go_back_from_contact_details() # Check our test contact is listed in the group favourites. string = self.contact['givenName'] + self.contact['familyName'] favs = ("xpath", DOM.Contacts.favourites_list_xpath.format(string.upper())) self.UTILS.element.waitForElements(favs, "'" + self.contact['name'] + "' in the favourites list") # View the contact. self.UTILS.reporting.logResult("info", "*** Removing contact as a favourite ... ***") self.contacts.view_contact(self.contact['name']) # Press the favourites button. fav_btn = self.UTILS.element.getElement(DOM.Contacts.favourite_button, "Favourite toggle button") self.UTILS.test.test(fav_btn.text == "Remove as Favorite", "Favourite toggle button says 'Remove as Favorite' before contact is removed as a favorite.") fav_btn.tap() time.sleep(2) fav_btn = self.UTILS.element.getElement(DOM.Contacts.favourite_button, "Favourite toggle button") self.UTILS.test.test(fav_btn.text == "Add as Favorite", "Favourite toggle button says 'Add as Favorite' after contact is removed as a favorite.") # Go back to view all contacts and check this contact is listed in the # 'favourites' section. self.contacts.go_back_from_contact_details() # Check our test contact is no longer listed in the group favourites. string = self.contact['givenName'] + self.contact['familyName'] favs = ("xpath", DOM.Contacts.favourites_list_xpath.format(string.upper())) self.UTILS.element.waitForNotElements(favs, "'" + self.contact['name'] + "' in the favourites list")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.contact = MockContact() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() self.contacts.start_create_new_contact() done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "Done button") self.UTILS.test.test(not done_button.is_enabled(), "Done button is not enabled") contFields = self.contacts.get_contact_fields() """ Put the contact details into each of the fields (this method clears each field first). """ self.contacts.replace_str(contFields['tel'], self.contact["tel"]["value"]) done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "Done button") self.UTILS.test.test(done_button.is_enabled(), "Done button is not enabled") done_button.tap() self.contacts.view_contact(self.contact["tel"]["value"])
class test_main(GaiaTestCase): test_msg = "Test." def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.messages = Messages(self) # Prepare the contact we're going to insert. tlf = self.UTILS.general.get_config_variable("phone_number", "custom") self.contact = MockContact(tel={'type': 'Mobile', 'value': tlf}) self.UTILS.reporting.logComment("Using target telephone number " + self.contact["tel"]["value"]) # Add this contact (quick'n'dirty method - we're just testing sms, no adding a contact). self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # View the details of our contact. self.contacts.view_contact(self.contact['name']) # Tap the sms button in the view details screen to go to the sms page. smsBTN = self.UTILS.element.getElement(DOM.Contacts.sms_button, "Send SMS button") smsBTN.tap() """ Switch to the 'Messages' app frame (or marionette will still be watching the 'Contacts' app!). """ time.sleep(2) self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) # Create SMS. x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "frame", x) self.messages.enterSMSMsg(self.test_msg) # Click send. self.messages.sendSMS()
class test_main(GaiaTestCase): test_msg = "Test message." def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(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): # Launch messages app. self.messages.launch() # Create and send a new test message. self.messages.create_and_send_sms([self.phone_number], "Test message.") x = self.messages.wait_for_message() # Tap the header to create a contact. self.messages.header_createContact() # Fill in some details. contFields = self.contacts.get_contact_fields() self.contacts.replace_str(contFields['givenName'], "Test") self.contacts.replace_str(contFields['familyName'], "Testerton") # Press the Done button. x = self.UTILS.element.getElement(DOM.Contacts.done_button, "Done button") x.tap() # Wait for contacts app to close and return to sms app. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@src, '{}')]".format(DOM.Contacts.frame_locator[1])), "Contacts iframe") self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator) # Verify the header is now the name, x = self.UTILS.element.getElement(DOM.Messages.message_header, "Message header") self.UTILS.test.test(x.text == "Test Testerton", "Message header has been changed to match the contact (it was '{}').".format(x.text)) # Go back to the threads view and check the message name there too. self.messages.go_back() self.messages.openThread("Test Testerton")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) self.loop = Loop(self) # Get details of our test contacts. self.contact = MockContact() curr_time = repr(time.time()).replace('.', '') self.contact['email'] = [self.contact['email']] self.contact['tel'] = [self.contact['tel']] self.contact['email'].append({ 'type': 'Job', 'value': '{}@testmail.net'.format(curr_time)}) self.contact['tel'].append({ 'type': 'Landline', 'value': '91{}'.format(curr_time)}) self.UTILS.general.insertContact(self.contact) self.data_layer.connect_to_wifi() self.loop.initial_test_checks() result = self.loop.wizard_or_login() if result: self.loop.phone_login() self.loop.allow_permission_phone_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.apps.kill_all() time.sleep(2) _ = setup_translations(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() self.contacts.view_contact(self.contact['name']) video_btn = self.marionette.find_element(DOM.Contacts.view_contact_hello_option[0], DOM.Contacts.view_contact_hello_option[1].format("video")) video_btn.tap() self.loop.share_micro_and_camera() not_user_str = _("Not a Firefox Hello user yet") not_user_dom = (DOM.Loop.not_a_hello_user_msg[0], DOM.Loop.not_a_hello_user_msg[1].format(not_user_str)) self.wait_for_element_displayed(*not_user_dom, timeout=10) not_a_user_msg = self.marionette.find_element(*not_user_dom) self.UTILS.test.test(not_a_user_msg.text == not_user_str, "Message found: {} (Expected: {}".\ format(not_a_user_msg.text, not_user_str))
class test_main(GaiaTestCase): test_msg = "Test message." def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common") self.test_contact = MockContact(email=[{"type": "Personal", "value": "*****@*****.**"}, {"type": "Personal", "value": "*****@*****.**"}, {"type": "Personal", "value": "*****@*****.**"}]) self.UTILS.general.insertContact(self.test_contact) self.UTILS.general.add_file_to_device('./tests/_resources/contact_face.jpg') self.data_layer.delete_all_sms() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.messages.launch() self.messages.create_and_send_sms([self.phone_number], "Hello {} old bean.".format(self.email_address)) send_time = self.messages.last_sent_message_timestamp() msg = self.messages.wait_for_message(send_time=send_time) # Press the email link. link = msg.find_element("tag name", "a") link.tap() add_btn = self.UTILS.element.getElement(DOM.Messages.header_add_to_contact_btn, "Add to an existing contact button") add_btn.tap() # Verify that the email is in the email field. self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) self.contacts.view_contact(self.test_contact["givenName"], False) self.UTILS.element.waitForElements(("xpath", "//input[@type='email' and @value='{}']".format(self.email_address)), "New email address") self.contacts.add_gallery_image_to_contact(0) done_button = self.UTILS.element.getElement(DOM.Contacts.edit_update_button, "'Update' button") done_button.tap() # Check that the contacts iframe is now gone. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@src,'contacts')]"), "Contact app iframe")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.contacts = Contacts(self) self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") 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. test_str = "Nine 123456789 numbers." self.messages.create_and_send_sms([self.phone_number], test_str) msg = self.messages.wait_for_message() # Long press the emedded number link. tag = msg.find_element("tag name", "a") tag.tap() # Select create new contact. create_btn = self.UTILS.element.getElement(DOM.Messages.header_create_new_contact_btn, "Create new contact button") create_btn.tap() self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) # Cancel the action. form_header = self.UTILS.element.getElement(DOM.Contacts.contact_form_header, "Cancel button") form_header.tap(25, 25) # Wait for the contacts app to go away. self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@src, '{}')]".format(DOM.Contacts.frame_locator[1])), "Contacts iframe") # Kill the SMS app (and all others). self.apps.kill_all() # Open the contacts app. self.contacts.launch() # Verify that there are no contacts. self.UTILS.element.waitForElements(("xpath", "//p[contains(text(), 'No contacts')]"), "No contacts message")