예제 #1
0
class test_main(GaiaTestCase):
    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)
        _ = setup_translations(self)

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.test_contact = MockContact()
        self.UTILS.general.insertContact(self.test_contact)

        # Generate an entry in the call log
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 1)

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

    def test_run(self):
        # Open the call log and add to our contact, cancelling the process
        self.dialer.callLog_addToContact(self.phone_number,
                                         self.test_contact["name"],
                                         cancel_process=True)

        # Check we're back in the call log.
        self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator)
        call_info_header = self.UTILS.element.getElement(
            DOM.Dialer.call_info_title, "Call info header")
        self.UTILS.test.test(call_info_header.text == self.phone_number,
                             "We are back to call info screen")
예제 #2
0
class test_main(GaiaTestCase):

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

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.phone_number2 = self.UTILS.general.get_config_variable("short_phone_number", "custom")

        self.test_contact = MockContact(tel={'type': 'Mobile', 'value': self.phone_number2})
        self.UTILS.general.insertContact(self.test_contact)

        # Generate an entry in the call log
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 1)

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

    def test_run(self):
        # Open the call log and add to our contact.
        self.dialer.callLog_addToContact(self.phone_number, self.test_contact["name"])

        # Verify that this contact has been modified in contacts.
        self.contacts.launch()
        self.contacts.view_contact(self.test_contact["name"])

        self.UTILS.element.waitForElements(("xpath", DOM.Contacts.view_contact_tels_xpath.format(self.phone_number)),
                                           "Telephone number {} in contact".format(self.phone_number))
예제 #3
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)
        _ = setup_translations(self)

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.test_contact = MockContact()
        self.UTILS.general.insertContact(self.test_contact)

        # Generate an entry in the call log
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 1)

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

    def test_run(self):
        # Open the call log and add to our contact, cancelling the process
        self.dialer.callLog_addToContact(self.phone_number, self.test_contact["name"], cancel_process=True)

        # Check we're back in the call log.
        self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator)
        call_info_header = self.UTILS.element.getElement(DOM.Dialer.call_info_title, "Call info header")
        self.UTILS.test.test(call_info_header.text == self.phone_number, "We are back to call info screen")
예제 #4
0
class test_main(GaiaTestCase):
    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)
        _ = setup_translations(self)

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.test_contact = MockContact()

        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 1)

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

    def test_run(self):
        self.dialer.callLog_createContact(self.phone_number)

        contFields = self.contacts.get_contact_fields()
        self.contacts.replace_str(contFields['givenName'],
                                  self.test_contact["givenName"])
        self.contacts.replace_str(contFields['familyName'],
                                  self.test_contact["familyName"])

        done_button = self.UTILS.element.getElement(DOM.Contacts.done_button,
                                                    "'Done' button")
        done_button.tap()

        # Verify that the contacts app is closed and we are returned to the call log.
        self.marionette.switch_to_frame()
        self.UTILS.element.waitForNotElements(
            ("xpath", "//iframe[contains(@{}, '{}')]".format(
                DOM.Contacts.frame_locator[0], DOM.Contacts.frame_locator[1])),
            "Contacts frame")
        self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator)

        header = ('xpath', DOM.GLOBAL.app_head_specific.format(_("Call log")))
        self.UTILS.element.waitForElements(header, "Call log header")

        # Verify that the call log now shows the contact name,
        x = self.UTILS.element.getElement(
            ("xpath", DOM.Dialer.call_log_number_xpath.format(
                self.phone_number)),
            "The call log for phone_number {}".format(self.phone_number))

        self.UTILS.test.test(
            self.test_contact["name"] in x.text,
            "Call log now shows '{}'.".format(self.test_contact["name"]))
