interruption keycard flows e2e

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-04-30 13:39:21 +02:00
parent bf706e8fd2
commit 00422cec6f
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
4 changed files with 159 additions and 1 deletions

View File

@ -75,3 +75,125 @@ class TestCreateAccount(SingleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(6240)
@marks.medium
def test_keycard_interruption_creating_onboarding_flow(self):
sign_in = SignInView(self.driver)
sign_in.just_fyi('Cancel on PIN code setup stage')
sign_in.get_started_button.click()
sign_in.generate_key_button.click()
username = sign_in.first_username_on_choose_chat_name.text
sign_in.next_button.click()
keycard_flow = sign_in.keycard_storage_button.click()
keycard_flow.next_button.click()
keycard_flow.begin_setup_button.click()
keycard_flow.connect_card_button.click()
keycard_flow.enter_another_pin()
keycard_flow.cancel_button.click()
if not keycard_flow.element_by_text_part('Dangerous operation').is_element_displayed():
self.driver.fail('No Dangerous operation popup is shown on canceling operation from PIN code stage')
keycard_flow.yes_button.click()
sign_in.just_fyi('Cancel on Pair code stage: initialized')
keycard_flow.begin_setup_button.click()
keycard_flow.enter_default_pin()
keycard_flow.enter_default_pin()
keycard_flow.wait_for_element_starts_with_text('Write codes down')
pair_code = keycard_flow.pair_code_text.text
keycard_flow.cancel_button.click()
if not keycard_flow.element_by_text_part('Dangerous operation').is_element_displayed():
self.driver.fail('No Dangerous operation popup is shown on canceling operation from Pair code stage')
keycard_flow.yes_button.click()
sign_in.just_fyi('Cancel from Confirm seed phrase: initialized + 1 pairing slot is used')
keycard_flow.begin_setup_button.click()
keycard_flow.pair_code_input.set_value(pair_code)
keycard_flow.pair_to_this_device_button.click()
seed_phrase = keycard_flow.get_seed_phrase()
keycard_flow.confirm_button.click()
keycard_flow.yes_button.click()
keycard_flow.cancel_button.click()
if not keycard_flow.element_by_text_part('Dangerous operation').is_element_displayed():
self.driver.fail('No Dangerous operation popup is shown on canceling operation during Backup seed phrase stage')
keycard_flow.yes_button.click()
if not keycard_flow.element_by_text_part('Back up seed phrase').is_element_displayed():
self.driver.fail('On canceling setup from Confirm seed phrase was not redirected to expected screen')
sign_in.just_fyi('Cancel from Back Up seed phrase: initialized + 1 pairing slot is used')
keycard_flow.cancel_button.click()
keycard_flow.yes_button.click()
keycard_flow.begin_setup_button.click()
keycard_flow.wait_for_element_starts_with_text('Back up seed phrase')
new_seed_phrase = keycard_flow.get_seed_phrase()
if new_seed_phrase != seed_phrase:
self.errors.append('Another seed phrase is shown after cancelling setup during Back up seed phrase')
keycard_flow.backup_seed_phrase()
keycard_flow.enter_default_pin()
sign_in.lets_go_button.wait_for_visibility_of_element(30)
sign_in.lets_go_button.click_until_absense_of_element(sign_in.lets_go_button)
sign_in.profile_button.wait_for_visibility_of_element(30)
sign_in.just_fyi('Check username and relogin')
profile = sign_in.get_profile_view()
public_key, real_username = profile.get_public_key_and_username(return_username=True)
if real_username != username:
self.errors.append('Username was changed after interruption of creating account')
profile.logout()
sign_in.sign_in(keycard=True)
self.errors.verify_no_errors()
@marks.testrail_id(6246)
@marks.medium
def test_keycard_interruption_access_key_onboarding_flow(self):
sign_in = SignInView(self.driver)
recover_access = sign_in.access_key_button.click()
recover_access.enter_seed_phrase_button.click()
recover_access.seedphrase_input.click()
recover_access.seedphrase_input.set_value(basic_user['passphrase'])
recover_access.next_button.click()
recover_access.reencrypt_your_key_button.click()
keycard_flow = sign_in.keycard_storage_button.click()
sign_in.just_fyi('Cancel on PIN code setup stage')
keycard_flow.next_button.click()
keycard_flow.begin_setup_button.click()
keycard_flow.connect_card_button.click()
keycard_flow.enter_another_pin()
keycard_flow.cancel_button.click()
if not keycard_flow.element_by_text_part('Dangerous operation').is_element_displayed():
self.driver.fail('No Dangerous operation popup is shown on canceling operation from PIN code stage')
keycard_flow.yes_button.click()
sign_in.just_fyi('Cancel on Pair code stage: initialized')
keycard_flow.begin_setup_button.click()
keycard_flow.enter_default_pin()
keycard_flow.enter_default_pin()
keycard_flow.wait_for_element_starts_with_text('Write codes down')
pair_code = keycard_flow.pair_code_text.text
keycard_flow.cancel_button.click()
if not keycard_flow.element_by_text_part('Dangerous operation').is_element_displayed():
self.driver.fail('No Dangerous operation popup is shown on canceling operation from Pair code stage')
keycard_flow.yes_button.click()
sign_in.just_fyi('Finish setup and relogin')
keycard_flow.begin_setup_button.click()
if not keycard_flow.element_by_text_part('5 free pairing slots').is_element_displayed():
self.errors.append('Number of free pairing slots is not shown or wrong')
keycard_flow.pair_code_input.set_value(pair_code)
keycard_flow.pair_to_this_device_button.click()
keycard_flow.enter_default_pin()
sign_in.lets_go_button.wait_for_visibility_of_element(30)
sign_in.lets_go_button.click_until_absense_of_element(sign_in.lets_go_button)
sign_in.profile_button.wait_for_visibility_of_element(30)
public_key, default_username = sign_in.get_public_key_and_username(return_username=True)
profile_view = 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_view.logout()
sign_in.sign_in(keycard=True)
self.errors.verify_no_errors()

View File

@ -54,6 +54,10 @@ class DenyButton(BaseButton):
super(DenyButton, self).__init__(driver) super(DenyButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Deny' or @text='DENY']") self.locator = self.Locator.xpath_selector("//*[@text='Deny' or @text='DENY']")
class CancelButton(BaseButton):
def __init__(self, driver):
super(CancelButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Cancel' or @text='CANCEL']")
class DeleteButton(BaseButton): class DeleteButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
@ -371,6 +375,7 @@ class BaseView(object):
self.progress_bar = ProgressBar(self.driver) self.progress_bar = ProgressBar(self.driver)
self.cross_icon_iside_welcome_screen_button = CrossIconInWelcomeScreen(self.driver) self.cross_icon_iside_welcome_screen_button = CrossIconInWelcomeScreen(self.driver)
self.status_in_background_button = StatusInBackgroundButton(self.driver) self.status_in_background_button = StatusInBackgroundButton(self.driver)
self.cancel_button = CancelButton(self.driver)
# external browser # external browser

View File

@ -58,6 +58,20 @@ class ConfirmSeedPhraseInput(BaseEditBox):
super(ConfirmSeedPhraseInput, self).__init__(driver) super(ConfirmSeedPhraseInput, self).__init__(driver)
self.locator = self.Locator.accessibility_id("enter-word") self.locator = self.Locator.accessibility_id("enter-word")
class PairCodeText(BaseText):
def __init__(self, driver):
super(PairCodeText, self).__init__(driver)
self.locator = self.Locator.accessibility_id("pair-code")
class PairCodeInput(BaseEditBox):
def __init__(self, driver):
super(PairCodeInput, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//android.widget.EditText")
class PairToThisDeviceButton(BaseButton):
def __init__(self, driver):
super(PairToThisDeviceButton, self).__init__(driver)
self.locator = self.Locator.text_selector("Pair to this device")
class KeycardView(BaseView): class KeycardView(BaseView):
def __init__(self, driver): def __init__(self, driver):
@ -67,6 +81,9 @@ class KeycardView(BaseView):
self.disconnect_card_button = DisconnectCardButton(self.driver) self.disconnect_card_button = DisconnectCardButton(self.driver)
self.reset_card_state_button = ResetCardButton(self.driver) self.reset_card_state_button = ResetCardButton(self.driver)
self.connect_selected_card_button = ConnectSelectedCardButton(self.driver) self.connect_selected_card_button = ConnectSelectedCardButton(self.driver)
self.pair_code_text = PairCodeText(self.driver)
self.pair_code_input = PairCodeInput(self.driver)
self.pair_to_this_device_button = PairToThisDeviceButton(self.driver)
#keyboard #keyboard
self.one_button = OnePinKeyboardButton(self.driver) self.one_button = OnePinKeyboardButton(self.driver)
@ -80,6 +97,10 @@ class KeycardView(BaseView):
self.one_button.click() self.one_button.click()
self.two_button.click() self.two_button.click()
def enter_another_pin(self):
for _ in range(6):
self.two_button.click()
def get_recovery_word(self, word_id): def get_recovery_word(self, word_id):
word_element = RecoveryWordText(self.driver, word_id) word_element = RecoveryWordText(self.driver, word_id)
return word_element.text return word_element.text
@ -90,11 +111,15 @@ class KeycardView(BaseView):
word_number = ''.join(i for i in full_text if i.isdigit()) word_number = ''.join(i for i in full_text if i.isdigit())
return word_number return word_number
def backup_seed_phrase(self): def get_seed_phrase(self):
recovery_phrase = dict() recovery_phrase = dict()
for i in range(0,12): for i in range(0,12):
word = self.get_recovery_word(i) word = self.get_recovery_word(i)
recovery_phrase[str(i+1)] = word recovery_phrase[str(i+1)] = word
return recovery_phrase
def backup_seed_phrase(self):
recovery_phrase = self.get_seed_phrase()
self.confirm_button.click() self.confirm_button.click()
self.yes_button.click() self.yes_button.click()
for _ in range(2): for _ in range(2):

View File

@ -35,6 +35,11 @@ class RecoverAccountPasswordInput(BaseEditBox):
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Password']" self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Password']"
"/following-sibling::android.view.ViewGroup/android.widget.EditText") "/following-sibling::android.view.ViewGroup/android.widget.EditText")
class FirstKeyForChatText(BaseText):
def __init__(self, driver):
super(FirstKeyForChatText, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@content-desc="select-account-button-0"]//android.widget.TextView[1]')
class CreatePasswordInput(BaseEditBox): class CreatePasswordInput(BaseEditBox):
def __init__(self, driver): def __init__(self, driver):
@ -215,6 +220,7 @@ class SignInView(BaseView):
self.privacy_policy_link = PrivacyPolicyLink(self.driver) self.privacy_policy_link = PrivacyPolicyLink(self.driver)
self.lets_go_button = LetsGoButton(self.driver) self.lets_go_button = LetsGoButton(self.driver)
self.keycard_storage_button = KeycardKeyStorageButton(self.driver) self.keycard_storage_button = KeycardKeyStorageButton(self.driver)
self.first_username_on_choose_chat_name = FirstKeyForChatText(self.driver)
def create_user(self, password=common_password, keycard=False): def create_user(self, password=common_password, keycard=False):
self.get_started_button.click() self.get_started_button.click()