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


Python Contacts.press_edit_contact_button方法代码示例

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


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

示例1: test_main

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

示例2: test_main

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

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)

        self.test_contact = MockContact()
        self.UTILS.general.insertContact(self.test_contact)
        self.email_1 = "[email protected]"
        self.email_2 = "[email protected]"

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.contacts.launch()
        self.contacts.view_contact(self.test_contact['name'])
        self.contacts.press_edit_contact_button()

        # Count the current email addresses.
        orig_count = self.contacts.count_email_addresses_while_editing()

        # Add a few email addresses.
        self.contacts.add_another_email_address(self.email_1)
        self.contacts.add_another_email_address(self.email_2)

        # Get the new count and check it's been updated
        new_count = self.contacts.count_email_addresses_while_editing()
        self.UTILS.test.test(new_count == orig_count + 2,
                             "After adding two email, there are three")

        update_btn = self.UTILS.element.getElement(DOM.Contacts.edit_update_button, "Update button")
        update_btn.tap()
        self.contacts.go_back_from_contact_details()
        self.contacts.view_contact(self.test_contact['name'])

        # Count the email fields.
        emails_elements = self.UTILS.element.getElements(DOM.Contacts.email_address_list, "Email addresses")
        emails = [elem.find_element(*('css selector', 'button b')).text for elem in emails_elements]

        self.UTILS.test.test(self.email_1 in emails, "Email 1 has been saved")
        self.UTILS.test.test(self.email_2 in emails, "Email 2 has been saved")
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:46,代码来源:test_26885.py

示例3: test_main

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

    def setUp(self):
        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()

        # View our contact.
        self.contacts.view_contact(self.contact['name'])

        # Edit our contact.
        self.contacts.press_edit_contact_button()

        # Delete our contact.
        self.contacts.press_delete_contact_button()

        # Cancel deletion.
        cancel_deletion = self.UTILS.element.getElement(DOM.Contacts.cancel_delete_btn, "Cancel button")
        cancel_deletion.tap()

        # Cancel contact edition
        self.contacts.press_cancel_edit_button()

        # Go back to contacts start page
        self.contacts.go_back_from_contact_details()

        # Now actually delete our contact.
        self.contacts.delete_contact(self.contact['name'])
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:42,代码来源:test_26899.py

示例4: test_main

# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import press_edit_contact_button [as 别名]
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):
        self.contacts.launch()
        self.contacts.view_contact(self.contact['name'])
        self.contacts.press_edit_contact_button()

        self.marionette.execute_script("document.getElementById('delete-contact').scrollIntoView();")
        self.marionette.execute_script("document.getElementById('contact-form-title').scrollIntoView();")

        x = self.UTILS.element.getElement(DOM.Contacts.delete_contact_btn, "Delete contact button")
        x.tap()

        x = self.UTILS.element.getElement(DOM.Contacts.confirm_delete_btn, "Confirmation button")
        y = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot at this point:", y)
        x.tap()

        self.UTILS.element.waitForElements(("xpath", "//p[text()='No contacts']"), "'No contacts' message")
        y = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot at this point:", y)
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:38,代码来源:test_26908.py

示例5: test_main

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

    _keyboard_frame_locator = (By.CSS_SELECTOR, '#keyboards iframe:not([hidden])')

    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)
        self.UTILS.general.add_file_to_device('./tests/_resources/contact_face.jpg')

    def tearDown(self):
        self.UTILS.general.remove_files()
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        # Launch contacts app.
        self.UTILS.reporting.logResult("info", "Setting up contact ...")
        self.contacts.launch()

        # View our contact.
        self.contacts.view_contact(self.contact['name'])

        # Edit our contact.
        self.contacts.press_edit_contact_button()

        self.UTILS.reporting.logResult("info", "Starting tests ...")

        self.check_field(True, "phone", "number_0", "number")
        self.check_field(True, "email", "email_0", "email")
        self.check_field(True, "address", "streetAddress_0", "streetAddress")

        # NOTE: for some reason the photo has to tested alone or it screws up the text tests.
        self.contacts.press_cancel_edit_button()
        self.contacts.press_edit_contact_button()
        self.contacts.add_gallery_image_to_contact(0)
        self.check_field(False, "photo", "thumbnail-action")

    def check_field(self, text, field_name, field_id, reset_btn_name=""):

        # Test a text field: default, with reset enabled, with reset disabled.

        # try to make sure the field is in view (pretty hideous, but it does the job!).
        try:
            self.marionette.execute_script("document.getElementById('" + field_id + "').scrollIntoView();")
            self.marionette.execute_script("document.getElementById('contact-form-title').scrollIntoView();")
        except:
            pass

        self.UTILS.reporting.logResult("info", " ")
        self.UTILS.reporting.logResult("info", "*** '" + field_name + "': default (before testing 'reset' mode) ... ***")
        self.check_kbd_appears(reset_btn_name, field_name, True) if text else self.check_photo_tap(True)

        self.UTILS.reporting.logResult("info", " ")
        self.UTILS.reporting.logResult("info", "*** '" + field_name + "': switching 'reset' mode ON ... ***")
        self.toggle_reset_button(field_name)
        self.check_kbd_appears(reset_btn_name, field_name, False) if text else self.check_photo_tap(False)

        self.UTILS.reporting.logResult("info", " ")
        self.UTILS.reporting.logResult("info", "*** '" + field_name + "': switching 'reset' mode OFF ... ***")
        self.toggle_reset_button(field_name)
        self.check_kbd_appears(reset_btn_name, field_name, True) if text else self.check_photo_tap(True)

        self.UTILS.reporting.logResult("info", " ")

    def toggle_reset_button(self, element):

        # Press reset button on the required fields ...
        reset_btn = DOM.Contacts.reset_field_css

        if element == "photo":
            x = self.UTILS.element.getElement(("css selector", reset_btn.format("thumbnail-action")), "Photo reset button")
            x.tap()

        if element == "phone":
            x = self.UTILS.element.getElement(("css selector", reset_btn.format("add-phone-0")), "Phone reset button")
            x.tap()

        if element == "email":
            x = self.UTILS.element.getElement(("css selector", reset_btn.format("add-email-0")), "Email reset button")
            x.tap()

        if element == "address":
            x = self.UTILS.element.getElement(("css selector", reset_btn.format("add-address-0")), "Address reset button")
            x.tap()

    def check_photo_tap(self, editable):
        time.sleep(1)

        # Check tapping photo (same link for add and edit)
        _comment = "Photo is " + ("not " if not editable else "")
        x = self.UTILS.element.getElement(DOM.Contacts.add_photo, "Photo")
        x.tap()