예제 #5
0
class test_main(GaiaTestCase):
    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)

        num = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.test_contact = MockContact(tel={'type': 'Mobile', 'value': num})

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

    def test_run(self):
        self.dialer.launch()
        self.dialer.callLog_clearAll()

        self.dialer.createMultipleCallLogEntries(
            self.test_contact["tel"]["value"], 1)
        self.dialer.open_call_log()

        _number_el = DOM.Dialer.call_log_number_xpath.format(
            self.test_contact["tel"]["value"])
        elem = ('xpath', _number_el)
        self.UTILS.element.waitForElements(
            elem, "The number {} in the call log".format(
                self.test_contact["tel"]["value"]))
        self.UTILS.element.waitForNotElements(
            ("xpath", "{}//*[text()='{}']".format(_number_el,
                                                  self.test_contact["name"])),
            "The name {} in the call log".format(self.test_contact["name"]))

        screenshot = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult(
            "info",
            "Call log <i>before</i> adding contact details for this number:",
            screenshot)

        self.contacts.launch()
        self.contacts.create_contact(self.test_contact)

        self.dialer.launch()
        self.dialer.open_call_log()

        self.UTILS.element.waitForElements(
            ("xpath",
             DOM.Dialer.call_log_name_xpath.format(self.test_contact["name"])),
            "The name {} in the call log".format(self.test_contact["name"]))
        x = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult(
            "info",
            "Call log <i>after</i> adding contact details for this number:", x)
예제 #6
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)

        self.test_contact = MockContact(tel={'type': 'Mobile', 'value': "665666666"})

        # Generate an entry in the call log
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.test_contact["tel"]["value"], 1)

        # Create contact with image
        self.UTILS.general.add_file_to_device('./tests/_resources/contact_face.jpg')
        self.dialer.callLog_createContact(self.test_contact["tel"]["value"])

        contFields = self.contacts.get_contact_fields()
        self.contacts.replace_str(contFields['givenName'], self.test_contact["givenName"])
        self.contacts.replace_str(contFields['familyName'], self.test_contact["familyName"])

        self.contacts.add_gallery_image_to_contact(0)
        done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button")
        done_button.tap()

        time.sleep(1)
        self.apps.kill_all()
        time.sleep(2)

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

    def test_run(self):
        self.dialer.launch()
        self.dialer.open_call_log()

        entry = self.UTILS.element.getElement(("xpath",
                                               DOM.Dialer.call_log_number_xpath.format(self.test_contact["tel"]["value"])),
                                              "The call log for number {}".format(self.test_contact["tel"]["value"]))
        entry.tap()

        self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling)
        self.UTILS.element.waitForElements(("xpath", DOM.Dialer.outgoing_call_numberXP.format(self.test_contact["name"])),
                                           "Outgoing call found with number matching {}".format(self.test_contact["name"]))
        time.sleep(2)
        self.dialer.hangUp()
예제 #7
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)

        self.test_num = ["666666666666", "555555555555"]
        self.test_contacts = [MockContact(tel={'type': 'Mobile',
                                                'value': self.test_num[i]}) for i in range(2)]

        self.test_contacts[0]["givenName"] = "LongGivennamexxxxxxxxxxx"
        self.test_contacts[1]["familyName"] = "LongFamilynamexxxxxxxxxxx"
        """
        This has to be done due to a MockContact malfunction. It does not
        update the name field to the specified values of givenName and familyName
        """

        for c in self.test_contacts:
            c["name"] = c["givenName"] + " " + c["familyName"]

        map(self.UTILS.general.insertContact, self.test_contacts)

        self.dialer.launch()
        self.dialer.callLog_clearAll()

        for contact in self.test_contacts:
            self.dialer.createMultipleCallLogEntries(contact["tel"]["value"], 2)
        self.dialer.open_call_log()

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

    def test_run(self):

        entries = self.UTILS.element.getElements(DOM.Dialer.call_log_numbers, "Call log entries", False)
        self.UTILS.reporting.logResult("info", "{} entries found.".format(len(entries)))

        for entry in entries:
            item = entry.find_element("xpath", "//span[@class='primary-info-main']")

            value = self.UTILS.element.get_css_value(item, "text-overflow")

            isEllipsis = self.UTILS.element.is_ellipsis_active(item)

            self.UTILS.reporting.logResult("info", "Value of css property: {}".format(value))
            self.UTILS.reporting.logResult("info", "isEllipsisActive? {}".format(isEllipsis))
            self.UTILS.test.test(
                value == "ellipsis" and isEllipsis, "Long entry in call log displays the ellipsis (...)")
