Update tests to check ToS link and fix for chats in activity centre

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
Serhy 2021-07-05 22:28:55 +03:00
parent 089f42e0e9
commit 927d67f3ca
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
9 changed files with 85 additions and 17 deletions

View File

@ -161,7 +161,8 @@
(i18n/label :t/accept-status-tos-prefix)
[{:style (merge {:color colors/blue}
typography/font-medium)
:on-press #(re-frame/dispatch [:open-modal :terms-of-service])}
:on-press #(re-frame/dispatch [:open-modal :terms-of-service])
:accessibility-label :terms-of-service-link}
" "
(i18n/label :t/terms-of-service)]]]]
[react/view {:style {:margin-bottom 24}}
@ -173,5 +174,6 @@
(i18n/label :t/get-started)]]
[react/text
{:style {:color colors/blue}
:on-press #(re-frame/dispatch [:open-modal :privacy-policy])}
:on-press #(re-frame/dispatch [:open-modal :privacy-policy])
:accessibility-label :privacy-policy-link}
(i18n/label :t/privacy-policy)]]])

View File

@ -92,8 +92,10 @@ class TestCreateAccount(SingleDeviceTestCase):
@marks.high
def test_home_view(self):
sign_in = SignInView(self.driver)
sign_in.accept_tos_checkbox.click()
sign_in.get_started_button.click()
if sign_in.generate_key_button.is_element_displayed():
self.errors.append("Agree with ToS is not mandatory to proceed onboarding!")
sign_in.accept_tos_checkbox.click()
sign_in.generate_key_button.click()
from views.sign_in_view import MultiAccountButton
account_button = sign_in.get_multiaccount_by_position(position=random.randint(1, 4), element_class=MultiAccountButton)

View File

@ -333,19 +333,33 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(5453)
@marks.medium
def test_privacy_policy_node_version_need_help_in_profile(self):
@marks.flaky
def test_privacy_policy_terms_of_use_node_version_need_help_in_profile(self):
signin = SignInView(self.driver)
no_link_found_error_msg = 'Could not find privacy policy link at'
no_link_open_error_msg = 'Could not open our privacy policy from'
no_link_tos_error_msg = 'Could not open Terms of Use from'
signin.just_fyi("Checking privacy policy from sign in and from profile")
if not signin.privacy_policy_link.is_element_displayed():
signin.just_fyi("Checking privacy policy from sign in")
if not signin.privacy_policy_link.is_element_present():
self.driver.fail('%s Sign in view!' % no_link_found_error_msg)
web_page = signin.privacy_policy_link.click()
web_page.open_in_webview()
if not web_page.policy_summary.is_element_displayed():
self.errors.append('%s Sign in view!' % no_link_open_error_msg)
web_page.close_privacy_policy_button.click()
signin.just_fyi("Checking Terms of Use from sign")
if not signin.terms_of_use_link.is_element_displayed():
self.driver.fail("No Terms of Use link on Sign in view!")
web_page = signin.terms_of_use_link.click()
web_page.open_in_webview()
web_page.wait_for_d_aap_to_load()
web_page.swipe_by_custom_coordinates(0.5,0.8,0.5,0.4)
if not web_page.terms_of_use_summary.is_element_displayed():
self.errors.append('%s Sign in view!' % no_link_tos_error_msg)
web_page.close_privacy_policy_button.click()
home = signin.create_user()
profile = home.profile_button.click()
profile.about_button.click()
@ -354,6 +368,13 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.append('%s Profile about view!' % no_link_open_error_msg)
web_page.click_system_back_button()
profile.terms_of_use_button.click()
web_page.wait_for_d_aap_to_load()
web_page.swipe_by_custom_coordinates(0.5,0.8,0.5,0.4)
if not web_page.terms_of_use_summary.is_element_displayed():
self.errors.append('%s Profile about view!' % no_link_tos_error_msg)
web_page.click_system_back_button()
signin.just_fyi("Checking that version match expected format and can be copied")
app_version = profile.app_version_text.text
node_version = profile.node_version_text.text
@ -384,7 +405,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.append("Mail client is not opened when submitting bug")
profile.click_system_back_button()
profile.request_a_feature_button.click()
if not profile.element_by_text("#support").is_element_displayed():
if not profile.element_by_text("#support").is_element_displayed():
self.errors.append("Support channel is not suggested for requesting a feature")
self.errors.verify_no_errors()

View File

@ -846,7 +846,8 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
self.errors.append("Reply is not present in message received in public chat")
device_1.just_fyi('Can reply to link')
link_message, reply = 'Test with link: https://status.im/', 'reply to link'
link_message, reply = 'Test with link: https://status.im/ here should be nothing unusual.' \
' Just a regular reply.', 'reply to link'
chat_public_1.send_message(link_message)
chat_public_2.quote_message(link_message[:10])
chat_public_2.send_message(reply)

View File

