Add e2e test for PN
Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
parent
e8fca7ce68
commit
afb4e9fdb9
|
@ -35,6 +35,64 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
||||||
device_2_chat = device_2_home.get_chat(default_username_1).click()
|
device_2_chat = device_2_home.get_chat(default_username_1).click()
|
||||||
device_2_chat.chat_element_by_text(message).wait_for_visibility_of_element()
|
device_2_chat.chat_element_by_text(message).wait_for_visibility_of_element()
|
||||||
|
|
||||||
|
@marks.testrail_id(6283)
|
||||||
|
@marks.high
|
||||||
|
def test_push_notification_1_1_chat(self):
|
||||||
|
self.create_drivers(2)
|
||||||
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||||
|
device_1_home, device_2_home = device_1.create_user(), device_2.create_user(enable_notifications=True)
|
||||||
|
device_2.just_fyi("Device_1 = Enables Notifications from Profile; Device_2 - from onboarding")
|
||||||
|
|
||||||
|
profile_1 = device_1_home.profile_button.click()
|
||||||
|
default_username_1 = profile_1.default_username_text.text
|
||||||
|
profile_1.profile_notifications_button.click()
|
||||||
|
device_1_home = profile_1.get_back_to_home_view()
|
||||||
|
device_2_public_key = device_2_home.get_public_key_and_username()
|
||||||
|
|
||||||
|
device_2.just_fyi("Device 2 puts app on background being on Profile view to receive PN with text")
|
||||||
|
device_2.click_system_home_button()
|
||||||
|
|
||||||
|
device_1_chat = device_1_home.add_contact(device_2_public_key)
|
||||||
|
message = 'Text push notification'
|
||||||
|
device_1_chat.chat_message_input.send_keys(message)
|
||||||
|
device_1_chat.send_message_button.click()
|
||||||
|
|
||||||
|
device_1.just_fyi("Device 1 puts app on background to receive emoji push notification")
|
||||||
|
device_1.profile_button.click()
|
||||||
|
device_1.click_system_home_button()
|
||||||
|
|
||||||
|
device_2.just_fyi("Check text push notification and tap it")
|
||||||
|
device_2.open_notification_bar()
|
||||||
|
if not (device_2.element_by_text_part(message).is_element_displayed()
|
||||||
|
and device_2.element_by_text_part(default_username_1).is_element_displayed()):
|
||||||
|
device_2.driver.fail("Push notification with text was not received")
|
||||||
|
chat_view_device_2 = device_2.click_upon_push_notification_by_text(message)
|
||||||
|
|
||||||
|
device_2.just_fyi("Send emoji message to Device 1 while it's on backround")
|
||||||
|
emoji_message = random.choice(list(emoji.EMOJI_UNICODE))
|
||||||
|
emoji_unicode = emoji.EMOJI_UNICODE[emoji_message]
|
||||||
|
chat_view_device_2.send_message(emoji.emojize(emoji_message))
|
||||||
|
|
||||||
|
device_1.just_fyi("Device 1 checks PN with emoji")
|
||||||
|
device_1.open_notification_bar()
|
||||||
|
if not device_1.element_by_text_part(emoji_unicode).is_element_displayed(10):
|
||||||
|
device_1.driver.fail("Push notification with emoji was not received")
|
||||||
|
chat_view_device_1 = device_1.click_upon_push_notification_by_text(emoji_unicode)
|
||||||
|
device_1.just_fyi("Check Device 1 is actually on chat")
|
||||||
|
if not (chat_view_device_1.element_by_text_part(message).is_element_displayed()
|
||||||
|
and chat_view_device_1.element_by_text_part(emoji_unicode).is_element_displayed()):
|
||||||
|
device_1.driver.fail("Failed to open chat view after tap on PN")
|
||||||
|
|
||||||
|
device_1.just_fyi("Checks there are no PN after message was seen")
|
||||||
|
device_1.click_system_home_button()
|
||||||
|
device_2.click_system_home_button()
|
||||||
|
device_1.open_notification_bar()
|
||||||
|
device_2.open_notification_bar()
|
||||||
|
if (device_2.element_by_text_part(message).is_element_displayed()
|
||||||
|
or device_1.element_by_text_part(emoji_unicode).is_element_displayed()):
|
||||||
|
self.errors.append("PN are keep staying after message was seen by user")
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
@marks.testrail_id(5310)
|
@marks.testrail_id(5310)
|
||||||
@marks.critical
|
@marks.critical
|
||||||
def test_offline_messaging_1_1_chat(self):
|
def test_offline_messaging_1_1_chat(self):
|
||||||
|
|
|
@ -476,6 +476,10 @@ class BaseView(object):
|
||||||
for _ in range(times):
|
for _ in range(times):
|
||||||
self.driver.press_keycode(4)
|
self.driver.press_keycode(4)
|
||||||
|
|
||||||
|
def click_system_home_button(self):
|
||||||
|
self.driver.info('Press system Home button')
|
||||||
|
self.driver.press_keycode(3)
|
||||||
|
|
||||||
def cut_text(self):
|
def cut_text(self):
|
||||||
self.driver.info('Cut text')
|
self.driver.info('Cut text')
|
||||||
self.driver.press_keycode(277)
|
self.driver.press_keycode(277)
|
||||||
|
@ -666,6 +670,10 @@ class BaseView(object):
|
||||||
self.send_as_keyevent('+0100100101')
|
self.send_as_keyevent('+0100100101')
|
||||||
self.confirm()
|
self.confirm()
|
||||||
|
|
||||||
|
def click_upon_push_notification_by_text(self, text):
|
||||||
|
self.element_by_text_part(text).click()
|
||||||
|
return self.get_chat_view()
|
||||||
|
|
||||||
def reconnect(self):
|
def reconnect(self):
|
||||||
connect_status = self.connection_status
|
connect_status = self.connection_status
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
|
@ -693,6 +701,11 @@ class BaseView(object):
|
||||||
def asset_by_name(self, asset_name):
|
def asset_by_name(self, asset_name):
|
||||||
return AssetButton(self.driver, asset_name)
|
return AssetButton(self.driver, asset_name)
|
||||||
|
|
||||||
|
def open_notification_bar(self):
|
||||||
|
action = TouchAction(self.driver)
|
||||||
|
for i in range(2):
|
||||||
|
action.press(None, 100, 10).move_to(None, 100, 600).perform()
|
||||||
|
|
||||||
def toggle_airplane_mode(self):
|
def toggle_airplane_mode(self):
|
||||||
self.airplane_mode_button.click()
|
self.airplane_mode_button.click()
|
||||||
self.close_native_device_dialog("MmsService")
|
self.close_native_device_dialog("MmsService")
|
||||||
|
|
|
@ -458,6 +458,12 @@ class AboutButton(BaseButton):
|
||||||
return self.navigate()
|
return self.navigate()
|
||||||
|
|
||||||
|
|
||||||
|
class PrifileNotificationsButton(BaseButton):
|
||||||
|
def __init__(self, driver):
|
||||||
|
super().__init__(driver)
|
||||||
|
self.locator = self.Locator.accessibility_id("notifications-button")
|
||||||
|
|
||||||
|
|
||||||
class RemovePictureButton(BaseButton):
|
class RemovePictureButton(BaseButton):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super().__init__(driver)
|
super().__init__(driver)
|
||||||
|
@ -606,6 +612,7 @@ class ProfileView(BaseView):
|
||||||
self.remove_picture_button = RemovePictureButton(self.driver)
|
self.remove_picture_button = RemovePictureButton(self.driver)
|
||||||
self.confirm_edit_button = ConfirmEditButton(self.driver)
|
self.confirm_edit_button = ConfirmEditButton(self.driver)
|
||||||
self.cross_icon = CrossIcon(self.driver)
|
self.cross_icon = CrossIcon(self.driver)
|
||||||
|
self.profile_notifications_button = PrifileNotificationsButton(self.driver)
|
||||||
self.advanced_button = AdvancedButton(self.driver)
|
self.advanced_button = AdvancedButton(self.driver)
|
||||||
self.log_level_setting = LogLevelSetting(self.driver)
|
self.log_level_setting = LogLevelSetting(self.driver)
|
||||||
self.debug_mode_toggle = DebugModeToggle(self.driver)
|
self.debug_mode_toggle = DebugModeToggle(self.driver)
|
||||||
|
|
|
@ -165,6 +165,12 @@ class MaybeLaterButton(BaseButton):
|
||||||
self.locator = self.Locator.accessibility_id("maybe-later")
|
self.locator = self.Locator.accessibility_id("maybe-later")
|
||||||
|
|
||||||
|
|
||||||
|
class EnableNotificationsButton(BaseButton):
|
||||||
|
def __init__(self, driver):
|
||||||
|
super(EnableNotificationsButton, self).__init__(driver)
|
||||||
|
self.locator = self.Locator.accessibility_id("enable-notifications")
|
||||||
|
|
||||||
|
|
||||||
class AddExistingMultiaccountButton(RecoverAccessButton):
|
class AddExistingMultiaccountButton(RecoverAccessButton):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(AddExistingMultiaccountButton, self).__init__(driver)
|
super(AddExistingMultiaccountButton, self).__init__(driver)
|
||||||
|
@ -236,6 +242,7 @@ class SignInView(BaseView):
|
||||||
self.confirm_password_input = ConfirmPasswordInput(self.driver)
|
self.confirm_password_input = ConfirmPasswordInput(self.driver)
|
||||||
self.create_password_input = CreatePasswordInput(self.driver)
|
self.create_password_input = CreatePasswordInput(self.driver)
|
||||||
self.confirm_your_password_input = ConfirmYourPasswordInput(self.driver)
|
self.confirm_your_password_input = ConfirmYourPasswordInput(self.driver)
|
||||||
|
self.enable_notifications_button = EnableNotificationsButton(self.driver)
|
||||||
self.maybe_later_button = MaybeLaterButton(self.driver)
|
self.maybe_later_button = MaybeLaterButton(self.driver)
|
||||||
self.name_input = NameInput(self.driver)
|
self.name_input = NameInput(self.driver)
|
||||||
self.other_multiaccounts_button = OtherMultiAccountsButton(self.driver)
|
self.other_multiaccounts_button = OtherMultiAccountsButton(self.driver)
|
||||||
|
@ -252,7 +259,7 @@ class SignInView(BaseView):
|
||||||
self.pair_to_this_device_button = PairToThisDeviceButton(self.driver)
|
self.pair_to_this_device_button = PairToThisDeviceButton(self.driver)
|
||||||
|
|
||||||
|
|
||||||
def create_user(self, password=common_password, keycard=False):
|
def create_user(self, password=common_password, keycard=False, enable_notifications=False):
|
||||||
self.get_started_button.click()
|
self.get_started_button.click()
|
||||||
self.generate_key_button.click()
|
self.generate_key_button.click()
|
||||||
self.next_button.click()
|
self.next_button.click()
|
||||||
|
@ -266,7 +273,10 @@ class SignInView(BaseView):
|
||||||
self.confirm_your_password_input.set_value(password)
|
self.confirm_your_password_input.set_value(password)
|
||||||
self.next_button.click()
|
self.next_button.click()
|
||||||
self.maybe_later_button.wait_for_visibility_of_element(30)
|
self.maybe_later_button.wait_for_visibility_of_element(30)
|
||||||
self.maybe_later_button.click_until_presence_of_element(self.lets_go_button)
|
if enable_notifications:
|
||||||
|
self.enable_notifications_button.click()
|
||||||
|
else:
|
||||||
|
self.maybe_later_button.click_until_presence_of_element(self.lets_go_button)
|
||||||
self.lets_go_button.click_until_absense_of_element(self.lets_go_button)
|
self.lets_go_button.click_until_absense_of_element(self.lets_go_button)
|
||||||
self.profile_button.wait_for_visibility_of_element(30)
|
self.profile_button.wait_for_visibility_of_element(30)
|
||||||
return self.get_home_view()
|
return self.get_home_view()
|
||||||
|
|
Loading…
Reference in New Issue