예제 #8
0
class test_main(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.dialer = Dialer(self)

        # Get details of our test contacts.

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.test_contact = MockContact(tel={
            'type': 'Mobile',
            'value': self.phone_number
        })
        self.UTILS.general.insertContact(self.test_contact)

        # Generate an entry in the call log for this contact
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 2)

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

    def test_run(self):
        kepad_option = self.UTILS.element.getElement(
            DOM.Dialer.option_bar_keypad, "Keypad Option")
        kepad_option.tap()

        call_btn = self.UTILS.element.getElement(DOM.Dialer.call_number_button,
                                                 "Call button")
        call_btn.tap()

        # Make sure that after tapping, we get the last outgoing call in the call log
        phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number,
                                                    "Phone number field",
                                                    False)
        dialer_num = phone_field.get_attribute("value")

        self.UTILS.test.test(
            self.test_contact["tel"]["value"] in dialer_num,
            "After calling '{}', and tapping call button, phone number field contains '{}'."
            .format(self.test_contact["tel"]["value"], dialer_num))

        y = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult(
            "info", "Screen shot of the result of tapping call button", y)
예제 #9
0
class test_main(GaiaTestCase):
    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.test_contact = MockContact(tel={
            'type': 'Mobile',
            'value': self.phone_number
        })

        self.UTILS.general.insertContact(self.test_contact)

        # Generate an entry in the call log
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 1)

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

    def test_run(self):
        self.dialer.open_call_log()

        self.dialer.callLog_long_tap(self.test_contact["tel"]["value"])
        call_info = self.UTILS.element.getElement(
            DOM.Dialer.call_log_numtap_call_info, "Call information button")
        call_info.tap()

        call_info_header = self.UTILS.element.getElement(
            DOM.Dialer.call_info_title, "Call info title")
        self.UTILS.test.test(
            call_info_header.text == self.test_contact['name'],
            'Header title matches with contact')

        go_to_contact_details_button = self.UTILS.element.getElement(
            DOM.Dialer.call_info_contact_go_to_contact_details,
            "Go to contact detail")

        self.UTILS.element.waitForElements(("xpath", "//button[contains(@class,'remark') and @data-tel='{}']".\
                                            format(self.test_contact["tel"]["value"])), "Highlighted number")

        screenshot = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Final screenshot:", screenshot)
예제 #10
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)
        _ = setup_translations(self)

        self.contact_1 = MockContact()
        self.phone_number = "0034" + self.UTILS.general.get_config_variable("target_call_number", "common")

        # Generate an entry in the call log
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 1)

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

    def test_run(self):

        # Open the call log and create a contact for our number.
        self.dialer.callLog_createContact(self.phone_number)

        contFields = self.contacts.get_contact_fields()
        self.contacts.replace_str(contFields['givenName'], self.contact_1["givenName"])
        self.contacts.replace_str(contFields['familyName'], self.contact_1["familyName"])

        done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button")
        done_button.tap()

        # Verify that the contacts app is closed and we are returned to the call log.
        self.marionette.switch_to_frame()
        self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@{}, '{}')]".
                                               format(DOM.Contacts.frame_locator[0], DOM.Contacts.frame_locator[1])),
                                              "Contacts frame")
        self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator)

        header = ('xpath', DOM.GLOBAL.app_head_specific.format(_("Call log")))
        self.UTILS.element.waitForElements(header, "Call log header")

        # Verify that this contact has been created in contacts.
        self.apps.kill_all()
        self.contacts.launch()
        self.contacts.view_contact(self.contact_1["name"])
