本文整理汇总了Python中OWDTestToolkit.apps.contacts.Contacts.export_sd_card方法的典型用法代码示例。如果您正苦于以下问题:Python Contacts.export_sd_card方法的具体用法?Python Contacts.export_sd_card怎么用?Python Contacts.export_sd_card使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OWDTestToolkit.apps.contacts.Contacts
的用法示例。
在下文中一共展示了Contacts.export_sd_card方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import export_sd_card [as 别名]
class test_main(GaiaTestCase):
def __init__(self, *args, **kwargs):
kwargs['restart'] = True
super(test_main, self).__init__(*args, **kwargs)
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.contacts = Contacts(self)
self.settings = Settings(self)
self.gmail_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
self.gmail_passwd = self.UTILS.general.get_config_variable("gmail_1_pass", "common")
# Set up to use data connection.
self.connect_to_network()
def tearDown(self):
os.system("adb shell rm sdcard/*.vcf > /dev/null 2>&1")
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.contacts.launch()
self.contacts.import_gmail_login(self.gmail_user, self.gmail_passwd)
# Log-in in Gmail and contacts imported
x = self.UTILS.element.getElements(DOM.Contacts.import_conts_list, "Contact list", False)
gmail_contacts = []
for y in x:
contact_name = y.get_attribute("data-search")
if '#search#' not in contact_name:
self.UTILS.reporting.logResult("info", "Adding '{}' to the list of available contacts.".\
format(contact_name))
gmail_contacts.append(contact_name)
self.contacts.import_all()
# Saving the number of contacts imported
self.UTILS.element.waitForElements(("id", "statusMsg"), "x/y contact imported")
banner = self.UTILS.element.getElement(DOM.Contacts.export_import_banner, "Updated x contacts")
contacts_imported = banner.text
# Exit contacts
self.apps.kill_all()
time.sleep(2)
self.contacts.launch()
self.contacts.export_sd_card()
select_all_btn = self.UTILS.element.getElement(DOM.Contacts.action_select_all, "Select All")
select_all_btn.tap()
time.sleep(2)
export_btn = self.UTILS.element.getElement(DOM.Contacts.select_action, "Export button")
export_btn.tap()
# Check that there is a layer informing about the success export
self.UTILS.element.waitForElements(("id", "statusMsg"), "x/y contact exported msg")
banner = self.UTILS.element.getElement(DOM.Contacts.export_import_banner, "x/y contacts exported")
contacts_exported = banner.text
# Check that the number of contact imported/exported is the same
self.UTILS.reporting.logResult("info", "Contacts imported: {}".format(contacts_imported))
self.UTILS.reporting.logResult("info", "Contacts exported: {}".format(contacts_exported))
self.UTILS.test.test(contacts_exported.split("/")[0] in contacts_imported, "OK, same contacts exported than imported")
示例2: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import export_sd_card [as 别名]
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")