From 56d29866da4fdc05193faa454da1f4ef3e5c5d5f Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Thu, 15 Jul 2021 13:12:38 +0200 Subject: [PATCH] e2e: keycard settings e2e Signed-off-by: Churikova Tetiana --- .../ui/screens/keycard/pin/views.cljs | 3 +- .../atomic/account_management/test_keycard.py | 49 +++++++++++++++++++ test/appium/views/keycard_view.py | 4 +- test/appium/views/profile_view.py | 19 +++++++ translations/en.json | 2 +- 5 files changed, 73 insertions(+), 4 deletions(-) diff --git a/src/status_im/ui/screens/keycard/pin/views.cljs b/src/status_im/ui/screens/keycard/pin/views.cljs index 89ccb5907f..92a0fd5fcd 100644 --- a/src/status_im/ui/screens/keycard/pin/views.cljs +++ b/src/status_im/ui/screens/keycard/pin/views.cljs @@ -18,7 +18,8 @@ (defn numpad-button [n step enabled? small-screen?] [react/touchable-highlight {:on-press #(when enabled? - (re-frame/dispatch [:keycard.ui/pin-numpad-button-pressed n step]))} + (re-frame/dispatch [:keycard.ui/pin-numpad-button-pressed n step])) + :accessibility-label (str "numpad-button-" n)} [react/view (styles/numpad-button small-screen?) [react/text {:style styles/numpad-button-text} n]]]) diff --git a/test/appium/tests/atomic/account_management/test_keycard.py b/test/appium/tests/atomic/account_management/test_keycard.py index 8a8752ab41..004cb7593d 100644 --- a/test/appium/tests/atomic/account_management/test_keycard.py +++ b/test/appium/tests/atomic/account_management/test_keycard.py @@ -401,6 +401,55 @@ class TestCreateAccount(SingleDeviceTestCase): self.errors.verify_no_errors() + @marks.testrail_id(695841) + @marks.medium + def test_keycard_settings_pin_puk_pairing(self): + sign_in = SignInView(self.driver) + seed = basic_user['passphrase'] + home = sign_in.recover_access(passphrase=seed, keycard=True) + profile = home.profile_button.click() + + home.just_fyi("Checking changing PIN") + profile.keycard_button.scroll_and_click() + keycard = profile.change_pin_button.click() + keycard.enter_another_pin() + keycard.wait_for_element_starts_with_text('2 attempts left', 30) + keycard.enter_default_pin() + if not keycard.element_by_translation_id("new-pin-description").is_element_displayed(): + self.driver.fail("Screen for setting new pin is not shown!") + [keycard.enter_another_pin() for _ in range(2)] + if not keycard.element_by_translation_id("pin-changed").is_element_displayed(): + self.driver.fail("Popup about successful setting new PIN is not shown!") + keycard.ok_button.click() + + home.just_fyi("Checking changing PUK with new PIN") + profile.change_puk_button.click() + keycard.enter_another_pin() + if not keycard.element_by_translation_id("new-puk-description").is_element_displayed(): + self.driver.fail("Screen for setting new puk is not shown!") + [keycard.one_button.click() for _ in range(12)] + if not keycard.element_by_translation_id("repeat-puk").is_element_displayed(): + self.driver.fail("Confirmation screen for setting new puk is not shown!") + [keycard.one_button.click() for _ in range(12)] + if not keycard.element_by_translation_id("puk-changed").is_element_displayed(): + self.driver.fail("Popup about successful setting new PUK is not shown!") + keycard.ok_button.click() + + home.just_fyi("Checking setting pairing with new PIN") + profile.change_pairing_code_button.click() + keycard.enter_another_pin() + sign_in.create_password_input.set_value(common_password) + sign_in.confirm_your_password_input.set_value(common_password+"1") + if not keycard.element_by_translation_id("pairing-code_error1").is_element_displayed(): + self.errors.append("No error is shown when pairing codes don't match") + sign_in.confirm_your_password_input.delete_last_symbols(1) + sign_in.element_by_translation_id("change-pairing").click() + if not keycard.element_by_translation_id("pairing-changed").is_element_displayed(): + self.driver.fail("Popup about successful setting new pairing is not shown!") + keycard.ok_button.click() + + self.errors.verify_no_errors() + class TestKeycardCreateMultiaccountMultipleDevice(MultipleDeviceTestCase): @marks.testrail_id(5689) diff --git a/test/appium/views/keycard_view.py b/test/appium/views/keycard_view.py index 9a1657b5a2..d1a48c261a 100644 --- a/test/appium/views/keycard_view.py +++ b/test/appium/views/keycard_view.py @@ -16,8 +16,8 @@ class KeycardView(BaseView): self.connect_pairing_card_button = Button(self.driver, accessibility_id="connect-pairing-card") # Keyboard - self.one_button = SilentButton(self.driver, xpath="//*[@text='1']") - self.two_button = SilentButton(self.driver, xpath="//*[@text='2']") + self.one_button = SilentButton(self.driver, accessibility_id="numpad-button-1") + self.two_button = SilentButton(self.driver, accessibility_id="numpad-button-2") # Backup seed phrase self.confirm_seed_phrase_edit_box = EditBox(self.driver, accessibility_id="enter-word") diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index 2066ac852f..9934a356be 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -164,6 +164,17 @@ class ProfilePictureElement(Button): def __init__(self, driver): super().__init__(driver, accessibility_id="chat-icon") +class KeycardButton(Button): + + def navigate(self): + from views.keycard_view import KeycardView + return KeycardView(self.driver) + + def click(self): + self.scroll_to_element().click() + return self.navigate() + + class ProfileView(BaseView): @@ -259,6 +270,14 @@ class ProfileView(BaseView): self.advertise_device_button = Button(self.driver, accessibility_id="advertise-device") self.sync_all_button = Button(self.driver, translation_id="sync-all-devices") + #Keycard + self.keycard_button = Button(self.driver, accessibility_id="keycard-button") + self.change_pin_button = KeycardButton(self.driver, translation_id="change-pin") + self.change_puk_button = KeycardButton(self.driver, translation_id="change-puk") + self.change_pairing_code_button = KeycardButton(self.driver, translation_id="change-pairing") + self.create_keycard_backup_button = Button(self.driver, translation_id="keycard-backup") + + # Advanced self.advanced_button = AdvancedButton(self.driver) ## Network diff --git a/translations/en.json b/translations/en.json index 6e39995fa2..085a1e02db 100644 --- a/translations/en.json +++ b/translations/en.json @@ -999,7 +999,7 @@ "pairing-changed": "Pairing code has been changed", "pin-code": "6-digit passcode", "pin-mismatch": "Wrong passcode", - "pin-retries-left": "{{number}} attemps left", + "pin-retries-left": "{{number}} attempts left", "pin-one-attempt-blocked-before": "Be careful, you have only", "pin-one-attempt-frozen-before": "Be careful, you have only", "pin-one-attempt": " one attempt ",