コード例 #1
0
ファイル: test_30765.py プロジェクト: owdqa/owd_test_cases
class test_main(GaiaTestCase):
    def __init__(self, *args, **kwargs):
        kwargs['restart'] = True
        super(test_main, self).__init__(*args, **kwargs)

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.settings = Settings(self)

        self.gmail_user = self.UTILS.general.get_config_variable(
            "gmail_1_user", "common")
        self.gmail_passwd = self.UTILS.general.get_config_variable(
            "gmail_1_pass", "common")
        # Set up to use data connection.
        self.connect_to_network()

    def tearDown(self):
        os.system("adb shell rm sdcard/*.vcf > /dev/null 2>&1")
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.contacts.launch()
        self.contacts.import_gmail_login(self.gmail_user, self.gmail_passwd)

        # Log-in in Gmail and contacts imported
        x = self.UTILS.element.getElements(DOM.Contacts.import_conts_list,
                                           "Contact list", False)

        gmail_contacts = []
        for y in x:
            contact_name = y.get_attribute("data-search")
            if '#search#' not in contact_name:
                self.UTILS.reporting.logResult("info", "Adding '{}' to the list of available contacts.".\
                                               format(contact_name))
                gmail_contacts.append(contact_name)

        self.contacts.import_all()
        # Saving the number of contacts imported
        self.UTILS.element.waitForElements(("id", "statusMsg"),
                                           "x/y contact imported")
        banner = self.UTILS.element.getElement(
            DOM.Contacts.export_import_banner, "Updated x contacts")
        contacts_imported = banner.text

        # Exit contacts
        self.apps.kill_all()
        time.sleep(2)

        self.contacts.launch()
        self.contacts.export_sd_card()

        select_all_btn = self.UTILS.element.getElement(
            DOM.Contacts.action_select_all, "Select All")
        select_all_btn.tap()
        time.sleep(2)

        export_btn = self.UTILS.element.getElement(DOM.Contacts.select_action,
                                                   "Export button")
        export_btn.tap()

        # Check that there is a layer informing about the success export
        self.UTILS.element.waitForElements(("id", "statusMsg"),
                                           "x/y contact exported msg")
        banner = self.UTILS.element.getElement(
            DOM.Contacts.export_import_banner, "x/y contacts exported")
        contacts_exported = banner.text

        # Check that the number of contact imported/exported is the same
        self.UTILS.reporting.logResult(
            "info", "Contacts imported: {}".format(contacts_imported))
        self.UTILS.reporting.logResult(
            "info", "Contacts exported: {}".format(contacts_exported))
        self.UTILS.test.test(
            contacts_exported.split("/")[0] in contacts_imported,
            "OK, same contacts exported than imported")
コード例 #2
0
ファイル: test_30765.py プロジェクト: owdqa/owd_test_cases
class test_main(GaiaTestCase):

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

    def setUp(self):

        # Set up child objects...
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.settings = Settings(self)

        self.gmail_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
        self.gmail_passwd = self.UTILS.general.get_config_variable("gmail_1_pass", "common")
        # Set up to use data connection.
        self.connect_to_network()

    def tearDown(self):
        os.system("adb shell rm sdcard/*.vcf > /dev/null 2>&1")
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.contacts.launch()
        self.contacts.import_gmail_login(self.gmail_user, self.gmail_passwd)

        # Log-in in Gmail and contacts imported
        x = self.UTILS.element.getElements(DOM.Contacts.import_conts_list, "Contact list", False)

        gmail_contacts = []
        for y in x:
            contact_name = y.get_attribute("data-search")
            if '#search#' not in contact_name:
                self.UTILS.reporting.logResult("info", "Adding '{}' to the list of available contacts.".\
                                               format(contact_name))
                gmail_contacts.append(contact_name)

        self.contacts.import_all()
        # Saving the number of contacts imported
        self.UTILS.element.waitForElements(("id", "statusMsg"), "x/y contact imported")
        banner = self.UTILS.element.getElement(DOM.Contacts.export_import_banner, "Updated x contacts")
        contacts_imported = banner.text

        # Exit contacts
        self.apps.kill_all()
        time.sleep(2)

        self.contacts.launch()
        self.contacts.export_sd_card()

        select_all_btn = self.UTILS.element.getElement(DOM.Contacts.action_select_all, "Select All")
        select_all_btn.tap()
        time.sleep(2)

        export_btn = self.UTILS.element.getElement(DOM.Contacts.select_action, "Export button")
        export_btn.tap()

        # Check that there is a layer informing about the success export
        self.UTILS.element.waitForElements(("id", "statusMsg"), "x/y contact exported msg")
        banner = self.UTILS.element.getElement(DOM.Contacts.export_import_banner, "x/y contacts exported")
        contacts_exported = banner.text

        # Check that the number of contact imported/exported is the same
        self.UTILS.reporting.logResult("info", "Contacts imported: {}".format(contacts_imported))
        self.UTILS.reporting.logResult("info", "Contacts exported: {}".format(contacts_exported))
        self.UTILS.test.test(contacts_exported.split("/")[0] in contacts_imported, "OK, same contacts exported than imported")
