当前位置: 首页>>代码示例>>Python>>正文


Python Contacts.import_all方法代码示例

本文整理汇总了Python中OWDTestToolkit.apps.contacts.Contacts.import_all方法的典型用法代码示例。如果您正苦于以下问题:Python Contacts.import_all方法的具体用法?Python Contacts.import_all怎么用?Python Contacts.import_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OWDTestToolkit.apps.contacts.Contacts的用法示例。


在下文中一共展示了Contacts.import_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import import_all [as 别名]
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)
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:61,代码来源:test_27056.py

示例2: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import import_all [as 别名]
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)
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:58,代码来源:test_27044.py

示例3: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import import_all [as 别名]
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")
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:70,代码来源:test_30765.py


注:本文中的OWDTestToolkit.apps.contacts.Contacts.import_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。