@ -259,6 +259,14 @@ class BaseElement(object):
return timeit(wrapper, number=1)
def click_inside_element_by_coordinate(self, rel_x=0.8, rel_y=0.8, times_to_click=1):
element = self.find_element()
location = element.location
size = element.size
x = int(location['x'] + size['width'] * rel_x)
y = int(location['y'] + size['height'] * rel_y)
[self.driver.tap([(x, y)], 150) for _ in range(times_to_click)]
@staticmethod
def get_translation_by_key(key):
return transl[key]

View File

@ -71,6 +71,11 @@ class ChatElement(SilentButton):
return ChatImage(self.driver)
class ChatElementInAC(SilentButton):
def __init__(self, driver, username_part):
self.username = username_part
super().__init__(driver, xpath="//*[@content-desc='chat-name-or-sender-text'][starts-with(@text,'%s')]/.." % username_part)
class HomeView(BaseView):
def __init__(self, driver):
@ -135,8 +140,9 @@ class HomeView(BaseView):
chat_element = ChatElement(self.driver, username[:25])
if not chat_element.is_element_displayed():
self.notifications_unread_badge.wait_and_click(30)
chat_element.wait_for_element(20)
chat_element.click()
chat_in_ac = ChatElementInAC(self.driver, username[:25])
chat_in_ac.wait_for_element(20)
chat_in_ac.click()
self.home_button.double_click()
return chat_element

View File

@ -151,6 +151,15 @@ class PrivacyPolicyButton(Button):
return BaseWebView(self.driver)
class TermsOfUseButton(Button):
def __init__(self, driver):
super().__init__(driver, accessibility_id="terms-of-service")
def navigate(self):
from views.web_views.base_web_view import BaseWebView
return BaseWebView(self.driver)
class ProfilePictureElement(Button):
def __init__(self, driver):
super().__init__(driver, accessibility_id="chat-icon")
@ -275,6 +284,7 @@ class ProfileView(BaseView):
#About
self.about_button = AboutButton(self.driver)
self.privacy_policy_button = PrivacyPolicyButton(self.driver)
self.terms_of_use_button = TermsOfUseButton(self.driver)
self.app_version_text = Text(self.driver, xpath="//*[@content-desc='app-version']//android.widget.TextView[2]")
self.node_version_text = Text(self.driver,
xpath="//*[@content-desc='node-version']//android.widget.TextView[2]")

View File

@ -85,15 +85,30 @@ class KeycardKeyStorageButton(Button):
class PrivacyPolicyLink(Button):
def __init__(self, driver):
super(PrivacyPolicyLink, self).__init__(driver, xpath="//*[contains(@text, 'Privacy policy')]")
super(PrivacyPolicyLink, self).__init__(driver, accessibility_id="privacy-policy-link")
def click(self):
element = self.find_element()
location = element.location
size = element.size
x = int(location['x'] + size['width'] * 0.9)
y = int(location['y'] + size['height'] * 0.8)
TouchAction(self.driver).tap(None, x, y).perform()
self.driver.info('Click on link %s' % self.name)
self.click_until_absense_of_element(TermsOfUseLink(self.driver))
return self.navigate()
def navigate(self):
from views.web_views.base_web_view import BaseWebView
return BaseWebView(self.driver)
class TermsOfUseLink(Button):
def __init__(self, driver):
super(TermsOfUseLink, self).__init__(driver, xpath="//*[contains(@text, 'Terms of Use')]")
def click(self):
counter = 0
while PrivacyPolicyLink(self.driver).is_element_present(1) and counter <= 5:
try:
self.click_inside_element_by_coordinate(times_to_click=2)
counter += 1
except (NoSuchElementException):
return self.navigate()
self.driver.info('Click on link %s' % self.name)
return self.navigate()
@ -121,6 +136,7 @@ class SignInView(BaseView):
self.enable_notifications_button = Button(self.driver, accessibility_id="enable-notifications")
self.maybe_later_button = Button(self.driver, accessibility_id="maybe-later")
self.privacy_policy_link = PrivacyPolicyLink(self.driver)
self.terms_of_use_link = TermsOfUseLink(self.driver)
self.lets_go_button = Button(self.driver, accessibility_id="lets-go-button")
self.keycard_storage_button = KeycardKeyStorageButton(self.driver)
self.first_username_on_choose_chat_name = Text(self.driver,

View File

@ -11,6 +11,8 @@ class BaseWebView(BaseView):
self.progress_bar_icon = Button(self.driver, xpath="//android.widget.ProgressBar")
self.url_edit_box_lock_icon = Button(self.driver, xpath="'(//android.view.ViewGroup[@content-desc='icon'])[2]")
self.policy_summary = Button(self.driver, xpath="//*[@content-desc='Status Privacy Policy'] | //*[@text='Status Privacy Policyy']")
self.terms_of_use_summary = Button(self.driver, xpath="//*[@content-desc='Status App Terms of Use']")
self.browser_previous_page_button = Button(self.driver, accessibility_id="previous-page-button")
self.browser_next_page_button = Button(self.driver, accessibility_id="next-page-button")