class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) # Create test contact. self.contact = MockContact() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Launch contacts app. self.contacts.launch() # Create our contact. self.contacts.create_contact(self.contact) # Verify our contact details. self.contacts.check_view_contact_details(self.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() 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): # 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[0]["givenName"] = "nameJohn" self.beginningWord = "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() # With name: Search for the sought contact. self.contacts.search(self.beginningWord) # With name: Verify our contact is listed. self.contacts.check_search_results(self.test_contacts[0]["givenName"]) # With name: 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[2]["givenName"], False)
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) # 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 __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.")
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) # 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): # Launch contacts app. self.contacts.launch() # Search for our new contact. self.contacts.search(self.contact["tel"]["value"]) # Verify our contact is listed. self.contacts.check_search_results(self.contact["givenName"], True)
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(2)] 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 our new contact. self.contacts.search("XXXX") # Verify our contact is listed. self.contacts.check_search_results(self.test_contacts[0]["givenName"], False) # Verify the other contact is NOT listed. self.contacts.check_search_results(self.test_contacts[1]["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.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): 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 test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) # Prepare the contact. self.contact = MockContact() self.UTILS.general.insertContact(self.contact) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def toggle_fav(self, contact_name): self.contacts.view_contact(contact_name) fav_btn = self.UTILS.element.getElement(DOM.Contacts.favourite_button, "Toggle favourite button (before tap)") fav_btn.tap() self.contacts.go_back_from_contact_details() 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.toggle_fav(self.contact["name"]) self.UTILS.element.waitForElements(DOM.Contacts.favourites_section, "Favourites section") self.UTILS.reporting.logResult("info", "<b>Removing contact from favourites ...</b>") self.toggle_fav(self.contact['name']) self.UTILS.element.waitForNotElements(DOM.Contacts.favourites_section, "Favourites section")
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): 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)
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 __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.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): 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 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.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() # View the contact details. self.contacts.view_contact(self.contact['name']) # Edit the contact. self.contacts.press_edit_contact_button() # Check the items. self.UTILS.element.waitForElements(DOM.Contacts.edit_update_button, "Edit 'upate' button") x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Final screenshot", x)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(self) # Create 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 the sought contact. self.UTILS.reporting.logResult( "info", "<b>Search against number in 'given name' field ...</b>") self.contacts.search(self.contact_list[1]["tel"]["value"]) self.contacts.check_search_results(self.contact_list[1]["givenName"])
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.contacts = Contacts(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() # Select a contact. self.contacts.search(self.contact["givenName"]) self.contacts.select_search_result(self.contact["givenName"]) # Tap on edit mode. editBTN = self.UTILS.element.getElement(DOM.Contacts.edit_details_button, "Edit details button") editBTN.tap() self.UTILS.element.waitForElements(DOM.Contacts.edit_contact_header, "'Edit contacts' screen header")
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) # Get details of our test contacts. self.test_contacts = [MockContact() for i in range(2)] 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 our new contact. self.contacts.search("XXXX") # Verify our contact is listed. self.contacts.check_search_results(self.test_contacts[0]["givenName"], False) # Verify the other contact is NOT listed. self.contacts.check_search_results(self.test_contacts[1]["givenName"], False)
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 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 the sought contact. self.UTILS.reporting.logResult("info", "<b>Search against number in 'given name' field ...</b>") self.contacts.search(self.contact_list[1]["tel"]["value"]) self.contacts.check_search_results(self.contact_list[1]["givenName"])
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.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): # 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() # View the contact details. self.contacts.view_contact(self.contact['name']) # Edit the contact. self.contacts.press_edit_contact_button() # Check the items. self.UTILS.element.waitForElements(DOM.Contacts.edit_update_button, "Edit 'upate' button") x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Final screenshot", x)
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): 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"])
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 __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) self.gmail_user = self.UTILS.general.get_config_variable( "gmail_1_user", "common") self.gmail_passwd = self.UTILS.general.get_config_variable( "gmail_1_pass", "common") # 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() self.contacts.launch() self.contacts.import_gmail_login(self.gmail_user, self.gmail_passwd) self.num_gmail_contacts = len( self.marionette.find_elements(*DOM.Contacts.import_conts_list)) # Import them. self.contacts.import_all() self.apps.kill_all() self.contacts.launch() # Check all our contacts are in the list, both 'standard' ... 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 gmail contacts ... gmail_imported = ( DOM.Contacts.view_all_contact_specific_contact[0], DOM.Contacts.view_all_contact_specific_contact[1].format("roy")) contacts = self.UTILS.element.getElements(gmail_imported, "Gmail imported contacts") self.UTILS.test.test( len(contacts) == self.num_gmail_contacts, "All gmail contacts have been imported")
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 main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.contacts = Contacts(self) self.settings = Settings(self) self.test_contact = MockContact(givenName="QA", familyName="Automation") self.fxa_user = self.UTILS.general.get_config_variable("fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable("fxa_pass", "common") _ = setup_translations(self) self.expected_msg = _("This contact does not have either a phone number or an email address.") self.contacts.launch() self.contacts.start_create_new_contact() cont_fields = self.contacts.get_contact_fields() self.contacts.replace_str(cont_fields['givenName'], self.test_contact['givenName']) self.contacts.replace_str(cont_fields['familyName'], self.test_contact['familyName']) done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button") done_button.tap() 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 tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.open_address_book() elem = (DOM.Contacts.view_all_contact_specific_contact[ 0], DOM.Contacts.view_all_contact_specific_contact[1].format(self.test_contact["givenName"])) entry = self.UTILS.element.getElement(elem, "Contact in address book") entry.tap() time.sleep(5) self.marionette.switch_to_frame() title = self.UTILS.element.getElement(DOM.GLOBAL.modal_dialog_alert_title, "Error title") msg = self.UTILS.element.getElement(DOM.GLOBAL.modal_dialog_alert_msg, "Error message") self.UTILS.test.test(title.text == "Firefox Hello", "Error title matches") self.UTILS.test.test(msg.text == self.expected_msg, "Error message matches")
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")
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): 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 __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) self.gmail_user = self.UTILS.general.get_config_variable("gmail_1_user", "common") self.gmail_passwd = self.UTILS.general.get_config_variable("gmail_1_pass", "common") self.number_of_gmail_contacts = 2 # 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() self.contacts.launch() self.contacts.import_gmail_login(self.gmail_user, self.gmail_passwd) # Remember all the contacts in the list. # Import them. self.contacts.import_all() self.apps.kill_all() self.contacts.launch() # Check all our contacts are in the list, both 'standrd' ... 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 gmail contacts ... gmail_imported = (DOM.Contacts.view_all_contact_specific_contact[0], DOM.Contacts.view_all_contact_specific_contact[1].format("roy")) contacts = self.UTILS.element.getElements(gmail_imported, "Gmail imported contacts") self.UTILS.test.test(len(contacts) == self.number_of_gmail_contacts, "All gmail contacts has been imported") x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot and details", 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) # 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): 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() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() settings_btn = self.UTILS.element.getElement( DOM.Contacts.settings_button, "Settings button") settings_btn.tap() import_btn = self.UTILS.element.getElement( DOM.Contacts.import_contacts, "Import button") time.sleep(1) import_btn.tap() gmail_btn = self.UTILS.element.getElement(DOM.Contacts.gmail_button, "Gmail button") time.sleep(1) gmail_btn.tap() self.UTILS.reporting.logResult( "info", "Check that the gmail login frame is present ...") self.marionette.switch_to_frame() self.UTILS.element.waitForElements(DOM.Contacts.gmail_frame, "Gmail login iframe") time.sleep(1) cancel = self.UTILS.element.getElement( ('xpath', '//h1[contains(text(), "Google")]/..'), "Cancel icon") # TODO: Change this when ShadowDOM marionette bug fixed (Bug 1061698) cancel.tap(25, 25) self.UTILS.reporting.logResult( "info", "Check that the gmail login frame is no longer present ...") self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(DOM.Contacts.gmail_frame, "Gmail login iframe") self.UTILS.reporting.logResult( "info", "Check that the contacts app is now visible again ...") self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) self.UTILS.element.waitForElements(DOM.Contacts.import_contacts_header, "Import contacts header")
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 __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) self.gmail_user = self.UTILS.general.get_config_variable("gmail_1_user", "common") self.gmail_passwd = self.UTILS.general.get_config_variable("gmail_1_pass", "common") # 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() self.contacts.launch() self.contacts.import_gmail_login(self.gmail_user, self.gmail_passwd) self.contacts.import_toggle_select_contact(1) self.marionette.execute_script("document.getElementById('{}').click()".format(DOM.Contacts.import_import_btn[1])) time.sleep(1) self.apps.kill_all() time.sleep(2) self.contacts.launch() # Check our two 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") gmail_imported = (DOM.Contacts.view_all_contact_specific_contact[0], DOM.Contacts.view_all_contact_specific_contact[1].format("roy")) self.UTILS.element.waitForElements(gmail_imported, "Gmail imported contact") screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot and details", screenshot)
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): 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): 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.num1 = self.UTILS.general.get_config_variable( "phone_number", "custom") self.num2 = "621234567" 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.num1], "Test {} number.".format(self.num2)) self.messages.wait_for_message() # Tap the header to create a contact. self.messages.header_createContact() self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator) # Cancel the action. form_header = self.UTILS.element.getElement( DOM.Contacts.contact_form_header, "Contact form header") 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")
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 __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) 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") # 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): # Set up to use data connection. self.data_layer.connect_to_cell_data() self.contacts.launch() login_result = self.contacts.import_hotmail_login( self.hotmail_user, self.hotmail_passwd) # Login unsuccessful or no available contacts to import if not login_result: self.UTILS.test.test(False, "Login unsuccessful") self.UTILS.iframe.switchToFrame(*DOM.Contacts.hotmail_import_frame, via_root_frame=False) contact_list = self.UTILS.element.getElements( DOM.Contacts.import_conts_list, "Contact list") cont_count = len(contact_list) num_contacts = self.UTILS.element.getElement( DOM.Contacts.import_num_of_conts, "Number of contacts") self.UTILS.reporting.logResult( "info", "Detected message '{}'.".format(num_contacts.text)) self.UTILS.test.test(str(cont_count) in num_contacts.text, "'{}' contains the real count, which is {}.".\ format(num_contacts.text, cont_count))