예제 #11
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)
        _ = setup_translations(self)

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.test_contact = MockContact()

        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 1)

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

    def test_run(self):
        self.dialer.callLog_createContact(self.phone_number)

        contFields = self.contacts.get_contact_fields()
        self.contacts.replace_str(contFields['givenName'], self.test_contact["givenName"])
        self.contacts.replace_str(contFields['familyName'], self.test_contact["familyName"])

        done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button")
        done_button.tap()

        # Verify that the contacts app is closed and we are returned to the call log.
        self.marionette.switch_to_frame()
        self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@{}, '{}')]".
                                               format(DOM.Contacts.frame_locator[0], DOM.Contacts.frame_locator[1])),
                                              "Contacts frame")
        self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator)

        header = ('xpath', DOM.GLOBAL.app_head_specific.format(_("Call log")))
        self.UTILS.element.waitForElements(header, "Call log header")

        # Verify that the call log now shows the contact name,
        x = self.UTILS.element.getElement(("xpath", DOM.Dialer.call_log_number_xpath.format(self.phone_number)),
                                          "The call log for phone_number {}".format(self.phone_number))

        self.UTILS.test.test(self.test_contact["name"] in x.text, "Call log now shows '{}'.".
                             format(self.test_contact["name"]))
예제 #12
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")

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

    def test_run(self):
        self.dialer.launch()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 4)
        self.dialer.callLog_clearAll()
예제 #13
0
class test_main(GaiaTestCase):
    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")

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

    def test_run(self):
        self.dialer.launch()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 4)
        self.dialer.callLog_clearAll()
예제 #14
0
class test_main(GaiaTestCase):

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.dialer = Dialer(self)

        self.test_contacts = [MockContact() for i in range(3)]
        self.test_numbers = [self.test_contacts[i]["tel"]["value"] for i in range(len(self.test_contacts))]

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

    def _do_the_call(self, number):
        self.dialer.enterNumber(number, validate=False)
        self.dialer.call_this_number_and_hangup(5)

    def test_run(self):
        self.dialer.launch()

        # Delete all call log
        self.dialer.callLog_clearAll()

        # Call each number
        map(self._do_the_call, self.test_numbers)
        self.dialer.callLog_clearAll()

        # Go back to dialer keypad
        keypad_options = self.UTILS.element.getElement(DOM.Dialer.option_bar_keypad, "Keypad Option")
        keypad_options.tap()

        # Tap call button
        call_button = self.UTILS.element.getElement(DOM.Dialer.call_number_button, "Call button")
        call_button.tap()

        # Assert that nothing is presented in the input area
        phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field")
        dialer_num = phone_field.get_attribute("value")
        self.assertEqual(dialer_num, "", "Nothing in the input area")

        screenshot = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screen shot of the result of tapping call button", screenshot)      
예제 #15
0
class test_main(GaiaTestCase):
    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.dialer = Dialer(self)

        self.test_contacts = [MockContact() for i in range(3)]
        self.test_numbers = [
            self.test_contacts[i]["tel"]["value"]
            for i in range(len(self.test_contacts))
        ]

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

    def test_run(self):
        self.dialer.launch()

        # Delete all call log
        self.dialer.callLog_clearAll()

        # Call each number
        map(self._do_the_call, self.test_numbers)

        # Tapping call button
        call_button = self.UTILS.element.getElement(
            DOM.Dialer.call_number_button, "Call button")
        call_button.tap()

        # Make sure that after tapping, we get the last outgoing call in the call log
        dialed_num = self.marionette.execute_script(
            "return window.wrappedJSObject.KeypadManager._phoneNumber")
        self.UTILS.reporting.logResult(u'info',
                                       "Dialer num: {}".format(dialed_num))
        self.UTILS.test.test(
            str(self.test_contacts[-1]["tel"]["value"]) == dialed_num,
            "After calling several contacts, if we press 'Call' button, we get the last one's phone_number"
        )

    def _do_the_call(self, number):
        self.dialer.enterNumber(number, validate=False)
        self.dialer.call_this_number_and_hangup(5)
