本文整理汇总了Python中OWDTestToolkit.apps.contacts.Contacts.search方法的典型用法代码示例。如果您正苦于以下问题:Python Contacts.search方法的具体用法?Python Contacts.search怎么用?Python Contacts.search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OWDTestToolkit.apps.contacts.Contacts
的用法示例。
在下文中一共展示了Contacts.search方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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)
示例2: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [as 别名]
class test_main(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.contacts = Contacts(self)
self.contact = MockContact(tel=[{'type': 'Mobile', 'value': '111111111'},
{'type': 'Mobile', 'value': '222222222'}])
self.UTILS.general.insertContact(self.contact)
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(self.contact['name'])
self.contacts.select_search_result_several_phones(self.contact['name'],
self.contact['tel'][0]['value'], cancel=True)
示例3: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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_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 our new contact.
self.contacts.search(self.contact_list[0]["tel"]["value"])
# Verify that we're now in the 'search results' screen.
self.UTILS.element.waitForElements(DOM.Contacts.search_results_list, "Search results list")
# Cancel the search.
x = self.UTILS.element.getElement(DOM.Contacts.search_cancel_btn, "Cancel search button")
x.tap()
# Verify that we're no longer in the 'search results' screen.
self.UTILS.element.waitForNotElements(DOM.Contacts.search_results_list, "Search results list")
示例4: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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"])
示例5: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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)
示例6: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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 = 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()
# Select a contact.
self.contacts.search(self.contact["givenName"])
self.contacts.select_search_result(self.contact["givenName"])
# Tap on edit mode.
editBTN = self.UTILS.element.getElement(DOM.Contacts.edit_details_button, "Edit details button")
editBTN.tap()
self.UTILS.element.waitForElements(DOM.Contacts.edit_contact_header, "'Edit contacts' screen header")
示例7: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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)
示例8: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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_list = [MockContact(tel={'type': 'Mobile', 'value': "{}".format(i) * 9}) 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 our new contact.
self.contacts.search("999999999")
# Verify that there are no results.
self.UTILS.element.waitForElements(DOM.Contacts.search_no_contacts_found, "'No contacts found' message")
示例9: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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)
示例10: main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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)
示例11: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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()
示例12: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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()
示例13: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [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)
示例14: test_main
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [as 别名]
class test_main(GaiaTestCase):
def __init__(self, *args, **kwargs):
kwargs['restart'] = True
super(test_main, self).__init__(*args, **kwargs)
def setUp(self):
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.contacts = Contacts(self)
self.phones = ["177111111", "177222222", "133333333"]
self.given_names = ["Contact"] * len(self.phones)
self.family_names = map(str, range(1, len(self.phones) + 1))
self.test_contacts = [MockContact(tel={'type': 'Mobile', 'value': self.phones[i]},
givenName=self.given_names[i],
familyName=self.family_names[i],
name="{} {}".format(self.given_names[i], self.family_names[i]))
for i in range(len(self.phones))]
map(self.UTILS.general.insertContact, self.test_contacts)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.contacts.launch()
# Search for our new contact.
self.contacts.search("77")
# Verify our contact is listed.
conditions = [True, True, False]
names = [c["familyName"] for c in self.test_contacts]
map(self.contacts.check_search_results, names, conditions)
示例15: Messages
# 需要导入模块: from OWDTestToolkit.apps.contacts import Contacts [as 别名]
# 或者: from OWDTestToolkit.apps.contacts.Contacts import search [as 别名]
class Messages(object):
def __init__(self, parent):
self.apps = parent.apps
self.data_layer = parent.data_layer
self.parent = parent
self.marionette = parent.marionette
self.UTILS = parent.UTILS
self.actions = Actions(self.marionette)
@retry(5)
def launch(self):
self.app = self.apps.launch(self.__class__.__name__)
self.UTILS.element.waitForNotElements(DOM.GLOBAL.loading_overlay,
self.__class__.__name__ + " app - loading overlay")
return self.app
def cancelSettings(self):
self.UTILS.reporting.logResult("info", "Cliking on messages options button")
options_btn = self.UTILS.element.getElement(DOM.Messages.messages_options_btn,
"Messages option button is displayed")
options_btn.tap()
# Press cancel button
cancelBtn = self.UTILS.element.getElement(DOM.Messages.cancel_btn_msg,
"Press Cancel button")
cancelBtn.tap()
def deleteSubject(self, subject):
self.UTILS.reporting.logResult("info", "Cliking on messages options button")
x = self.UTILS.element.getElement(DOM.Messages.messages_options_btn,
"Messages option button is displayed")
x.tap()
# Press add subject button
self.UTILS.reporting.logResult("info", "Cliking on delete subject button")
x = self.UTILS.element.getElement(DOM.Messages.deletesubject_btn_msg_opt,
"delete subject option button is displayed")
x.tap()
def addSubject(self, subject):
self.UTILS.reporting.logResult("info", "Cliking on messages options button")
x = self.UTILS.element.getElement(DOM.Messages.messages_options_btn,
"Messages option button is displayed")
x.tap()
# Press add subject button
screenshot = self.UTILS.debug.screenShotOnErr()
self.UTILS.reporting.logResult('info', "Screenshot", screenshot)
self.UTILS.reporting.logResult("info", "Cliking on add subject button")
x = self.UTILS.element.getElement(DOM.Messages.addsubject_btn_msg_opt,
"add subject option button is displayed")
x.tap()
self.UTILS.general.typeThis(DOM.Messages.target_subject,
"Target Subject field",
subject,
p_no_keyboard=True,
p_validate=False,
p_clear=False,
p_enter=False)
def checkAirplaneModeWarning(self):
"""
Checks for the presence of the popup
warning message if you just sent a message
while in 'airplane mode' (also removes
the message so you can continue).
"""
x = self.UTILS.element.getElement(DOM.Messages.airplane_warning_message,
"Airplane mode warning message",
True, 5, False)
if x:
self.UTILS.reporting.logResult("info",
"Warning message title detected = '" + x.text + "'.")
x = self.UTILS.element.getElement(DOM.Messages.airplane_warning_ok, "OK button")
x.tap()
def check_last_message_contents(self, expected, mms=False):
"""
Get the last message text and check it against the expected value.
"""
msg = self.last_message_in_this_thread()
dom = DOM.Messages.last_message_mms_text if mms else DOM.Messages.last_message_text
msg_text = self.marionette.find_element(*dom, id=msg.id)
self.UTILS.test.test((msg_text and msg_text.text == expected),
u"Expected message text = '{}' ({}) (got '{}' ({})).".
format(expected, len(expected), msg_text.text, len(msg_text.text)))
def checkIsInToField(self, target, targetIsPresent=True):
"""
Verifies if a number (or contact name) is
displayed in the "To: " field of a compose message.<br>
(Uses 'caseless' search for this.)
"""
time.sleep(1)
x = self.UTILS.element.getElements(DOM.Messages.target_numbers, "'To:' field contents", False)
#.........这里部分代码省略.........