本文整理汇总了Python中OWDTestToolkit.apps.contacts.Contacts.create_contact方法的典型用法代码示例。如果您正苦于以下问题:Python Contacts.create_contact方法的具体用法?Python Contacts.create_contact怎么用?Python Contacts.create_contact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OWDTestToolkit.apps.contacts.Contacts
的用法示例。
在下文中一共展示了Contacts.create_contact方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import create_contact [as 别名]
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.contacts = Contacts(self)
# Create test contact.
self.contact = MockContact()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Launch contacts app.
self.contacts.launch()
# Create our contact.
self.contacts.create_contact(self.contact)
# Verify our contact details.
self.contacts.check_view_contact_details(self.contact)
示例2: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import create_contact [as 别名]
class test_main(GaiaTestCase):
test_msg = "Test."
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.contacts = Contacts(self)
self.gallery = Gallery(self)
# Import contact (adjust to the correct number).
self.test_num = self.UTILS.general.get_config_variable("phone_number", "custom")
self.cont = MockContact(tel={"type": "Mobile", "value": self.test_num})
self.UTILS.reporting.logComment("Using target telephone number " + self.cont["tel"]["value"])
def tearDown(self):
self.UTILS.general.remove_files()
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.general.add_file_to_device('./tests/_resources/imgd.jpg')
# Launch messages app.
self.messages.launch()
# Create a new SMS
self.messages.startNewSMS()
# Insert the phone number in the To field
self.messages.addNumbersInToField([self.test_num])
# Create MMS.
self.messages.enterSMSMsg(self.test_msg)
self.messages.create_mms_image()
self.gallery.click_on_thumbnail_at_position_mms(0)
# Click send and wait for the message to be received
self.messages.sendSMS()
send_time = self.messages.last_sent_message_timestamp()
"""
Open contacts app and create a contact with the same phone number used to send the MMS in the
previous step
"""
self.contacts.launch()
self.contacts.create_contact(self.cont)
# Switch back to the messages app.
self.UTILS.home.goHome()
self.messages.launch()
# Verify the thread now contains the name of the contact instead of the phone number
self.UTILS.reporting.logComment("Trying to open the thread with name: " + self.cont["name"])
self.messages.openThread(self.cont["name"])
self.messages.wait_for_message(send_time)
示例3: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import create_contact [as 别名]
class test_main(GaiaTestCase):
test_msg = "Test."
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.contacts = Contacts(self)
# Import contact (adjust to the correct number).
self.test_num = self.UTILS.general.get_config_variable("phone_number", "custom")
self.cont = MockContact(tel={"type": "Mobile", "value": self.test_num})
self.UTILS.reporting.logComment("Using target telephone number " + self.cont["tel"]["value"])
self.data_layer.delete_all_sms()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Launch messages app.
self.messages.launch()
# Create a new SMS
self.messages.startNewSMS()
# Insert the phone number in the To field
self.messages.addNumbersInToField([self.test_num])
# Create SMS.
self.messages.enterSMSMsg(self.test_msg)
# Click send and wait for the message to be received
self.messages.sendSMS()
self.messages.wait_for_message()
self.messages.go_back()
"""
Open contacts app and create a contact with the same phone number used to send the SMS in the
previous step
"""
self.contacts.launch()
self.contacts.create_contact(self.cont)
# Switch back to the messages app.
# self.UTILS.app.switchToApp("Messages")
self.messages.launch()
# Verify the thread now contains the name of the contact instead of the phone number
self.UTILS.reporting.logComment("Trying to open the thread with name: " + self.cont["name"])
self.messages.openThread(self.cont["name"])
示例4: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import create_contact [as 别名]
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)
示例5: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import create_contact [as 别名]
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.contacts = Contacts(self)
self.contact = MockContact(tel={'type': 'Mobile', 'value': '123111111'})
self.contact2 = MockContact(tel={'type': 'Mobile', 'value': '123222222'})
self.UTILS.general.insertContact(self.contact2)
def tearDown(self):
self.UTILS.general.remove_files()
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Store our picture on the device.
self.UTILS.general.add_file_to_device('./tests/_resources/contact_face.jpg')
# Create and verify contact
self.contacts.launch()
self.contacts.create_contact(self.contact, "gallery")
self.contacts.verify_image_in_all_contacts(self.contact['name'])
# Search for our contacts.
self.contacts.search("test")
self.contacts.check_search_results(self.contact["givenName"])
self.contacts.check_search_results(self.contact2["givenName"])
# Verify that the image is present for the right contact.
results_list = self.UTILS.element.getElements(DOM.Contacts.search_results_list, "Search results")
tuples = zip(results_list, [self.contact, self.contact2], [True, False])
for t in tuples:
ok = self.verify_img_for_contact(t[0], t[1], t[2])
self.UTILS.test.test(ok, "Image was {}found (Expected: {})".format("" if ok else "not ", t[2]))
screenshot = self.UTILS.debug.screenShotOnErr()
self.UTILS.reporting.logResult("info", "Screenshot of search results", screenshot)
def verify_img_for_contact(self, result, contact, expect_image):
"""Verify if an image is present for the result list item.
The result item must be the specified by contact.
Return True if the contact has a image and expected_image is True.
False otherwise.
"""
found = False
if result.get_attribute("data-order") == contact["name"].replace(" ", "").upper():
try:
img = result.find_element("css selector", "li.contact-item[data-order*='{}'] span[data-type=img]".\
format(contact['givenName']))
if "blob" in img.get_attribute("data-src"):
found = True
except:
self.UTILS.reporting.logResult("info", "No image present for contact {} |"\
" The image was indeed expected".format(result.text))
else:
self.UTILS.test.test(False, "This contact does not appear in the list: {}".format(result.text))
res = found == expect_image
return res