예제 #16
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)

        num = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.test_contact = MockContact(tel={'type': 'Mobile', 'value': num})

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

    def test_run(self):
        self.dialer.launch()
        self.dialer.callLog_clearAll()

        self.dialer.createMultipleCallLogEntries(self.test_contact["tel"]["value"], 1)
        self.dialer.open_call_log()

        _number_el = DOM.Dialer.call_log_number_xpath.format(self.test_contact["tel"]["value"])
        elem = ('xpath', _number_el)
        self.UTILS.element.waitForElements(elem,
                                           "The number {} in the call log".format(self.test_contact["tel"]["value"]))
        self.UTILS.element.waitForNotElements(("xpath", "{}//*[text()='{}']".
                                               format(_number_el, self.test_contact["name"])),
                                              "The name {} in the call log".format(self.test_contact["name"]))

        screenshot = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult(
            "info", "Call log <i>before</i> adding contact details for this number:", screenshot)

        self.contacts.launch()
        self.contacts.create_contact(self.test_contact)

        self.dialer.launch()
        self.dialer.open_call_log()

        self.UTILS.element.waitForElements(("xpath", DOM.Dialer.call_log_name_xpath.format(self.test_contact["name"])),
                                           "The name {} in the call log".format(self.test_contact["name"]))
        x = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Call log <i>after</i> adding contact details for this number:", x)
예제 #17
0
class test_main(GaiaTestCase):
    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")

        # Create a call log entry
        self.dialer.launch()
        self.dialer.callLog_clearAll()

        self.dialer.createMultipleCallLogEntries(self.phone_number, 2)

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

    def test_run(self):

        # Open the call log and select Add to Contact.
        self.dialer.open_call_log()

        edit_btn = self.UTILS.element.getElement(DOM.Dialer.call_log_edit_btn,
                                                 "Edit button")
        edit_btn.tap()

        # Now tap the number and verify that we're not taken to the menu,
        entry = self.UTILS.element.getElement(
            ("xpath", DOM.Dialer.call_log_number_xpath.format(
                self.phone_number)),
            "The call log for number {}".format(self.phone_number))
        entry.tap()

        self.UTILS.reporting.logResult(
            "info", "Checking that the call to [{}] is not set up".format(
                self.phone_number))
        self.apps.switch_to_displayed_app()
        self.UTILS.element.waitForNotElements(DOM.Dialer.hangup_bar_locator,
                                              "Not calling in edit mode",
                                              timeout=10)
예제 #18
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)
        _ = setup_translations(self)

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.test_contact = MockContact()
        self.UTILS.general.insertContact(self.test_contact)

        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 1)

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

    def test_run(self):
        self.dialer.callLog_addToContact(self.phone_number, self.test_contact["name"])

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

        # Re-open the call log and Verify that it now shows the contact name,
        self.marionette.switch_to_frame()
        self.UTILS.element.waitForNotElements(("xpath", "//iframe[contains(@{}, '{}')]".
                                               format(DOM.Contacts.frame_locator[0], DOM.Contacts.frame_locator[1])),
                                              "Contacts frame")

        self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator)
        header = ('xpath', DOM.GLOBAL.app_head_specific.format(_("Call log")))
        self.UTILS.element.waitForElements(header, "Call log header")

        x = self.UTILS.element.getElement(("xpath", DOM.Dialer.call_log_number_xpath.format(self.phone_number)),
                                          "The call log for number {}".format(self.phone_number))

        self.UTILS.test.test(
            self.test_contact["name"] in x.text, "Call log now shows '{}'".format(self.test_contact["name"]))
