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


Python Contacts.import_gmail_login方法代码示例

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


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

示例1: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import import_gmail_login [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

示例2: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import import_gmail_login [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")

        # 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)
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:57,代码来源:test_27043.py

示例3: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import import_gmail_login [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)

        # 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.")
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:34,代码来源:test_27037.py

示例4: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import import_gmail_login [as 别名]
class test_main(GaiaTestCase):

    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    _gmail_pseudo_locator = ("data-url", "google")

    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")

        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()
        self.contacts.import_gmail_login(self.gmail_user, self.gmail_passwd, False)

        # Cancel the login
        self.marionette.switch_to_frame()
        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.marionette.switch_to_frame()
        self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@{}, '{}')]".\
                                    format(self._gmail_pseudo_locator[0], self._gmail_pseudo_locator[1])),
                                   "Gmail login iframe")

        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.UTILS.element.waitForElements(DOM.Contacts.import_contacts_header, "Import contacts header")
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:44,代码来源:test_27038.py

示例5: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import import_gmail_login [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.keyboard = Keyboard(self.marionette)

        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.connect_to_network()

        # 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):
        self.contacts.launch()
        self.contacts.import_gmail_login(self.gmail_user, self.gmail_passwd)

        # Get the contacts.
        contact_list = self.UTILS.element.getElements(DOM.Contacts.import_conts_list, "Contact list")
        gmail_contacts = []
        for y in contact_list:
            gmail_contacts.append(y.get_attribute("data-search"))

        search_name = gmail_contacts[0][:gmail_contacts[0].index('@')]

        # Use the search bar to test ...
        self.marionette.execute_script("document.getElementById('search-start').click();")

        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.gmail_import_frame, via_root_frame=False)

        self.marionette.execute_script("""
        var getElementByXpath = function (path) {
            return document.evaluate(path, document, null, 9, null).singleNodeValue;
        };
        getElementByXpath("/html/body/section/section[2]/form/p/label").click();
        """)
        self.marionette.switch_to_frame()

        # Keyboard appears.
        self.UTILS.element.waitForElements(("xpath", "//iframe[contains(@{},'{}')]".\
                                    format(DOM.Keyboard.frame_locator[0], DOM.Keyboard.frame_locator[1])),
                                   "Keyboard")

        # Typing works and allows real-time filtering.
        self.UTILS.reporting.logResult("info", "Typing '{}' with the keyboard (without pressing ENTER) ...".\
                                        format(search_name))
        self.keyboard.send(search_name)

        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.gmail_import_frame, via_root_frame=False)
        after_search_count = self.UTILS.element.getElements(DOM.Contacts.import_search_list, "Search list")

        self.UTILS.test.test(len(after_search_count) == 1,
                        "After typing the name '{}' the search list contains 1 contact (out of {}).".\
                        format(search_name, len(gmail_contacts)))
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:72,代码来源:test_27039.py

示例6: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import import_gmail_login [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")

        # 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)

        # Check the Import button is disabled to begin with.
        x = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(x.get_attribute("disabled") == "true", "Import button is disabled.")

        # Tap the Select All button (can't be done with marionette yet).
        self.UTILS.reporting.logResult("info", "Tapping the 'Select All' button ...")
        self.marionette.execute_script("document.getElementById('{}').click()".\
                                       format(DOM.Contacts.import_select_all[1]))
        time.sleep(1)
        x = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(x.get_attribute("disabled") != "true", "Import button is enabled.")

        self.UTILS.reporting.logResult("info", "Tapping the 'Deselect All' button ...")
        self.marionette.execute_script("document.getElementById('{}').click()".\
                                       format(DOM.Contacts.import_desel_all[1]))
        time.sleep(1)
        x = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(x.get_attribute("disabled") == "true", "Import button is disabled.")

        # Now select one contact and press Deselect all...
        self.contacts.import_toggle_select_contact(1)
        x = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(x.get_attribute("disabled") != "true", "Import button is enabled.")

        self.UTILS.reporting.logResult("info", "Tapping the 'Deselect All' button ...")
        self.marionette.execute_script("document.getElementById('{}').click()".\
                                       format(DOM.Contacts.import_desel_all[1]))
        time.sleep(1)
        x = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(x.get_attribute("disabled") == "true", "Import button is disabled.")
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:65,代码来源:test_27042.py

示例7: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import import_gmail_login [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

示例8: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import import_gmail_login [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")

        # 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)

        # Check the Import button is disabled to begin with.
        x = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(x.get_attribute("disabled") == "true", "Import button is disabled.")
        """
        Select / de-select contacts and make sure Import button is enabled / disabled
        as expected.
        """

        self.UTILS.reporting.logResult("info", "Enable contact 1...")
        self.contacts.import_toggle_select_contact(1)

        x = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(x.get_attribute("disabled") != "true", "Import button is enabled.")

        self.UTILS.reporting.logResult("info", "Enable contact 2...")
        self.contacts.import_toggle_select_contact(2)

        x = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(x.get_attribute("disabled") != "true", "Import button is enabled.")

        self.UTILS.reporting.logResult("info", "Disable contact 2...")
        self.contacts.import_toggle_select_contact(2)

        x = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(x.get_attribute("disabled") != "true", "Import button is enabled.")

        self.UTILS.reporting.logResult("info", "Disable contact 1...")
        self.contacts.import_toggle_select_contact(1)

        x = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(x.get_attribute("disabled") == "true", "Import button is disabled.")

        x = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot and details", x)
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:69,代码来源:test_27040.py


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