e2e: migration and message statuses

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2021-02-26 16:27:20 +01:00
parent c7009ff6f7
commit 83630b28bb
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
9 changed files with 152 additions and 25 deletions

View File

@ -67,12 +67,13 @@
:justify-content :space-between}
[react/view
[quo/list-header (i18n/label :t/actions)]
[quo/list-item {:title (i18n/label :t/move-keystore-file)
:subtitle (i18n/label :t/select-new-location-for-keys)
:subtitle-max-lines 4
:accessory :checkbox
:active move-keystore-checked?
:on-press #(re-frame/dispatch [::multiaccounts.key-storage/move-keystore-checked (not move-keystore-checked?)])}]
[quo/list-item {:title (i18n/label :t/move-keystore-file)
:subtitle (i18n/label :t/select-new-location-for-keys)
:subtitle-max-lines 4
:accessibility-label :move-keystore-file
:accessory :checkbox
:active move-keystore-checked?
:on-press #(re-frame/dispatch [::multiaccounts.key-storage/move-keystore-checked (not move-keystore-checked?)])}]
[quo/list-item {:title (i18n/label :t/reset-database)
:subtitle (i18n/label :t/reset-database-warning)
:subtitle-max-lines 4
@ -216,7 +217,6 @@
[react/view {:margin-vertical 24
:align-items :center}
[quo/button {:on-press #(re-frame/dispatch [:hide-popover])
:accessibility-label :cancel-custom-seed-phrase
:type :secondary}
(i18n/label :t/try-again)]]]))
@ -238,12 +238,12 @@
[react/view {:margin-vertical 24
:align-items :center}
[quo/button {:on-press #(re-frame/dispatch [::multiaccounts.key-storage/delete-multiaccount-and-init-keycard-onboarding])
:accessibility-label :cancel-custom-seed-phrase
:accessibility-label :move-and-reset-button
:type :primary
:theme :negative}
(i18n/label :t/move-and-reset)]
[quo/button {:on-press #(re-frame/dispatch [:hide-popover])
:accessibility-label :cancel-custom-seed-phrase
:accessibility-label :cancel-move-seed-phrase-button
:type :secondary}
(i18n/label :t/cancel)]]])

View File

@ -48,7 +48,8 @@
keycard? [:keycard-multiaccount?]]
[react/keyboard-avoiding-view {:style ast/multiaccounts-view}
[topbar/topbar {:border-bottom false
:right-accessories [{:icon :more
:right-accessories [{:icon :more
:accessibility-label "sign-in-options"
:on-press #(do
(react/dismiss-keyboard!)
(re-frame/dispatch [:multiaccounts.recover.ui/recover-multiaccount-button-pressed]))}]}]

View File

@ -55,7 +55,7 @@
[quo/list-item
{:theme :accent
:title (i18n/label :t/manage-keys-and-storage)
:accessibility-label :enter-seed-phrase-button
:accessibility-label :manage-keys-and-storage-button
:icon :main-icons/key
:on-press #(hide-sheet-and-dispatch [::multiaccounts.key-storage/key-and-storage-management-pressed])}])

View File

@ -201,7 +201,7 @@ class TestCreateAccount(SingleDeviceTestCase):
sign_in.just_fyi('check behavior for popup "Custom seed phrase"')
if popup:
if not sign_in.element_by_translation_id("custom-seed-phrase").is_element_displayed():
if not sign_in.custom_seed_phrase_label.is_element_displayed():
self.errors.append("Popup about custom seed phrase is not shown")
sign_in.cancel_custom_seed_phrase_button.click()

View File

@ -35,6 +35,96 @@ class TestCreateAccount(SingleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6645)
@marks.critical
def test_restore_account_migrate_multiaccount_to_keycard(self):
sign_in = SignInView(self.driver)
seed = basic_user['passphrase']
home = sign_in.recover_access(passphrase=seed)
profile = home.profile_button.click()
profile.logout()
home.just_fyi("Checking keycard banner and starting migrate multiaccount to keycard")
sign_in.multi_account_on_login_button.wait_for_visibility_of_element(30)
sign_in.get_multiaccount_by_position(1).click()
if not sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is not shown on login screen for ordinary multiaccount")
sign_in.options_button.click()
sign_in.manage_keys_and_storage_button.click()
if not sign_in.element_by_text(basic_user['username']).is_element_displayed():
self.driver.fail("Default username is not shown when migrating multiaccount to keycard!")
home.just_fyi("Checking validation of seed phrase during migration")
sign_in.enter_seed_phrase_next_button.click()
if sign_in.seedphrase_input.is_element_displayed():
self.driver.fail("Proceeded to seedphrase input without confirmed Actions")
sign_in.move_keystore_file_option.click()
sign_in.enter_seed_phrase_next_button.click()
sign_in.seedphrase_input.set_value(transaction_senders['A']['passphrase'])
sign_in.choose_storage_button.click()
if not sign_in.element_by_translation_id("seed-key-uid-mismatch").is_element_displayed():
self.driver.fail("Can proceed with seed phrase of another user")
sign_in.element_by_translation_id("try-again").click()
sign_in.seedphrase_input.set_value(seed[:-1])
sign_in.choose_storage_button.click()
if not sign_in.custom_seed_phrase_label.is_element_displayed():
self.driver.fail("Can proceed with invalid seed phrase")
sign_in.cancel_button.click()
sign_in.seedphrase_input.set_value(seed)
sign_in.choose_storage_button.click()
if not sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is not shown on Key management screen")
sign_in.keycard_required_option.click()
if sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is shown when keycard storage is chosen")
home.just_fyi("Finishing migration to keycard")
sign_in.confirm_button.click()
keycard = sign_in.move_and_reset_button.click()
keycard.begin_setup_button.click()
keycard.connect_card_button.click()
keycard.enter_default_pin()
keycard.enter_default_pin()
keycard.next_button.scroll_to_element()
keycard.next_button.wait_for_visibility_of_element(20)
keycard.next_button.click()
keycard.yes_button.click()
sign_in.maybe_later_button.wait_and_click(30)
sign_in.lets_go_button.wait_and_click(30)
sign_in.just_fyi('Check that after migrating account with assets is restored')
wallet_view = sign_in.wallet_button.click()
wallet_view.set_up_wallet()
for asset in ['ETH', 'ADI', 'STT']:
if wallet_view.get_asset_amount_by_name(asset) == 0:
self.errors.append('Asset %s was not restored' % asset)
sign_in.just_fyi('Check that after migration wallet address matches expected')
address = wallet_view.get_wallet_address()
if address != '0x%s' % basic_user['address']:
self.errors.append('Restored address %s does not match expected' % address)
sign_in.just_fyi('Check that after migration username and public key match expected')
public_key, default_username = sign_in.get_public_key_and_username(return_username=True)
profile = sign_in.get_profile_view()
if public_key != basic_user['public_key']:
self.errors.append('Public key %s does not match expected' % public_key)
if default_username != basic_user['username']:
self.errors.append('Default username %s does not match expected' % default_username)
profile.logout()
sign_in.just_fyi('Check that can login with migrated account, keycard banner is not shown and no option to migrate')
sign_in.get_multiaccount_by_position(1).click()
if sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is shown on migrated keycard multiaccount")
keycard.one_button.wait_for_visibility_of_element(10)
keycard.connect_selected_card_button.click()
keycard.enter_default_pin()
if not sign_in.home_button.is_element_displayed(10):
self.driver.fail('Keycard user is not logged in')
self.errors.verify_no_errors()
@marks.testrail_id(6240)
@marks.critical
def test_restore_account_from_mnemonic_to_keycard(self):

View File

@ -73,7 +73,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
@marks.testrail_id(5310)
@marks.critical
def test_offline_is_shown_messaging_1_1_chat(self):
def test_offline_is_shown_messaging_1_1_chat_sent_delivered(self):
self.create_drivers(2)
home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user()
public_key_1 = home_1.get_public_key_and_username()
@ -92,7 +92,11 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
profile_2.get_back_to_home_view()
chat_2 = home_2.add_contact(public_key_1)
message_1 = 'test message'
home_2.just_fyi("check sent status")
chat_2.send_message(message_1)
if chat_2.chat_element_by_text(message_1).status != 'sent':
self.errors.append('Message status is not sent, it is %s!' % chat_2.chat_element_by_text(message_1).status)
chat_2.toggle_airplane_mode()
home_1.just_fyi('go back online and check that 1-1 chat will be fetched')
@ -102,14 +106,17 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
chat_1 = chat_element.click()
chat_1.chat_element_by_text(message_1).wait_for_visibility_of_element(2)
home_1.just_fyi('checking offline fetching for another message')
home_1.just_fyi('checking offline fetching for another message, check delivered stutus for first message')
chat_2.toggle_airplane_mode()
if chat_2.chat_element_by_text(message_1).status != 'delivered':
self.errors.append('Message status is not delivered, it is %s!' % chat_2.chat_element_by_text(message_1).status)
home_1.toggle_airplane_mode()
message_2 = 'one more message'
chat_2.send_message(message_2)
home_1.toggle_airplane_mode()
chat_1 = chat_element.click()
chat_1.chat_element_by_text(message_2).wait_for_visibility_of_element(180)
self.errors.verify_no_errors()
@marks.testrail_id(5315)
@marks.high

View File

@ -169,6 +169,17 @@ class ChatElementByText(Text):
xpath="//android.view.ViewGroup//android.widget.TextView[contains(@text,'%s')]" % text)
return element.is_element_displayed(wait_time)
@property
def status(self) -> str:
sent = Text(self.driver, prefix=self.locator, xpath="//*[@content-desc='sent']")
delivered = Text(self.driver, prefix=self.locator, xpath="//*[@content-desc='delivered']")
status = ''
if sent.is_element_displayed(10, ignored_exceptions=NoSuchElementException):
status = 'sent'
if delivered.is_element_displayed(20, ignored_exceptions=NoSuchElementException):
status = 'delivered'
return status
@property
def replied_message_text(self):
class RepliedMessageText(Text):

View File

@ -17,7 +17,7 @@ class AddNewContactButton(Button):
return ChatView(self.driver)
class LogoutButton(Button):
class LogoutButton(SilentButton):
def __init__(self, driver):
super().__init__(driver, accessibility_id="log-out-button")
@ -31,7 +31,7 @@ class LogoutDialog(BaseView):
super().__init__(driver)
self.logout_button = LogoutDialog.LogoutButton(driver)
class LogoutButton(Button):
class LogoutButton(SilentButton):
def __init__(self, driver):
super().__init__(driver, translation_id="logout", uppercase=True)

View File

@ -21,10 +21,17 @@ class MultiAccountOnLoginButton(Button):
super(MultiAccountOnLoginButton, self).__init__(driver,
xpath="(//*[@content-desc='chat-icon'])[%s]/.." % position)
class MoveAndResetButton(Button):
def __init__(self, driver):
super().__init__(driver, accessibility_id="move-and-reset-button")
def navigate(self):
from views.keycard_view import KeycardView
return KeycardView(self.driver)
class BeginRecoveryButton(Button):
def __init__(self, driver):
super(BeginRecoveryButton, self).__init__(driver, translation_id="keycard-recovery-intro-button-text")
super().__init__(driver, translation_id="keycard-recovery-intro-button-text")
def navigate(self):
from views.keycard_view import KeycardView
@ -37,7 +44,7 @@ class BeginRecoveryButton(Button):
class SignInButton(Button):
def __init__(self, driver):
super(SignInButton, self).__init__(driver, translation_id="sign-in")
super().__init__(driver, translation_id="sign-in")
def navigate(self):
from views.home_view import HomeView
@ -46,7 +53,7 @@ class SignInButton(Button):
class AccessKeyButton(Button):
def __init__(self, driver):
super(AccessKeyButton, self).__init__(driver, translation_id="access-existing-keys")
super().__init__(driver, translation_id="access-existing-keys")
def click(self):
self.scroll_to_element().click()
@ -55,7 +62,7 @@ class AccessKeyButton(Button):
class KeycardKeyStorageButton(Button):
def __init__(self, driver):
super(KeycardKeyStorageButton, self).__init__(driver, accessibility_id="select-storage-:advanced")
super().__init__(driver, accessibility_id="select-storage-:advanced")
def navigate(self):
from views.keycard_view import KeycardView
@ -87,15 +94,12 @@ class PrivacyPolicyLink(Button):
class SignInView(BaseView):
def __init__(self, driver, skip_popups=True):
super(SignInView, self).__init__(driver)
def __init__(self, driver):
super().__init__(driver)
self.driver = driver
# if skip_popups:
# self.accept_agreements()
self.password_input = EditBox(self.driver, accessibility_id="password-input")
self.sign_in_button = SignInButton(self.driver)
self.multi_account_on_login_button = MultiAccountOnLoginButton(self.driver)
self.access_key_button = AccessKeyButton(self.driver)
self.generate_key_button = Button(self.driver, translation_id="generate-new-key")
self.your_keys_more_icon = Button(self.driver, accessibility_id="your-keys-more-icon")
@ -111,6 +115,7 @@ class SignInView(BaseView):
self.keycard_storage_button = KeycardKeyStorageButton(self.driver)
self.first_username_on_choose_chat_name = Text(self.driver,
xpath="//*[@content-desc='select-account-button-0']//android.widget.TextView[1]")
self.get_keycard_banner = Button(self.driver, translation_id="get-a-keycard")
#keycard recovery
self.recover_with_keycard_button = Button(self.driver, accessibility_id="recover-with-keycard-button")
@ -121,6 +126,19 @@ class SignInView(BaseView):
self.seedphrase_input = EditBox(self.driver, xpath="//android.widget.EditText")
self.enter_seed_phrase_button = Button(self.driver, accessibility_id="enter-seed-phrase-button")
self.reencrypt_your_key_button = Button(self.driver, translation_id="re-encrypt-key")
# migrate multiaccount
self.options_button = Button(self.driver, accessibility_id="sign-in-options")
self.manage_keys_and_storage_button = Button(self.driver, accessibility_id="manage-keys-and-storage-button")
self.multi_account_on_login_button = MultiAccountOnLoginButton(self.driver)
self.move_keystore_file_option = Button(self.driver, accessibility_id="move-keystore-file")
self.move_and_reset_button = MoveAndResetButton(self.driver)
self.choose_storage_button = Button(self.driver, translation_id="choose-storage")
self.enter_seed_phrase_next_button = Button(self.driver, translation_id="enter-seed-phrase")
self.keycard_required_option = Button(self.driver, translation_id="empty-keycard-required")
# errors
self.custom_seed_phrase_label = Text(self.driver, translation_id="custom-seed-phrase")
self.continue_custom_seed_phrase_button = Button(self.driver, accessibility_id="continue-custom-seed-phrase")
self.cancel_custom_seed_phrase_button = Button(self.driver, accessibility_id="cancel-custom-seed-phrase")