예제 #19
0
class test_main(GaiaTestCase):

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

        # Get details of our test contacts.

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.test_contact = MockContact(tel={'type': 'Mobile', 'value': self.phone_number})
        self.UTILS.general.insertContact(self.test_contact)

        # Generate an entry in the call log for this contact
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 2)

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

    def test_run(self):
        kepad_option = self.UTILS.element.getElement(DOM.Dialer.option_bar_keypad, "Keypad Option")
        kepad_option.tap()

        call_btn = self.UTILS.element.getElement(DOM.Dialer.call_number_button, "Call button")
        call_btn.tap()

        # Make sure that after tapping, we get the last outgoing call in the call log
        phone_field = self.UTILS.element.getElement(DOM.Dialer.phone_number, "Phone number field", False)
        dialer_num = phone_field.get_attribute("value")

        self.UTILS.test.test(self.test_contact["tel"]["value"] in dialer_num,
                             "After calling '{}', and tapping call button, phone number field contains '{}'.".
                             format(self.test_contact["tel"]["value"], dialer_num))

        y = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Screen shot of the result of tapping call button", y)
예제 #20
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.test_contact = MockContact(tel={'type': 'Mobile', 'value': self.phone_number})

        self.UTILS.general.insertContact(self.test_contact)

        # Generate an entry in the call log
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 1)

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

    def test_run(self):
        self.dialer.open_call_log()

        self.dialer.callLog_long_tap(self.test_contact["tel"]["value"])
        call_info = self.UTILS.element.getElement(DOM.Dialer.call_log_numtap_call_info, "Call information button")
        call_info.tap()

        call_info_header = self.UTILS.element.getElement(DOM.Dialer.call_info_title, "Call info title")
        self.UTILS.test.test(call_info_header.text == self.test_contact['name'], 'Header title matches with contact')

        go_to_contact_details_button = self.UTILS.element.getElement(DOM.Dialer.call_info_contact_go_to_contact_details, "Go to contact detail")

        self.UTILS.element.waitForElements(("xpath", "//button[contains(@class,'remark') and @data-tel='{}']".\
                                            format(self.test_contact["tel"]["value"])), "Highlighted number")

        screenshot = self.UTILS.debug.screenShotOnErr()
        self.UTILS.reporting.logResult("info", "Final screenshot:", screenshot)
예제 #21
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)

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

    def test_run(self):
        self.dialer.launch()
        self.dialer.callLog_clearAll()

        self.dialer.open_call_log()

        x = self.UTILS.element.getElement(DOM.Dialer.call_log_edit_btn, "Edit button", False)
        #Try with attribute aria-disabled
        self.UTILS.test.test(x.get_attribute("aria-disabled"), "The edit button is disabled.") 
예제 #22
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.phone_number_short = self.UTILS.general.get_config_variable("short_phone_number", "custom")

        # Remove the phone number from the contact and insert it.
        self.test_contact = MockContact(tel={'type': 'Mobile', 'value': self.phone_number})
        self.UTILS.general.insertContact(self.test_contact)

         # Generate an entry in the call log
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number_short, 1)

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

    def test_run(self):

        # Open the call log and add to our contact.
        self.dialer.callLog_addToContact(self.phone_number_short, self.test_contact["name"])

        # Verify that this number was added to the contact.
        self.apps.kill_all()
        time.sleep(2)
    
        self.contacts.launch()
        self.contacts.view_contact(self.test_contact["name"])

        self.UTILS.element.waitForElements(("xpath", DOM.Contacts.view_contact_tels_xpath.format(self.phone_number_short)),
                                    "New phone number {} in this contact".format(self.phone_number_short))
예제 #23
0
class test_main(GaiaTestCase):

    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)

        self.phone_number = self.UTILS.general.get_config_variable("target_call_number", "common")
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(self.phone_number, 1)

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

    def test_run(self):
        # Open the call log and tap on the phone_number.
        self.dialer.open_call_log()
        self.dialer.callLog_call(self.phone_number)
        time.sleep(3)
        self.dialer.hangUp()
예제 #24
0
class test_main(GaiaTestCase):
    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)

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

    def test_run(self):
        self.dialer.launch()
        self.dialer.callLog_clearAll()

        self.dialer.open_call_log()

        x = self.UTILS.element.getElement(DOM.Dialer.call_log_edit_btn,
                                          "Edit button", False)
        #Try with attribute aria-disabled
        self.UTILS.test.test(x.get_attribute("aria-disabled"),
                             "The edit button is disabled.")
