本文整理汇总了Python中OWDTestToolkit.apps.contacts.Contacts.check_search_results方法的典型用法代码示例。如果您正苦于以下问题:Python Contacts.check_search_results方法的具体用法?Python Contacts.check_search_results怎么用?Python Contacts.check_search_results使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OWDTestToolkit.apps.contacts.Contacts
的用法示例。
在下文中一共展示了Contacts.check_search_results方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [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 contacts.
self.contact_list = [MockContact() for i in range(3)]
map(self.UTILS.general.insertContact, self.contact_list)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Launch contacts app.
self.contacts.launch()
# Search for the sought contact.
self.UTILS.reporting.logResult("info", "<b>Search against number in 'given name' field ...</b>")
self.contacts.search(self.contact_list[1]["tel"]["value"])
self.contacts.check_search_results(self.contact_list[1]["givenName"])
示例2: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [as 别名]
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.contacts = Contacts(self)
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.contact = MockContact(tel={'type': '', 'value': self.phone_number})
self.UTILS.general.insertContact(self.contact)
self.UTILS.reporting.logComment("Using target telephone number " + self.contact["tel"]["value"])
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.messages.launch()
# Type a message containing the required string
self.messages.startNewSMS()
self.messages.enterSMSMsg("Test message")
# Search for our contact.
self.messages.selectAddContactButton()
self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
self.contacts.search("Knot A Match")
self.contacts.check_search_results("Knot A Match", False)
示例3: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [as 别名]
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.contacts = Contacts(self)
# Get details of our test contacts.
self.test_contacts = [MockContact() for i in range(2)]
map(self.UTILS.general.insertContact, self.test_contacts)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Launch contacts app.
self.contacts.launch()
# Search for our new contact.
self.contacts.search("XXXX")
# Verify our contact is listed.
self.contacts.check_search_results(self.test_contacts[0]["givenName"], False)
# Verify the other contact is NOT listed.
self.contacts.check_search_results(self.test_contacts[1]["givenName"], False)
示例4: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [as 别名]
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.contacts = Contacts(self)
# Get details of our test contacts.
self.test_contacts = [MockContact() for i in range(3)]
self.test_contacts[0]["givenName"] = "nameJohn"
self.beginningWord = "name"
map(self.UTILS.general.insertContact, self.test_contacts)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Launch contacts app.
self.contacts.launch()
# With name: Search for the sought contact.
self.contacts.search(self.beginningWord)
# With name: Verify our contact is listed.
self.contacts.check_search_results(self.test_contacts[0]["givenName"])
# With name: Verify the other contact is NOT listed.
self.contacts.check_search_results(self.test_contacts[1]["givenName"], False)
self.contacts.check_search_results(self.test_contacts[2]["givenName"], False)
示例5: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [as 别名]
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.contacts = Contacts(self)
# Create 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):
# Launch contacts app.
self.contacts.launch()
# Search for our new contact.
self.contacts.search(self.contact["tel"]["value"])
# Verify our contact is listed.
self.contacts.check_search_results(self.contact["givenName"], True)
示例6: main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [as 别名]
class main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.loop = Loop(self)
self.contacts = Contacts(self)
self.settings = Settings(self)
self.fxa_user = self.UTILS.general.get_config_variable("fxa_user", "common")
self.fxa_pass = self.UTILS.general.get_config_variable("fxa_pass", "common")
self.connect_to_network()
self.target_name = "QA"
self.test_contacts = [MockContact() for i in range(5)]
self.test_contacts[0]["givenName"] = self.target_name
self.test_contacts[0]["familyName"] = "Automation"
map(self.UTILS.general.insertContact, self.test_contacts)
# Clean start
if not self.loop.is_installed():
self.loop.install()
else:
self.loop.launch()
# If already logged in, logout
if not self.loop.wizard_or_login():
self.loop.open_settings()
self.loop.logout()
self.settings.launch()
self.settings.fxa()
self.settings.fxa_log_out()
self.apps.kill_all()
time.sleep(2)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# First, login
self.loop.launch()
result = self.loop.wizard_or_login()
if result:
self.loop.firefox_login(self.fxa_user, self.fxa_pass)
self.loop.allow_permission_ffox_login()
self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view")
self.loop.open_address_book()
self.contacts.search(self.target_name)
self.contacts.check_search_results(self.target_name)
示例7: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [as 别名]
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.contacts = Contacts(self)
self.gallery = Gallery(self)
self.test_num = self.UTILS.general.get_config_variable("phone_number", "custom")
self.cont = MockContact(tel={"type": "Mobile", "value": self.test_num})
self.UTILS.general.insertContact(self.cont)
self.UTILS.general.add_file_to_device('./tests/_resources/imga.jpg')
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.messages.launch()
self.messages.startNewSMS()
self.messages.enterSMSMsg("Test")
self.messages.create_mms_image()
self.gallery.click_on_thumbnail_at_position_mms(0)
# Search for our contact.
time.sleep(5)
self.messages.selectAddContactButton()
self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
self.contacts.search(self.cont["name"])
self.contacts.check_search_results(self.cont["name"])
result = self.UTILS.element.getElements(DOM.Contacts.search_results_list, "Contacts search results")
for contact in result:
if contact.text == self.cont["name"]:
contact.tap()
break
self.apps.switch_to_displayed_app()
# Now check the correct name is in the 'To' list.
self.messages.checkIsInToField(self.cont["name"])
self.messages.sendSMS()
示例8: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [as 别名]
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.contacts = Contacts(self)
# Prepare the contact we're going to insert.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.contact = MockContact(tel={'type': '', 'value': self.phone_number})
self.UTILS.general.insertContact(self.contact)
self.UTILS.reporting.logComment("Using target telephone number " + self.contact["tel"]["value"])
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Launch messages app.
self.messages.launch()
# Type a message containing the required string
self.messages.startNewSMS()
self.messages.enterSMSMsg("Test message")
# Search for our contact.
self.messages.selectAddContactButton()
self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
self.contacts.search(self.contact["name"])
self.contacts.check_search_results(self.contact["name"])
contact_list = self.UTILS.element.getElements(DOM.Contacts.search_results_list, "Contacts search results")
for c in contact_list:
if c.text == self.contact["name"]:
c.tap()
break
# Switch back to the sms iframe.
self.apps.switch_to_displayed_app()
# Now check the correct name is in the 'To' list.
self.messages.checkIsInToField(self.contact["name"])
self.messages.sendSMS()
示例9: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [as 别名]
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)
# Create test contacts.
self.test_contacts = [MockContact() for i in range(2)]
map(self.UTILS.general.insertContact, self.test_contacts)
self.new_given_name = "aaaaabbbbbccccaaaa"
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()
# Change the name to "aaaaabbbbbccccaaaa"
self.contacts.change_contact(self.test_contacts[0]['name'], "givenName",
self.new_given_name)
# Search for our new contact.
self.contacts.search("aaa")
# Verify our contact is listed.
self.contacts.check_search_results(self.new_given_name, True)
# Verify the other contact is NOT listed.
self.contacts.check_search_results(self.test_contacts[1]["givenName"], False)
示例10: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [as 别名]
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.contacts = Contacts(self)
# Get details of our test contacts.
self.contact = MockContact()
self.nameIncomplete = self.contact["givenName"][:4]
self.surnameIncomplete = self.contact["familyName"][:2]
name2 = self.nameIncomplete + "h"
fname2 = self.surnameIncomplete + "t"
self.contact2 = MockContact(givenName=name2, familyName=fname2)
self.contact3 = MockContact(givenName='John', familyName='Smith')
self.UTILS.general.insertContact(self.contact)
self.UTILS.general.insertContact(self.contact2)
self.UTILS.general.insertContact(self.contact3)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Launch contacts app.
self.contacts.launch()
# With nameIncomplete : Search for the sought contact.
self.contacts.search(self.nameIncomplete)
# With nameIncomplete: Verify our contact is listed.
self.contacts.check_search_results(self.contact["givenName"])
self.contacts.check_search_results(self.contact2["givenName"])
# With nameIncomplete: Verify the other contact is NOT listed.
self.contacts.check_search_results(self.contact3["givenName"], False)
# Enter one more letter.
self.UTILS.general.typeThis(DOM.Contacts.search_contact_input, "Search input", self.nameIncomplete + self.contact["givenName"][4],
p_no_keyboard=True, p_validate=False, p_clear=False, p_enter=False)
# Verify list updated.
self.contacts.check_search_results(self.contact["givenName"])
self.contacts.check_search_results(self.contact2["givenName"], False)
self.contacts.check_search_results(self.contact3["givenName"], False)
# Cancel search.
x = self.UTILS.element.getElement(DOM.Contacts.search_cancel_btn, "Search cancel button")
x.tap()
# With surnameIncomplete : Search for the sought contact.
self.contacts.search(self.surnameIncomplete)
# With surnameIncomplete: Verify our contact is listed.
self.contacts.check_search_results(self.contact["familyName"])
self.contacts.check_search_results(self.contact2["familyName"])
# With surnameIncomplete: Verify the other contact is NOT listed.
self.contacts.check_search_results(self.contact3["familyName"], False)
# Enter one more letter.
self.UTILS.general.typeThis(DOM.Contacts.search_contact_input, "Search input", self.surnameIncomplete + self.contact["familyName"][2],
p_no_keyboard=True, p_validate=False, p_clear=False, p_enter=False)
# Verify list updated.
self.contacts.check_search_results(self.contact["familyName"])
self.contacts.check_search_results(self.contact2["familyName"], False)
self.contacts.check_search_results(self.contact3["familyName"], False)
示例11: Messages
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [as 别名]
#.........这里部分代码省略.........
p_clear=False,
p_enter=True)
else:
self.UTILS.general.typeThis(DOM.Messages.target_numbers_empty,
"Target number field",
num,
p_no_keyboard=True,
p_validate=False,
p_clear=False,
p_enter=False)
input_area = self.UTILS.element.getElement(DOM.Messages.input_message_area, "Target number field")
input_area.tap()
n += 1
def addContactToField(self, contact_name):
self._search_for_contact(contact_name)
# Now check the correct name is in the 'To' list.
self.checkIsInToField(contact_name)
def _select_forward_option_for(self, element):
self.actions.long_press(element, 2).perform()
self.UTILS.reporting.logResult("info", "Clicking on forward button")
forward_option = self.UTILS.element.getElement(DOM.Messages.forward_btn_msg_opt, "Forward button is displayed")
forward_option.tap()
def _search_for_contact(self, contact_name):
self.contacts = Contacts(self.parent)
self.selectAddContactButton()
self.UTILS.iframe.switchToFrame(*DOM.Contacts.frame_locator)
self.contacts.search(contact_name)
self.contacts.check_search_results(contact_name)
results = self.UTILS.element.getElements(DOM.Contacts.search_results_list, "Contacts search results")
for result in results:
if result.text == contact_name:
result.tap()
break
# Switch back to the sms iframe.
self.apps.switch_to_displayed_app()
def forwardMessage(self, msg_type, target_telNum):
"""
Forwards the last message of the thread to a number
"""
self.UTILS.reporting.logResult('info', "The message type to forward is: {}".format(msg_type))
if msg_type == "sms" or msg_type == "mms":
self.UTILS.reporting.logResult("info", "Open {} option with longtap on it".format(msg_type))
last = self.last_message_in_this_thread()
body = self.marionette.find_element(*DOM.Messages.last_message_body, id=last.id)
self._select_forward_option_for(body)
elif msg_type == "mmssub":
self.UTILS.reporting.logResult("info", "Open mms with subject options with longtap on it")
mms_subject = self.UTILS.element.getElement(DOM.Messages.received_mms_subject, "Target MMS field")
self._select_forward_option_for(mms_subject)
else:
self.UTILS.reporting.logResult("info", "incorrect value received")
self.UTILS.test.test(False, "Incorrect value received")
示例12: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import check_search_results [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