Skip to content

Commit be6bfc6

Browse files
author
Florin Strugariu
committed
Merge pull request mozilla-b2g#26849 from viorelaioia/sms_nofification
Bug 1112583 - Add a test to verify that a received call notification is ...
2 parents 6ef10ac + b3be0d8 commit be6bfc6

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

tests/python/gaia-ui-tests/gaiatest/apps/messages/regions/activities.py

+13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class Activities(Base):
2424
_add_to_contact_button_locator = (By.XPATH, '//*[text()="Add to an existing contact"]')
2525
_create_new_contact_button_locator = (By.CSS_SELECTOR, 'button[data-l10n-id="createNewContact"]')
2626
_forward_message_button_locator = (By.CSS_SELECTOR, 'button[data-l10n-id="forward"]')
27+
_delete_message_button_locator = (By.CSS_SELECTOR, 'form[data-type="action"] button[data-l10n-id="delete"]')
28+
_confirm_delete_message_locator = (By.CSS_SELECTOR, 'button.danger')
2729

2830
def __init__(self, marionette):
2931
Base.__init__(self, marionette)
@@ -63,3 +65,14 @@ def tap_forward_message(self):
6365
self.marionette.find_element(*self._forward_message_button_locator).tap()
6466
from gaiatest.apps.messages.regions.new_message import NewMessage
6567
return NewMessage(self.marionette)
68+
69+
def tap_delete_message(self):
70+
delete_message_button = self.marionette.find_element(*self._delete_message_button_locator)
71+
Wait(self.marionette).until(expected.element_displayed(delete_message_button))
72+
delete_message_button.tap()
73+
74+
def confirm_delete_message(self):
75+
confirm_delete_message = self.marionette.find_element(*self._confirm_delete_message_locator)
76+
Wait(self.marionette).until(expected.element_displayed(confirm_delete_message))
77+
confirm_delete_message.tap()
78+
Wait(self.marionette).until(expected.element_not_displayed(confirm_delete_message))

tests/python/gaia-ui-tests/gaiatest/tests/functional/messages/manifest.ini

+3
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ skip-if = device == "desktop"
5454
[test_sms_auto_save_draft.py]
5555
# Bug 1103106 - Assertion failure: !mWillChangeBudgetCalculated
5656
skip-if = device == "desktop" && os == "linux" && debug
57+
58+
[test_sms_notification_removed_when_sms_deleted.py]
59+
skip-if = device == "desktop"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
4+
5+
import time
6+
try:
7+
from marionette.wait import Wait
8+
except:
9+
from marionette_driver import Wait
10+
from gaiatest import GaiaTestCase
11+
from gaiatest.apps.messages.app import Messages
12+
from gaiatest.apps.system.app import System
13+
14+
15+
class TestSmsNotificationRemovedWhenSMSDeleted(GaiaTestCase):
16+
17+
def test_sms_notification_removed_when_sms_deleted(self):
18+
"""
19+
https://moztrap.mozilla.org/manage/case/8778/
20+
"""
21+
22+
_text_message_content = "Automated Test %s" % str(time.time())
23+
24+
# launch messages app
25+
messages = Messages(self.marionette)
26+
messages.launch()
27+
28+
# Send a SMS to the device
29+
self.data_layer.send_sms(self.testvars['local_phone_numbers'][0], _text_message_content)
30+
31+
system = System(self.marionette)
32+
33+
# We will wait upto 300 seconds for the SMS to arrive due to network latency
34+
system.wait_for_notification_toaster_displayed(timeout=300,
35+
message="Notification did not appear. SMS database dump: %s " % self.data_layer.get_all_sms())
36+
system.wait_for_notification_toaster_not_displayed()
37+
38+
self.apps.switch_to_displayed_app()
39+
40+
# Tap on the latest received SMS
41+
message_thread = messages.tap_first_received_message()
42+
Wait(self.marionette).until(lambda m: len(message_thread.received_messages) > 0)
43+
messages_number = len(message_thread.all_messages)
44+
last_received_message = message_thread.received_messages[-1]
45+
46+
# Delete latest received SMS
47+
activities = last_received_message.long_press_message()
48+
activities.tap_delete_message()
49+
activities.confirm_delete_message()
50+
51+
Wait(self.marionette).until(lambda m: len(message_thread.all_messages) == messages_number - 1)
52+
53+
self.marionette.switch_to_frame()
54+
55+
# Check that SMS notification no longer appears in utility tray
56+
utility_tray = system.open_utility_tray()
57+
self.assertEqual(0, len(utility_tray.notifications))

0 commit comments

Comments
 (0)