コード例 #3
0
ファイル: test_28542.py プロジェクト: owdqa/owd_test_cases
class test_main(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.contacts = Contacts(self)
        self.settings = Settings(self)

        # Export some dummy contacts
        self.initial_population = 10
        self.test_contacts = [
            MockContact() for i in range(self.initial_population)
        ]
        map(self.UTILS.general.insertContact, self.test_contacts)

        # Delete all previous exportation, just in case
        os.system("adb shell rm sdcard/*.vcf > /dev/null 2>&1")
        self.contacts.launch()
        self.contacts.export_sd_card()

        select_all_btn = self.UTILS.element.getElement(
            DOM.Contacts.action_select_all, "Select All")
        select_all_btn.tap()
        export_btn = self.UTILS.element.getElement(DOM.Contacts.select_action,
                                                   "Export button")
        export_btn.tap()
        # Check that there is a layer informing about the success export
        self.UTILS.element.waitForElements(("id", "statusMsg"),
                                           "x/y contact exported msg")

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

        self.contacts.launch()
        self.contacts.delete_all_contacts()

        self.test_contact = MockContact()
        self.UTILS.general.insertContact(self.test_contact)
        self.apps.kill_all()
        time.sleep(2)

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

    def test_run(self):
        self.contacts.launch()
        settings_btn = self.UTILS.element.getElement(
            DOM.Contacts.settings_button, "Settings button")
        settings_btn.tap()

        import_btn = self.UTILS.element.getElement(
            DOM.Contacts.import_contacts, "Import contacts button")
        import_btn.tap()

        import_sd_btn = self.UTILS.element.getElement(
            DOM.Contacts.import_sd_btn, "Import from SD card button")
        time.sleep(1)
        import_sd_btn.tap()

        cancel_btn = self.UTILS.element.getElement(DOM.GLOBAL.cancel_overlay,
                                                   "Cancel the import")
        cancel_btn.tap()

        header = self.UTILS.element.getElement(
            DOM.Contacts.import_contact_header, "Go back btn")
        time.sleep(1)
        header.tap(25, 25)

        settings_done_button = self.UTILS.element.getElement(
            DOM.Contacts.settings_done_button,
            "Contacts app settings 'done' button")
        time.sleep(1)
        settings_done_button.tap()

        current_contact_number = len(
            self.marionette.find_elements(*DOM.Contacts.view_all_contact_list))
        self.UTILS.test.test(
            current_contact_number < self.initial_population,
            "After cancelling importation, the number of contacts remains the same"
        )
コード例 #4
0
ファイル: test_28542.py プロジェクト: owdqa/owd_test_cases
class test_main(GaiaTestCase):

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

        # Export some dummy contacts
        self.initial_population = 10
        self.test_contacts = [MockContact() for i in range(self.initial_population)]
        map(self.UTILS.general.insertContact, self.test_contacts)

        # Delete all previous exportation, just in case
        os.system("adb shell rm sdcard/*.vcf > /dev/null 2>&1")
        self.contacts.launch()
        self.contacts.export_sd_card()

        select_all_btn = self.UTILS.element.getElement(DOM.Contacts.action_select_all, "Select All")
        select_all_btn.tap()
        export_btn = self.UTILS.element.getElement(DOM.Contacts.select_action, "Export button")
        export_btn.tap()
        # Check that there is a layer informing about the success export
        self.UTILS.element.waitForElements(("id", "statusMsg"), "x/y contact exported msg")
        
        self.apps.kill_all()
        time.sleep(2)

        self.contacts.launch()
        self.contacts.delete_all_contacts()
        
        self.test_contact = MockContact()
        self.UTILS.general.insertContact(self.test_contact)
        self.apps.kill_all()
        time.sleep(2)

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

    def test_run(self):
        self.contacts.launch()
        settings_btn = self.UTILS.element.getElement(DOM.Contacts.settings_button, "Settings button")
        settings_btn.tap()

        import_btn = self.UTILS.element.getElement(DOM.Contacts.import_contacts, "Import contacts button")
        import_btn.tap()

        import_sd_btn = self.UTILS.element.getElement(DOM.Contacts.import_sd_btn, "Import from SD card button")
        time.sleep(1)
        import_sd_btn.tap()

        cancel_btn = self.UTILS.element.getElement(DOM.GLOBAL.cancel_overlay, "Cancel the import")
        cancel_btn.tap()

        header = self.UTILS.element.getElement(DOM.Contacts.import_contact_header, "Go back btn")
        time.sleep(1)
        header.tap(25, 25)

        settings_done_button = self.UTILS.element.getElement(
            DOM.Contacts.settings_done_button, "Contacts app settings 'done' button")
        time.sleep(1)
        settings_done_button.tap()

        current_contact_number = len(self.marionette.find_elements(*DOM.Contacts.view_all_contact_list))
        self.UTILS.test.test(current_contact_number < self.initial_population,
                             "After cancelling importation, the number of contacts remains the same")