Fixed e2e tests

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
yevh-berdnyk 2019-09-06 21:17:44 +03:00 committed by Churikova Tetiana
parent a74089f857
commit 758cdf6cc2
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
4 changed files with 32 additions and 21 deletions

View File

@ -239,7 +239,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
chat_view = home_view.get_chat_view()
chat_view.chat_options.click_until_presence_of_element(chat_view.view_profile_button)
chat_view.view_profile_button.click()
for text in basic_user['username'], 'In contacts', 'Send message', 'Contact code':
for text in basic_user['username'], 'In contacts', 'Send message', 'Chat key':
if not chat_view.element_by_text(text).scroll_to_element():
self.errors.append('%s is not visible' % text)
self.verify_no_errors()
@ -319,13 +319,14 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
sign_in_view = SignInView(self.driver)
home_view = sign_in_view.create_user()
home_view.open_status_test_dapp()
home_view.back_button.click()
home_view.cross_icon.click()
profile_view = home_view.profile_button.click()
profile_view.privacy_and_security_button.click()
profile_view.dapp_permissions_button.click()
profile_view.element_by_text('status-im.github.io').click()
if not profile_view.element_by_text('Wallet').is_element_displayed():
self.errors.append('Wallet permission was not granted')
if not profile_view.element_by_text('Contact code').is_element_displayed():
if not profile_view.element_by_text('Chat key').is_element_displayed():
self.errors.append('Contact code permission was not granted')
profile_view.revoke_access_button.click()
profile_view.back_button.click()
@ -343,12 +344,22 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
@marks.low
def test_version_format(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
profile_view = sign_in_view.profile_button.click()
home_view = sign_in_view.create_user()
profile_view = home_view.profile_button.click()
profile_view.about_button.click()
version = profile_view.version_text.text
if not re.search("\d{1}[.]\d{1,2}[.]\d{1,2}\s[(]\d*[)]", version):
self.driver.fail("Version %s didn't match expected format" % version)
version_text = profile_view.version_text.text
if not re.search("\d{1}[.]\d{1,2}[.]\d{1,2}\s[(]\d*[)];\sStatusIM\/android-\d{3}\/go\d{1}[.]\d{1,2}[.]\d{1,2}",
version_text):
self.errors.append("Version %s didn't match expected format" % version_text)
profile_view.version_text.click()
profile_view.back_button.click()
profile_view.home_button.click()
chat = home_view.join_public_chat(home_view.get_public_chat_name())
message_input = chat.chat_message_input
message_input.paste_text_from_clipboard()
if message_input.text != version_text:
self.errors.append('Version number was not copied to clipboard')
self.verify_no_errors()
@marks.all

View File

@ -133,7 +133,7 @@ class TestChatManagement(SingleDeviceTestCase):
contacts_view = home.start_new_chat_button.click()
contacts_view.public_key_edit_box.set_value(basic_user['public_key'][:-1])
contacts_view.confirm()
warning_text = contacts_view.element_by_text('Please enter or scan a valid contact code or username')
warning_text = contacts_view.element_by_text('Please enter or scan a valid chat key or username')
if not warning_text.is_element_displayed():
pytest.fail('Error is not shown for invalid public key')

View File

@ -1,10 +1,9 @@
import pytest
from selenium.common.exceptions import NoSuchElementException
from tests import marks
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView
from tests.users import basic_user
from views.sign_in_view import SignInView
class TestDeepLinks(SingleDeviceTestCase):
@ -22,7 +21,7 @@ class TestDeepLinks(SingleDeviceTestCase):
try:
assert chat_view.user_name_text.text == '#' + chat_name
except (AssertionError, NoSuchElementException):
pytest.fail("Public chat '%s' is not opened" % chat_name)
self.driver.fail("Public chat '%s' is not opened" % chat_name)
@marks.testrail_id(5441)
@marks.medium
@ -35,7 +34,7 @@ class TestDeepLinks(SingleDeviceTestCase):
chat_view = sign_in_view.get_chat_view()
for text in basic_user['username'], 'Add to contacts':
if not chat_view.element_by_text(text).scroll_to_element(10):
pytest.fail("User profile screen is not opened")
self.driver.fail("User profile screen is not opened")
@marks.testrail_id(5442)
@marks.medium
@ -51,7 +50,7 @@ class TestDeepLinks(SingleDeviceTestCase):
test_dapp_view = web_view.open_in_status_button.click()
test_dapp_view.allow_button.is_element_present()
except NoSuchElementException:
pytest.fail("DApp '%s' is not opened!" % dapp_name)
self.driver.fail("DApp '%s' is not opened!" % dapp_name)
@marks.testrail_id(5780)
@marks.medium
@ -61,10 +60,11 @@ class TestDeepLinks(SingleDeviceTestCase):
self.driver.close_app()
deep_link = 'https://get.status.im/user/%s' % basic_user['public_key']
sign_in_view.open_weblink_and_login(deep_link)
chat_view = sign_in_view.get_chat_view()
for text in basic_user['username'], 'Share my profile', 'Contacts':
if not chat_view.element_by_text(text).scroll_to_element(12):
pytest.fail("Own profile screen is not opened!")
profile_view = sign_in_view.get_profile_view()
if profile_view.default_username_text.text != basic_user['username'] \
or not profile_view.contacts_button.is_element_displayed() \
or profile_view.share_my_profile_button.is_element_displayed():
self.driver.fail("Own profile screen is not opened!")
@marks.testrail_id(5781)
@marks.medium
@ -77,4 +77,4 @@ class TestDeepLinks(SingleDeviceTestCase):
home_view = sign_in_view.get_home_view()
home_view.plus_button.click_until_presence_of_element(home_view.start_new_chat_button)
if not home_view.start_new_chat_button.is_element_present():
pytest.fail("Can't navigate to start new chat after app opened from deep link with invalid public key")
self.driver.fail("Can't navigate to start new chat after app opened from deep link with invalid public key")

View File

@ -314,7 +314,7 @@ class FaqButton(BaseButton):
class VersionText(BaseText):
def __init__(self, driver):
super(VersionText, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@content-desc='version'][1]")
self.locator = self.Locator.xpath_selector("//*[@content-desc='version']//android.widget.TextView[2]")
class BootnodesButton(BaseButton):
@ -488,7 +488,7 @@ class RevokeAccessButton(BaseButton):
class PrivacyAndSecurityButton(BaseButton):
def __init__(self, driver):
super(PrivacyAndSecurityButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@content-desc="privacy-and-security-settings-button"]')
self.locator = self.Locator.accessibility_id('privacy-and-security-settings-button')
class ShowENSNameInChatsToggle(BaseButton):