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): 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 __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 __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") # Set up to use data connection. self.connect_to_network() def tearDown(self): os.system("adb shell rm sdcard/*.vcf > /dev/null 2>&1") self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() self.contacts.import_gmail_login(self.gmail_user, self.gmail_passwd) # Log-in in Gmail and contacts imported x = self.UTILS.element.getElements(DOM.Contacts.import_conts_list, "Contact list", False) gmail_contacts = [] for y in x: contact_name = y.get_attribute("data-search") if '#search#' not in contact_name: self.UTILS.reporting.logResult("info", "Adding '{}' to the list of available contacts.".\ format(contact_name)) gmail_contacts.append(contact_name) self.contacts.import_all() # Saving the number of contacts imported self.UTILS.element.waitForElements(("id", "statusMsg"), "x/y contact imported") banner = self.UTILS.element.getElement( DOM.Contacts.export_import_banner, "Updated x contacts") contacts_imported = banner.text # Exit contacts self.apps.kill_all() time.sleep(2) self.contacts.launch() self.contacts.export_sd_card() select_all_btn = self.UTILS.element.getElement( DOM.Contacts.action_select_all, "Select All") select_all_btn.tap() time.sleep(2) export_btn = self.UTILS.element.getElement(DOM.Contacts.select_action, "Export button") export_btn.tap() # Check that there is a layer informing about the success export self.UTILS.element.waitForElements(("id", "statusMsg"), "x/y contact exported msg") banner = self.UTILS.element.getElement( DOM.Contacts.export_import_banner, "x/y contacts exported") contacts_exported = banner.text # Check that the number of contact imported/exported is the same self.UTILS.reporting.logResult( "info", "Contacts imported: {}".format(contacts_imported)) self.UTILS.reporting.logResult( "info", "Contacts exported: {}".format(contacts_exported)) self.UTILS.test.test( contacts_exported.split("/")[0] in contacts_imported, "OK, same contacts exported than imported")
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.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_list = [MockContact() for i in range(2)] self.contact_list[1]['email'] = {} map(self.UTILS.general.insertContact, self.contact_list) # Set up to use data connection. self.connect_to_network() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() self.contacts.import_gmail_login(self.gmail_user, self.gmail_passwd) contact_list = self.UTILS.element.getElements( DOM.Contacts.import_conts_list, "Contact list", False) gmail_contacts = [] for c in contact_list: contact_name = c.get_attribute("data-search") if '#search#' not in contact_name: self.UTILS.reporting.logResult( "info", "Adding '{}' to the list of available contacts.".format( contact_name)) gmail_contacts.append(contact_name) self.contacts.import_all() self.apps.kill_all() self.contacts.launch() self.UTILS.reporting.logResult( "info", "Viewing contact '{}' ...".format(gmail_contacts[0])) self.contacts.view_contact("*****@*****.**", False) edit_btn = self.UTILS.element.getElement( DOM.Contacts.edit_details_button, "Edit details button") edit_btn.tap() self.UTILS.element.waitForElements(DOM.Contacts.edit_contact_header, "'Edit contacts' screen header") # Enter the new contact details. contact_fields = self.contacts.get_contact_fields() self.contacts.replace_str(contact_fields['givenName'], self.contact_list[1]["givenName"]) self.contacts.replace_str(contact_fields['familyName'], self.contact_list[1]["familyName"]) self.contacts.replace_str(contact_fields['tel'], self.contact_list[1]["tel"]["value"]) self.contacts.replace_str( contact_fields['street'], self.contact_list[1]["addr"]["streetAddress"]) self.contacts.replace_str(contact_fields['zip'], self.contact_list[1]["addr"]["postalCode"]) self.contacts.replace_str(contact_fields['city'], self.contact_list[1]["addr"]["locality"]) self.contacts.replace_str(contact_fields['country'], self.contact_list[1]["addr"]["countryName"]) # Save the changes update_btn = self.UTILS.element.getElement( DOM.Contacts.edit_update_button, "Edit 'update' button") update_btn.tap() 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): 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): 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") # Set up to use data connection. self.connect_to_network() def tearDown(self): os.system("adb shell rm sdcard/*.vcf > /dev/null 2>&1") self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.contacts.launch() self.contacts.import_gmail_login(self.gmail_user, self.gmail_passwd) # Log-in in Gmail and contacts imported x = self.UTILS.element.getElements(DOM.Contacts.import_conts_list, "Contact list", False) gmail_contacts = [] for y in x: contact_name = y.get_attribute("data-search") if '#search#' not in contact_name: self.UTILS.reporting.logResult("info", "Adding '{}' to the list of available contacts.".\ format(contact_name)) gmail_contacts.append(contact_name) self.contacts.import_all() # Saving the number of contacts imported self.UTILS.element.waitForElements(("id", "statusMsg"), "x/y contact imported") banner = self.UTILS.element.getElement(DOM.Contacts.export_import_banner, "Updated x contacts") contacts_imported = banner.text # Exit contacts self.apps.kill_all() time.sleep(2) self.contacts.launch() self.contacts.export_sd_card() select_all_btn = self.UTILS.element.getElement(DOM.Contacts.action_select_all, "Select All") select_all_btn.tap() time.sleep(2) export_btn = self.UTILS.element.getElement(DOM.Contacts.select_action, "Export button") export_btn.tap() # Check that there is a layer informing about the success export self.UTILS.element.waitForElements(("id", "statusMsg"), "x/y contact exported msg") banner = self.UTILS.element.getElement(DOM.Contacts.export_import_banner, "x/y contacts exported") contacts_exported = banner.text # Check that the number of contact imported/exported is the same self.UTILS.reporting.logResult("info", "Contacts imported: {}".format(contacts_imported)) self.UTILS.reporting.logResult("info", "Contacts exported: {}".format(contacts_exported)) self.UTILS.test.test(contacts_exported.split("/")[0] in contacts_imported, "OK, same contacts exported than imported")