本文整理汇总了Python中OWDTestToolkit.apps.messages.Messages类的典型用法代码示例。如果您正苦于以下问题:Python Messages类的具体用法?Python Messages怎么用?Python Messages使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Messages类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_main
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.messages = Messages(self)
self.email = Email(self)
self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.emailAddy = self.UTILS.general.get_config_variable("gmail_2_email", "common")
self.connect_to_network()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.email.launch()
self.email.setup_account(self.email_user, self.email_address, self.email_pass)
# Create and send a new test message.
self.messages.launch()
test_msg = "Email address {} test at {}".format(self.emailAddy, time.time())
self.data_layer.send_sms(self.phone_number, test_msg)
self.UTILS.statusbar.wait_for_notification_toaster_detail(test_msg, timeout=120)
self.UTILS.statusbar.click_on_notification_detail(test_msg, DOM.Messages.frame_locator)
sms = self.messages.last_message_in_this_thread()
# Verify that the email address opens the email app.
link = sms.find_element("tag name", "a")
link.tap()
self.wait_for_element_displayed(*DOM.Messages.header_send_message_btn, timeout=30)
cancel = self.UTILS.element.getElement(DOM.Messages.contact_cancel_btn, "Cancel button")
cancel.tap()
# Go into edit mode.
edit_btn = self.UTILS.element.getElement(DOM.Messages.edit_messages_icon, "Edit button")
edit_btn.tap()
# Select Messages mode
select_msgs_btn = self.UTILS.element.getElement(DOM.Messages.edit_msgs_select_btn, "Select messages button")
select_msgs_btn.tap()
self.UTILS.element.waitForElements(DOM.Messages.edit_msgs_header, "Edit messages mode header")
# Verify that the email address does not open the email app.
sms = self.messages.last_message_in_this_thread()
link = sms.find_element("tag name", "a")
link.tap()
# Now try to find the email app iframe.
self.wait_for_element_not_displayed(*DOM.Messages.header_send_message_btn, timeout=30)
示例2: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(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.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
self.data_layer.delete_all_sms()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
# Create message - 5 x 10 chars.
timestamp = " {}".format(time.time())
sms_message = "0123456789" * 5 + timestamp
self.UTILS.reporting.logComment("Message length sent: {}".format((len(sms_message))))
self.UTILS.messages.create_incoming_sms(self.phone_number, sms_message)
self.UTILS.statusbar.wait_for_notification_toaster_detail(timestamp, timeout=120)
title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5)
self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)
self.messages.forwardMessageToMultipleRecipients("sms", self.phone_number, self.contact["name"])
示例3: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.video = Video(self)
# Establish which phone number to use.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.test_msg = "Hello World"
self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number)
self.data_layer.delete_all_sms()
def tearDown(self):
self.UTILS.general.remove_files()
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
self.messages.create_and_send_mms('video', [self.phone_number], self.test_msg)
self.messages.verify_mms_received("video", self.phone_number)
示例4: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.contacts = Contacts(self)
self.messages = Messages(self)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.contacts.launch()
self.messages.launch()
self.UTILS.home.touchHomeButton()
time.sleep(1)
self.UTILS.home.holdHomeButton()
self.UTILS.element.waitForElements(DOM.Home.cards_view, "App 'cards' list (task switcher)")
x = self.UTILS.debug.screenShotOnErr()
self.UTILS.reporting.logResult("info", "Screenshot:", x)
示例5: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
# Establish which phone number to use.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Launch messages app.
self.messages.launch()
# Start a new sms.
self.messages.startNewSMS()
# Enter a message the message area.
x = self.messages.enterSMSMsg("Test text.")
# Check the 'Send button isn't enabled yet.
x = self.UTILS.element.getElement(DOM.Messages.send_message_button, "Send message button")
self.UTILS.test.test(not x.is_enabled(),
"Send button is not enabled after message supplied, but target still empty.")
示例6: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
# Establish which phone number to use.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.msg = "Test {}".format(time.time())
self.cp_incoming_number = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
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()
self.UTILS.messages.create_incoming_sms(self.phone_number, self.msg)
self.UTILS.statusbar.wait_for_notification_toaster_detail(self.msg, timeout=120)
示例7: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(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()
"""
Send a message to create a thread (use number, not name as this
avoids some blocking bugs just now).
"""
self.messages.create_and_send_sms( [self.contact["tel"]["value"]], "Test message.")
returnedSMS = self.messages.wait_for_message()
# Examine the header.
self.UTILS.element.headerCheck(self.contact["name"])
示例8: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.gallery = Gallery(self)
self.settings = Settings(self)
self.test_msg = "Hello World"
# Establish which phone number to use.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number)
self.data_layer.delete_all_sms()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Configure Auto Retrieve as off from messaging settings
self.settings.launch()
self.settings.configure_mms_auto_retrieve("on_without_r")
send_time = self.messages.create_and_send_mms("image", [self.phone_number], self.test_msg)
self.messages.wait_for_message(send_time)
self.messages.verify_mms_received("img", self.phone_number)
示例9: test_main
class test_main(GaiaTestCase):
test_msg = "This text has multiple spaces 1 2 3 4 5."
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
# Remove number and import contact.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg)
self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120)
title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5)
self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)
# Check the receievd message.
self.messages.check_last_message_contents(self.test_msg)
示例10: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.gallery = Gallery(self)
timestamp = time.time()
self.test_msgs = ["Hello world {} at {}".format(i, timestamp) for i in range(3)]
# Establish which phone number to use.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number)
self.data_layer.delete_all_sms()
self.UTILS.statusbar.clearAllStatusBarNotifs()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
for msg in self.test_msgs:
self.messages.create_and_send_mms("image", [self.phone_number], msg)
self.messages.wait_for_message()
self.messages.closeThread()
self.messages.openThread(self.phone_number)
self.messages.deleteMessagesInThisThread()
示例11: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
# Import contact (adjust to the correct number).
self.telNum = self.UTILS.general.get_config_variable("phone_number", "custom")
self.UTILS.reporting.logComment("Using target telephone number " + self.telNum)
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Launch messages app.
self.messages.launch()
"""
Send a message to create a thread (use number, not name as this
avoids some blocking bugs just now).
"""
self.messages.create_and_send_sms([self.telNum], "Test message.")
returnedSMS = self.messages.wait_for_message()
示例12: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.actions = Actions(self.marionette)
# Establish which phone number to use.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)
self.data_layer.delete_all_sms()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
# Create message
timestamp = " {}".format(time.time())
sms_message = "0123456789" * 5 + timestamp
self.UTILS.reporting.logComment("Message length sent: {}".format((len(sms_message))))
self.UTILS.messages.create_incoming_sms(self.phone_number, sms_message)
self.UTILS.statusbar.wait_for_notification_toaster_detail(timestamp, timeout=120)
title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5)
self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)
self.messages.forwardMessage("sms", self.phone_number)
示例13: test_main
class test_main(GaiaTestCase):
test_msg = "Test message."
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
# Establish which phone number to use.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.cp_incoming_number = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)
self.data_layer.delete_all_sms()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
# Create and send a new test message.
self.UTILS.messages.create_incoming_sms(self.phone_number, self.test_msg)
self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120)
title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.cp_incoming_number, timeout=5)
self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)
self.messages.check_last_message_contents(self.test_msg)
示例14: test_main
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.messages = Messages(self)
self.Email = Email(self)
self.email_user = self.UTILS.general.get_config_variable("gmail_1_user", "common")
self.email_address = self.UTILS.general.get_config_variable("gmail_1_email", "common")
self.email_pass = self.UTILS.general.get_config_variable("gmail_1_pass", "common")
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.emailAddy = self.UTILS.general.get_config_variable("gmail_2_email", "common")
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
# Set up email account.
self.connect_to_network()
self.Email.launch()
self.Email.setup_account(self.email_user, self.email_address, self.email_pass)
# Launch messages app.
self.messages.launch()
# Create and send a new test message.
msg_text = "Email one [email protected], two {} , three [email protected] at {}".\
format(self.emailAddy, time.time())
self.data_layer.send_sms(self.phone_number, msg_text)
self.UTILS.statusbar.wait_for_notification_toaster_detail(msg_text, timeout=120)
self.UTILS.statusbar.click_on_notification_detail(msg_text, DOM.Messages.frame_locator)
sms = self.messages.last_message_in_this_thread()
time.sleep(1)
# Tap the 2nd email link.
self.UTILS.reporting.logResult("info", "Click the email address in this message: '{}'.".format(sms.text))
_link = sms.find_elements("tag name", "a")[1]
_link.tap()
# Click on "Send email" button from the overlay
send_btn = self.UTILS.element.getElement(DOM.Messages.header_send_email_btn, "Send email button")
send_btn.tap()
# Switch to email frame and verify the email address is in the To field.
self.UTILS.iframe.switchToFrame(*DOM.Email.frame_locator)
x = self.UTILS.element.getElement(DOM.Email.compose_to_from_contacts, "To field")
self.UTILS.test.test(x.text == self.emailAddy,
"To field contains '{}' (it was '{}').".format(self.emailAddy, self.emailAddy))
示例15: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.contacts = Contacts(self)
self.messages = Messages(self)
# Get details of our test contacts.
self.contact = MockContact(tel=[{'type': 'Mobile', 'value': '11111111'},
{'type': 'Mobile', 'value': '222222222'}])
"""
We're not testing adding a contact, so just stick one
into the database.
"""
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 our contact.
# View the details of our contact.
self.contacts.view_contact(self.contact['name'])
# Tap the 2nd sms button (index=1) in the view details screen to go to the sms page.
smsBTN = self.UTILS.element.getElement(("id", DOM.Contacts.sms_button_specific_id.format(1)),
"2nd send SMS button")
smsBTN.tap()
"""
Switch to the 'Messages' app frame (or marionette will still be watching the
'Contacts' app!).
"""
self.marionette.switch_to_frame()
self.UTILS.iframe.switchToFrame(*DOM.Messages.frame_locator)
time.sleep(3)
"""
test: this automatically opens the 'send SMS' screen, so
check the correct name is in the header of this sms.
"""
self.UTILS.element.headerCheck("1 recipient")
# Check this is the right number.
self.messages.checkIsInToField(self.contact["name"])
self.messages.checkNumberIsInToField(self.contact["tel"][1]["value"])