Exemple #1
0
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.")
Exemple #2
0
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.")
Exemple #3
0
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)
Exemple #4
0
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))
Exemple #5
0
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))
Exemple #6
0
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)

        self.hotmail_user = self.UTILS.general.get_config_variable("hotmail_1_email", "common")
        self.hotmail_passwd = self.UTILS.general.get_config_variable("hotmail_1_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.connect_to_network()

        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

        # Check the Import button is disabled to begin with.
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.hotmail_import_frame, via_root_frame=False)
        import_btn = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(import_btn.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)

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

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

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

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

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

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

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

        result = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot and details", result)
Exemple #7
0
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.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.data_layer.remove_all_contacts()
        self.data_layer.connect_to_wifi()

        # 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()
        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)
        contact_list = self.UTILS.element.getElements(DOM.Contacts.import_conts_list, "Contact list")
        cont_number = 1
        i_counter = 0
        for i in contact_list:
            i_counter = i_counter + 1
            if "hotmail" in i.get_attribute("data-search").lower():
                cont_number = i_counter
                break

        self.contacts.import_toggle_select_contact(cont_number)
        self.marionette.execute_script("document.getElementById('{}').click()".\
                                       format(DOM.Contacts.import_import_btn[1]))

        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        import_header = self.UTILS.element.getElement(DOM.Contacts.import_contacts_header, "Import contacts header")
        time.sleep(1)
        # TODO: Change this when ShadowDOM marionette bug fixed (Bug 1061698)
        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 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")

        hotmail_imported = (DOM.Contacts.view_all_contact_specific_contact[0],
                                DOM.Contacts.view_all_contact_specific_contact[1].format("roy"))

        self.UTILS.element.waitForElements(hotmail_imported, "Hotmail imported contact")

        result = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot and details", result)
Exemple #8
0
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.data_layer.remove_all_contacts()
        self.data_layer.connect_to_wifi()

    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

        # Try to get the hotmail contact (use the first one if not).
        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_number = 1
        i_counter = 0
        for i in contact_list:
            i_counter = i_counter + 1
            if "hotmail" in i.get_attribute("data-search").lower():
                cont_number = i_counter
                break

        self.contacts.import_toggle_select_contact(cont_number)

        self.marionette.execute_script("document.getElementById('{}').click()".
                                       format(DOM.Contacts.import_import_btn[1]))

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

        import_header = self.UTILS.element.getElement(
            DOM.Contacts.import_contacts_header, "Import Contacts Header", True, 10, True)
        import_header.tap(25, 25)

        done = self.UTILS.element.getElement(DOM.Contacts.settings_done_button, "Done button", True, 10, True)
        self.UTILS.element.simulateClick(done)

        # Check our contact is in the list.
        hotmail_imported = (DOM.Contacts.view_all_contact_specific_contact[0],
                            DOM.Contacts.view_all_contact_specific_contact[1].format("roy"))

        self.UTILS.element.waitForElements(hotmail_imported, "Hotmail imported contact")

        result = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot and details", result)
Exemple #9
0
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.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.data_layer.remove_all_contacts()
        self.data_layer.connect_to_wifi()

        # 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()
        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)
        contact_list = self.UTILS.element.getElements(
            DOM.Contacts.import_conts_list, "Contact list")
        cont_number = 1
        i_counter = 0
        for i in contact_list:
            i_counter = i_counter + 1
            if "hotmail" in i.get_attribute("data-search").lower():
                cont_number = i_counter
                break

        self.contacts.import_toggle_select_contact(cont_number)
        self.marionette.execute_script("document.getElementById('{}').click()".\
                                       format(DOM.Contacts.import_import_btn[1]))

        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        import_header = self.UTILS.element.getElement(
            DOM.Contacts.import_contacts_header, "Import contacts header")
        time.sleep(1)
        # TODO: Change this when ShadowDOM marionette bug fixed (Bug 1061698)
        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 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")

        hotmail_imported = (
            DOM.Contacts.view_all_contact_specific_contact[0],
            DOM.Contacts.view_all_contact_specific_contact[1].format("roy"))

        self.UTILS.element.waitForElements(hotmail_imported,
                                           "Hotmail imported contact")

        result = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot and details",
                                       result)
Exemple #10
0
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)

        self.hotmail_user = self.UTILS.general.get_config_variable(
            "hotmail_1_email", "common")
        self.hotmail_passwd = self.UTILS.general.get_config_variable(
            "hotmail_1_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.connect_to_network()

        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

        # Check the Import button is disabled to begin with.
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.hotmail_import_frame,
                                        via_root_frame=False)
        import_btn = self.UTILS.element.getElement(
            DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(
            import_btn.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)

        result = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot and details",
                                       result)

        import_btn = self.UTILS.element.getElement(
            DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(
            import_btn.get_attribute("disabled") != "true",
            "Import button is enabled.")
        """
        The only way I can see to test that all contacts are selected is to toggle
        all of them and make sure the Import button is then disabled (because that
        means all of them were selected before the toggle).
        """
        contact_list = self.UTILS.element.getElements(
            ("class name", "block-item"), "Contacts list")
        for i in range(len(contact_list)):
            i_num = i + 1
            self.UTILS.reporting.logResult(
                "info", "Disable contact {} ...".format(i_num))
            self.contacts.import_toggle_select_contact(i_num)

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

        result = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot and details",
                                       result)