예제 #25
0
class test_main(GaiaTestCase):
    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)
        self.contacts = Contacts(self)

        self.test_contact = MockContact(tel={
            'type': 'Mobile',
            'value': "665666666"
        })

        # Generate an entry in the call log
        self.dialer.launch()
        self.dialer.callLog_clearAll()
        self.dialer.createMultipleCallLogEntries(
            self.test_contact["tel"]["value"], 1)

        # Create contact with image
        self.UTILS.general.add_file_to_device(
            './tests/_resources/contact_face.jpg')
        self.dialer.callLog_createContact(self.test_contact["tel"]["value"])

        contFields = self.contacts.get_contact_fields()
        self.contacts.replace_str(contFields['givenName'],
                                  self.test_contact["givenName"])
        self.contacts.replace_str(contFields['familyName'],
                                  self.test_contact["familyName"])

        self.contacts.add_gallery_image_to_contact(0)
        done_button = self.UTILS.element.getElement(DOM.Contacts.done_button,
                                                    "'Done' button")
        done_button.tap()

        time.sleep(1)
        self.apps.kill_all()
        time.sleep(2)

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

    def test_run(self):
        self.dialer.launch()
        self.dialer.open_call_log()

        entry = self.UTILS.element.getElement(
            ("xpath",
             DOM.Dialer.call_log_number_xpath.format(
                 self.test_contact["tel"]["value"])),
            "The call log for number {}".format(
                self.test_contact["tel"]["value"]))
        entry.tap()

        self.UTILS.iframe.switchToFrame(*DOM.Dialer.frame_locator_calling)
        self.UTILS.element.waitForElements(
            ("xpath",
             DOM.Dialer.outgoing_call_numberXP.format(
                 self.test_contact["name"])),
            "Outgoing call found with number matching {}".format(
                self.test_contact["name"]))
        time.sleep(2)
        self.dialer.hangUp()
예제 #26
0
class test_main(GaiaTestCase):
    def setUp(self):
        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.dialer = Dialer(self)

        self.test_num = ["666666666666", "555555555555"]
        self.test_contacts = [
            MockContact(tel={
                'type': 'Mobile',
                'value': self.test_num[i]
            }) for i in range(2)
        ]

        self.test_contacts[0]["givenName"] = "LongGivennamexxxxxxxxxxx"
        self.test_contacts[1]["familyName"] = "LongFamilynamexxxxxxxxxxx"
        """
        This has to be done due to a MockContact malfunction. It does not
        update the name field to the specified values of givenName and familyName
        """

        for c in self.test_contacts:
            c["name"] = c["givenName"] + " " + c["familyName"]

        map(self.UTILS.general.insertContact, self.test_contacts)

        self.dialer.launch()
        self.dialer.callLog_clearAll()

        for contact in self.test_contacts:
            self.dialer.createMultipleCallLogEntries(contact["tel"]["value"],
                                                     2)
        self.dialer.open_call_log()

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

    def test_run(self):

        entries = self.UTILS.element.getElements(DOM.Dialer.call_log_numbers,
                                                 "Call log entries", False)
        self.UTILS.reporting.logResult(
            "info", "{} entries found.".format(len(entries)))

        for entry in entries:
            item = entry.find_element("xpath",
                                      "//span[@class='primary-info-main']")

            value = self.UTILS.element.get_css_value(item, "text-overflow")

            isEllipsis = self.UTILS.element.is_ellipsis_active(item)

            self.UTILS.reporting.logResult(
                "info", "Value of css property: {}".format(value))
            self.UTILS.reporting.logResult(
                "info", "isEllipsisActive? {}".format(isEllipsis))
            self.UTILS.test.test(
                value == "ellipsis" and isEllipsis,
                "Long entry in call log displays the ellipsis (...)")