#.........这里部分代码省略.........
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:103,代码来源:test_26907.py

示例6: field_remove_toggle

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

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)

    def tearDown(self):
        self.UTILS.general.remove_files()
        self.UTILS.reporting.reportResults()

    def field_remove_toggle_test(self, contact, field_definition, item_nums=[0]):
        """
        Imports a contact, goes to the contact, edits it and tests the required 'remove' icon
        (on and then off).
        p_field_num: The number of the item, for example if there's >1 phone number, then '0' would
        be the first one etc... (defaults to zero in case there's only one item).
        """

        del_icon_locator = ("css selector", DOM.Contacts.reset_field_css.format(field_definition))

        if field_definition == "thumbnail-action":

            # The thumbnail is different from the rest.
            field_locator = DOM.Contacts.edit_image
        else:
            field_locator = ("xpath", "//div[@id='{}']/div".format(field_definition))

        # Get details of our test contacts.
        self.UTILS.reporting.logResult("info", "Setting up contact ...")
        self.UTILS.general.insertContact(contact)

        # Add image.
        self.UTILS.general.add_file_to_device('./tests/_resources/contact_face.jpg')
        self.contacts.launch()
        self.contacts.view_contact(contact['name'])
        self.contacts.press_edit_contact_button()
        self.contacts.add_gallery_image_to_contact(0)

        self.UTILS.reporting.logResult("info", "Starting tests ...")

        # Try to make sure this field section is in view (pretty hideous, but it does the job!).
        try:
            self.marionette.execute_script("document.getElementById('{}').scrollIntoView();".format(field_definition))
            self.marionette.execute_script("document.getElementById('contact-form-title').scrollIntoView();")
        except:
            pass

        x = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot at this point:", x)

        self.UTILS.general.checkMarionetteOK()
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)

        self.UTILS.reporting.logResult("info", "<b>For each of our items for this field, "\
                             "click the icon to set them to 'remove' ...</b>")
        for i in item_nums:
            x = self.UTILS.element.getElements(field_locator, "Field being tested (item {})".format(i))[i]
            self.UTILS.test.test("removed" not in x.get_attribute("class"),
                            "The item is NOT marked as temporarily removed.")

            x = self.UTILS.element.getElements(del_icon_locator, "Field reset button (item {})".format(i))[i]
            x.tap()

            x = self.UTILS.debug.screenShotOnErr()
            self.UTILS.reporting.logResult("info", "Screenshot at this point:", x)

            x = self.UTILS.element.getElements(field_locator, "Field being tested (item {})".format(i))[i]
            self.UTILS.test.test("removed" in x.get_attribute("class"), "The item IS now marked as temporarily removed.")

        self.UTILS.reporting.logResult("info", "<b>For each of our items for this field, "\
                             "click the icon to turn off 'remove' ...</b>")
        for i in item_nums:
            x = self.UTILS.element.getElements(del_icon_locator, "Field reset button (item {})".format(i))[i]
            x.tap()

            x = self.UTILS.debug.screenShotOnErr()
            self.UTILS.reporting.logResult("info", "Screenshot at this point:", x)

            x = self.UTILS.element.getElements(field_locator, "Field being tested (item {})".format(i))[i]
            self.UTILS.test.test("removed" not in x.get_attribute("class"),
                            "The item is now NOT marked as temporarily removed.")
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:84,代码来源:field_remove_toggle.py


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