Exemple #11
0
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)

        self.hotmail_user = self.UTILS.general.get_config_variable("hotmail_1_email", "common")
        self.hotmail_passwd = self.UTILS.general.get_config_variable("hotmail_1_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.connect_to_network()

        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

        # Check the Import button is disabled to begin with.
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.hotmail_import_frame, via_root_frame=False)
        import_btn = self.UTILS.element.getElement(DOM.Contacts.import_import_btn, "Import button")
        self.UTILS.test.test(import_btn.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)

        result = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot and details", result)

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

        """
        The only way I can see to test that all contacts are selected is to toggle
        all of them and make sure the Import button is then disabled (because that
        means all of them were selected before the toggle).
        """
        contact_list = self.UTILS.element.getElements(("class name", "block-item"), "Contacts list")
        for i in range(len(contact_list)):
            i_num = i + 1
            self.UTILS.reporting.logResult("info", "Disable contact {} ...".format(i_num))
            self.contacts.import_toggle_select_contact(i_num)

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

        result = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screenshot and details", result)
Exemple #12
0
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.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.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()

        contact_list = self.UTILS.element.getElements(DOM.Contacts.view_all_contact_list, "Contacts list")
        contacts_before = len(contact_list)

        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)
        frame = self.marionette.find_element(*('id', 'fb-extensions'))
        self.marionette.switch_to_frame(frame)

        self.contacts.import_toggle_select_contact(1)
        time.sleep(1)

        header_close = self.UTILS.element.getElement(DOM.Contacts.hotmail_header, "Outlook header")
        time.sleep(1)
        self.UTILS.element.simulateClickAtPos(header_close, 25, 25)

        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.wait_for_element_displayed(*DOM.Contacts.import_contacts_header)
        import_header = self.marionette.find_element(*DOM.Contacts.import_contacts_header)
        time.sleep(1)
        import_header.tap(25, 25)

        done = self.UTILS.element.getElement(DOM.Contacts.settings_done_button, "Settings Done button")
        time.sleep(1)
        done.tap()

        contact_list = self.UTILS.element.getElements(DOM.Contacts.view_all_contact_list, "Contacts list")
        contacts_after = len(contact_list)

        self.UTILS.test.test(contacts_after == contacts_before,
                             "No more contacts were imported ({} before and {} after)."
                             .format(contacts_after, contacts_before))
Exemple #13
0
class test_main(GaiaTestCase):

    # Just to try and avoid the hotmail 'all your contacts are already imported' issue...
    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_1_email", "common")
        self.hotmail_passwd = self.UTILS.general.get_config_variable("hotmail_1_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.connect_to_network()

        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

        # Get the contacts.
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        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")
        hotmail_contacts = []
        for contact in contact_list:
            hotmail_contacts.append(self.marionette.find_element('css selector', 'strong', contact.id).text)

        search_name = hotmail_contacts[0]
        self.UTILS.reporting.debug("*** Hotmail contacts: {}".format(hotmail_contacts))

        # Use the search bar to test ...
        search_field = self.UTILS.element.getElement(DOM.Contacts.search_field, "Search field")
        self.UTILS.element.simulateClick(search_field)
    
        search_input = self.UTILS.element.getElement(DOM.Contacts.search_contact_input, "Search Contact input")
        self.UTILS.element.simulateClick(search_input)

        self.marionette.switch_to_frame()
        self.wait_for_element_displayed('css selector', 'iframe[src*=keyboard]', timeout=15)
        keyboard = self.marionette.find_element('css selector', 'iframe[src*=keyboard]')
        self.UTILS.test.test(keyboard, "ER1: Keyboard found after tapping search input")
        keyboard.send_keys(search_name)

        self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
        self.UTILS.iframe.switchToFrame(*DOM.Contacts.hotmail_import_frame, via_root_frame=False)
        search_input = self.UTILS.element.getElement(DOM.Contacts.search_contact_result_input,
                                                     "Search Contact results input")
        self.UTILS.test.test(search_input.get_attribute("value") == search_name, "ER2: Text and numbers in search box")

        after_search_count = self.UTILS.element.getElements(DOM.Contacts.search_results_list, "Search list")

        self.UTILS.test.test(len(after_search_count) == 1,
                        "ER3: After typing the name '{}' the search list contains 1 contact (out of {}).".\
                        format(search_name, len(hotmail_contacts)))
Exemple #14
0
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)