This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from gnaneswar/Bug-1062879_msg_mark_status
Bug 1062879 - Develop more semi-auto tests for the SMS WebAPI.
- Loading branch information
Showing
3 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
webapi_tests/mobile_message/test_sms_incoming_read_status.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
|
||
from webapi_tests.semiauto import TestCase | ||
from webapi_tests.mobile_message import MobileMessageTestCommon | ||
|
||
|
||
class TestSmsIncomingReadStatus(TestCase, MobileMessageTestCommon): | ||
""" | ||
This is a test for the `WebSMS API`_ which will: | ||
- Verify that an SMS can be received (sent by the test user) | ||
- Confirm that the associated mozMobileMessage received event is triggered | ||
- Mark the received message status as unread using API and verify read attribute | ||
- Mark the received message status as read using API and verify read attribute | ||
.. _`WebSMS API`: https://developer.mozilla.org/en-US/docs/Web/API/WebSMS_API | ||
""" | ||
|
||
def setUp(self): | ||
super(TestSmsIncomingReadStatus, self).setUp() | ||
self.wait_for_obj("window.navigator.mozMobileMessage") | ||
|
||
def tearDown(self): | ||
super(TestSmsIncomingReadStatus, self).tearDown() | ||
|
||
def test_sms_incoming_read_status(self): | ||
# have user send sms to the Firefox OS device | ||
self.msg_type = "SMS" | ||
self.user_guided_incoming_msg() | ||
|
||
# verify message contents | ||
self.assertTrue(len(self.in_msg['body']) > 0, | ||
"Received message has no message body (was text included in the sent message?)") | ||
self.confirm('Received SMS with text "%s" does this text match what was sent to the Firefox OS phone?' % self.in_msg['body']) | ||
|
||
self.assertEqual(self.in_msg['type'], 'sms', | ||
"Received SMS MozSmsMessage.type should be 'sms'") | ||
self.assertGreater(self.in_msg['id'], 0, | ||
"Received SMS MozSmsMessage.id should be > 0") | ||
self.assertEqual(self.in_msg['delivery'], 'received', | ||
"Received SMS MozSmsMessage.delivery should be 'received'") | ||
|
||
# mark received message status as unread and verify | ||
self.mark_message_status(self.in_msg['id'], is_read=False) | ||
sms = self.get_message(self.in_msg['id']) | ||
self.assertTrue(sms['read'] is False, | ||
"Received SMS MozSmsMessage.read field should be False") | ||
|
||
# mark received message status as read and verify | ||
self.mark_message_status(self.in_msg['id'], is_read=True) | ||
sms = self.get_message(self.in_msg['id']) | ||
self.assertTrue(sms['read'] is True, | ||
"Received SMS MozSmsMessage.read field should be True") |