mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-14 02:35:54 +00:00
Updated test_home_view with new onboarding flow
Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
parent
f29f02d961
commit
f0269bc732
@ -1,4 +1,6 @@
|
||||
import pytest
|
||||
import random
|
||||
|
||||
from tests import marks, common_password, get_current_time, unique_password
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
@ -57,22 +59,30 @@ class TestCreateAccount(SingleDeviceTestCase):
|
||||
@marks.high
|
||||
def test_home_view(self):
|
||||
sign_in = SignInView(self.driver)
|
||||
|
||||
welcome_screen = sign_in.create_user()
|
||||
|
||||
# To Do: update new onboarding flow checks
|
||||
# if not welcome_screen.welcome_image.is_element_displayed():
|
||||
# self.errors.append('Welcome image is not shown')
|
||||
# for text in ['Welcome to Status',
|
||||
# 'Here you can chat with people in a secure private chat, browse and interact with DApps.']:
|
||||
# if not welcome_screen.element_by_text(text).is_element_displayed():
|
||||
# self.errors.append("'%s' text is not shown" % text)
|
||||
|
||||
welcome_screen.get_started_button.click()
|
||||
sign_in.get_started_button.click()
|
||||
sign_in.generate_key_button.click()
|
||||
account_button = sign_in.get_account_by_position(random.randint(1, 4))
|
||||
username = account_button.username.text
|
||||
account_button.click()
|
||||
sign_in.next_button.click()
|
||||
sign_in.next_button.click()
|
||||
sign_in.create_password_input.set_value(common_password)
|
||||
sign_in.next_button.click()
|
||||
sign_in.confirm_your_password_input.set_value(common_password)
|
||||
sign_in.next_button.click()
|
||||
sign_in.maybe_later_button.click()
|
||||
sign_in.maybe_later_button.click()
|
||||
home_view = sign_in.get_home_view()
|
||||
text = 'There are no recent chats here yet. \nUse the (+) button to discover people \nto chat with'
|
||||
if not welcome_screen.element_by_text(text).is_element_displayed():
|
||||
if not home_view.element_by_text(text).is_element_displayed():
|
||||
self.errors.append("'%s' text is not shown" % text)
|
||||
|
||||
profile_view = home_view.profile_button.click()
|
||||
shown_username_1 = profile_view.username_set_by_user_text.text
|
||||
shown_username_2 = profile_view.default_username_text.text
|
||||
if shown_username_1 != username:
|
||||
self.errors.append("Profile username '%s' doesn't match '%s'" % (shown_username_1, username))
|
||||
if shown_username_2 != username:
|
||||
self.errors.append("Default username '%s' doesn't match '%s'" % (shown_username_2, username))
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(5460)
|
||||
|
@ -1,14 +1,20 @@
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
|
||||
from tests import get_current_time, common_password
|
||||
from views.base_element import BaseButton, BaseEditBox
|
||||
from tests import common_password
|
||||
from views.base_element import BaseButton, BaseEditBox, BaseText
|
||||
from views.base_view import BaseView
|
||||
|
||||
|
||||
class MultiaccountButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(MultiaccountButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[contains(@text,'0x')]")
|
||||
class MultiAccountButton(BaseButton):
|
||||
class Username(BaseText):
|
||||
def __init__(self, driver, locator_value):
|
||||
super(MultiAccountButton.Username, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector(locator_value + '/preceding-sibling::*[1]')
|
||||
|
||||
def __init__(self, driver, position):
|
||||
super(MultiAccountButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("(//*[contains(@text,'0x')])[%s]" % position)
|
||||
self.username = self.Username(driver, self.locator.value)
|
||||
|
||||
|
||||
class PasswordInput(BaseEditBox):
|
||||
@ -63,7 +69,8 @@ class RecoverAccessButton(BaseButton):
|
||||
class CreateMultiaccountButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(CreateMultiaccountButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Create multiaccount' or @text='Create new multiaccount']")
|
||||
self.locator = self.Locator.xpath_selector(
|
||||
"//*[@text='Create multiaccount' or @text='Create new multiaccount']")
|
||||
|
||||
|
||||
class GenerateKeyButton(BaseButton):
|
||||
@ -140,7 +147,6 @@ class SignInView(BaseView):
|
||||
if skip_popups:
|
||||
self.accept_agreements()
|
||||
|
||||
self.account_button = MultiaccountButton(self.driver)
|
||||
self.password_input = PasswordInput(self.driver)
|
||||
self.recover_account_password_input = RecoverAccountPasswordInput(self.driver)
|
||||
|
||||
@ -173,13 +179,6 @@ class SignInView(BaseView):
|
||||
self.next_button.click()
|
||||
self.maybe_later_button.click()
|
||||
self.maybe_later_button.click()
|
||||
|
||||
# self.element_by_text_part('Display name').wait_for_element(60)
|
||||
# username = username if username else 'user_%s' % get_current_time()
|
||||
# self.name_input.set_value(username)
|
||||
|
||||
# self.next_button.click()
|
||||
# self.get_started_button.click()
|
||||
return self.get_home_view()
|
||||
|
||||
def recover_access(self, passphrase: str, password: str = common_password):
|
||||
@ -200,12 +199,13 @@ class SignInView(BaseView):
|
||||
self.password_input.set_value(password)
|
||||
return self.sign_in_button.click()
|
||||
|
||||
def click_account_by_position(self, position: int):
|
||||
def get_account_by_position(self, position: int):
|
||||
if self.ok_button.is_element_displayed():
|
||||
self.ok_button.click()
|
||||
try:
|
||||
self.account_button.find_elements()[position].click()
|
||||
except IndexError:
|
||||
account_button = MultiAccountButton(self.driver, position)
|
||||
if account_button.is_element_displayed():
|
||||
return account_button
|
||||
else:
|
||||
raise NoSuchElementException(
|
||||
'Device %s: Unable to find multiaccount by position %s' % (self.driver.number, position)) from None
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user