mobile_data_tests

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2019-10-03 18:08:06 +02:00
parent e8627f0320
commit da4fb01700
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
3 changed files with 98 additions and 4 deletions

View File

@ -28,15 +28,88 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(5741)
@marks.high
def test_mobile_data_usage_popup(self):
def test_mobile_data_usage_popup_continue_syncing(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
sign_in_view.just_fyi("Enable mobile network to see popup and enable syncing")
sign_in_view.toggle_mobile_data()
if not sign_in_view.find_text_part("Sync using Mobile data"):
if not sign_in_view.element_by_text_part("Sync using Mobile data").is_element_displayed():
self.driver.fail('No popup about Mobile data is shown')
# TODO: add steps after 8973 fix
sign_in_view.wait_for_element_starts_with_text('Continue syncing').click()
@marks.testrail_id(5454)
sign_in_view.just_fyi("Check that selected option is stored in Profile")
profile_view = sign_in_view.profile_button.click()
profile_view.sync_settings_button.click()
profile_view.element_by_text('Mobile data').click()
for toggle in profile_view.use_mobile_data, profile_view.ask_me_when_on_mobile_network:
if not toggle.attribute_value('checked'):
self.errors.append("Toggles in Mobile settings are not enabled")
sign_in_view.just_fyi("Check that can join public chat and send message")
chat_name = sign_in_view.get_public_chat_name()
home = profile_view.get_back_to_home_view()
chat = home.join_public_chat(chat_name)
message = 'test message'
chat.chat_message_input.send_keys(message)
chat.send_message_button.click()
if not chat.chat_element_by_text(message).is_element_displayed():
self.errors.append("Message was not sent!")
self.verify_no_errors()
@marks.testrail_id(5741)
@marks.high
def test_mobile_data_usage_popup_stop_syncing(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
offline_banner_text = "History syncing offline"
sign_in_view.just_fyi("Enable mobile network to see popup and stop syncing")
sign_in_view.toggle_mobile_data()
sign_in_view.wait_for_element_starts_with_text('Stop syncing').click()
if not sign_in_view.wait_for_element_starts_with_text(offline_banner_text, 60):
self.driver.fail('No popup about offline history is shown')
sign_in_view.element_by_text_part(offline_banner_text).click()
for item in "Offline, waiting for Wi-Fi", "Start syncing", "Go to settings":
if not sign_in_view.element_by_text(item).is_element_displayed():
self.driver.fail("%s is not shown" % item)
sign_in_view.just_fyi("Start syncing in offline popup")
sign_in_view.element_by_text("Start syncing").click()
if sign_in_view.element_by_text_part(offline_banner_text).is_element_displayed():
self.driver.fail("Popup about offline history is shown")
@marks.testrail_id(6228)
@marks.high
def test_mobile_data_usage_settings(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
profile_view = sign_in_view.profile_button.click()
sign_in_view.just_fyi("Check default preferences")
profile_view.sync_settings_button.click()
profile_view.element_by_text('Mobile data').click()
if profile_view.use_mobile_data.attribute_value("checked"):
self.errors.append("Mobile data is enabled by default")
if not profile_view.ask_me_when_on_mobile_network.attribute_value("checked"):
self.errors.append("'Ask me when on mobile network' is not enabled by default")
sign_in_view.just_fyi("Disable 'ask me when on mobile network' and check that it is not shown")
profile_view.ask_me_when_on_mobile_network.click()
sign_in_view.toggle_mobile_data()
if sign_in_view.element_by_text("Start syncing").is_element_displayed(20):
self.errors.append("Popup is shown, but 'ask me when on mobile network' is disabled")
sign_in_view.just_fyi("Check 'Restore default' setting")
profile_view.element_by_text('Restore Defaults').click()
if profile_view.use_mobile_data.attribute_value("checked"):
self.errors.append("Mobile data is enabled by default")
if not profile_view.ask_me_when_on_mobile_network.attribute_value("checked"):
self.errors.append("'Ask me when on mobile network' is not enabled by default")
self.verify_no_errors()
@marks.testrail_id(6229)
@marks.critical
def test_user_can_remove_profile_picture(self):
signin_view = SignInView(self.driver)

View File

@ -157,6 +157,9 @@ class BaseElement(object):
def image(self):
return Image.open(BytesIO(base64.b64decode(self.find_element().screenshot_as_base64)))
def attribute_value(self, value):
return self.find_element().get_attribute(value)
def is_element_image_equals_template(self, file_name: str = ''):
if file_name:
self.template = file_name

View File

@ -503,6 +503,19 @@ class ShowENSNameInChatsToggle(BaseButton):
self.locator = self.Locator.xpath_selector(
"//*[@text='Show my ENS username in chats']/following-sibling::*[1][name()='android.widget.Switch'] ")
class UseMobileDataToggle(BaseButton):
def __init__(self, driver):
super(UseMobileDataToggle, self).__init__(driver)
self.locator = self.Locator.xpath_selector(
"//*[@text='Use mobile data']/../*[name()='android.widget.Switch']")
class AskMeWhenOnMobileNetworkToggle(BaseButton):
def __init__(self, driver):
super(AskMeWhenOnMobileNetworkToggle, self).__init__(driver)
self.locator = self.Locator.xpath_selector(
"//*[@text='Ask me when on mobile network']/../*[name()='android.widget.Switch']")
class ProfileView(BaseView):
@ -585,8 +598,13 @@ class ProfileView(BaseView):
self.advertise_device_button = AdvertiseDeviceButton(self.driver)
self.sync_all_button = SyncAllButton(self.driver)
# ENS
self.show_ens_name_in_chats = ShowENSNameInChatsToggle(self.driver)
# Mobile Data
self.use_mobile_data = UseMobileDataToggle(self.driver)
self.ask_me_when_on_mobile_network = AskMeWhenOnMobileNetworkToggle(self.driver)
def switch_network(self, network):
self.advanced_button.click()
self.debug_mode_toggle.click()