2023-11-17 14:54:57 +00:00
|
|
|
import time
|
|
|
|
|
|
|
|
import allure
|
|
|
|
import pytest
|
|
|
|
from allure import step
|
2023-12-07 16:47:34 +00:00
|
|
|
from . import marks
|
2023-11-17 14:54:57 +00:00
|
|
|
|
|
|
|
import configs
|
|
|
|
import constants
|
|
|
|
import driver
|
|
|
|
from constants.keycard import Keycard
|
|
|
|
from gui.main_window import MainWindow
|
|
|
|
from gui.mocked_keycard_controller import MockedKeycardController
|
|
|
|
|
2023-12-07 16:47:34 +00:00
|
|
|
pytestmark = marks
|
2023-11-17 14:54:57 +00:00
|
|
|
|
2024-07-19 06:43:44 +00:00
|
|
|
|
2023-11-17 14:54:57 +00:00
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704607', 'Unlock Keycard')
|
|
|
|
@pytest.mark.case(704607)
|
2024-03-28 11:37:24 +00:00
|
|
|
@pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
|
2024-07-23 14:12:58 +00:00
|
|
|
@pytest.mark.skip(reason='https://github.com/status-im/status-desktop/issues/15741')
|
2023-11-17 14:54:57 +00:00
|
|
|
def test_unlock_keycard_using_correct_puk(main_screen: MainWindow, user_account):
|
2024-07-19 06:43:44 +00:00
|
|
|
timeout = configs.timeouts.UI_LOAD_TIMEOUT_MSEC
|
|
|
|
pin = Keycard.KEYCARD_PIN.value
|
|
|
|
incorrect_pin = Keycard.KEYCARD_INCORRECT_PIN.value
|
|
|
|
correct_puk = Keycard.KEYCARD_CORRECT_PUK.value
|
2023-11-17 14:54:57 +00:00
|
|
|
main_screen.prepare()
|
|
|
|
|
2024-07-19 06:43:44 +00:00
|
|
|
with step('Plug in reader and insert keycard'):
|
2023-11-17 14:54:57 +00:00
|
|
|
main_screen.hide()
|
|
|
|
keycard_controller = MockedKeycardController().wait_until_appears()
|
2024-07-19 06:43:44 +00:00
|
|
|
keycard_controller.plugin_reader().choose_mnemonic_metadata_keycard().register_keycard().insert_keycard_1()
|
2023-11-17 14:54:57 +00:00
|
|
|
main_screen.show()
|
|
|
|
|
|
|
|
with step('Choose option Check whats on keycard in settings'):
|
|
|
|
keycard_settings = main_screen.left_panel.open_settings().left_panel.open_keycard_settings()
|
|
|
|
keycard_popup = keycard_settings.click_check_whats_on_keycard()
|
|
|
|
|
|
|
|
with step('Enter incorrect PIN 3 times and verify keycard popup instructions are correct'):
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_ENTER_PIN.value in keycard_popup.keycard_instructions,
|
2024-07-19 06:43:44 +00:00
|
|
|
timeout), f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
|
|
|
for i in range(3):
|
|
|
|
keycard_popup.input_pin_or_puk(incorrect_pin)
|
|
|
|
time.sleep(1)
|
2023-11-17 14:54:57 +00:00
|
|
|
|
2024-07-19 06:43:44 +00:00
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_LOCKED.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_LOCKED_INCORRECT_PIN.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
|
|
|
|
with step('Click Unlock keycard button'):
|
|
|
|
keycard_popup.click_next()
|
|
|
|
|
|
|
|
with step('Verify keycard popup instructions are correct'):
|
2024-07-19 06:43:44 +00:00
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_UNLOCK.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
|
|
|
|
with step('Click Unlock using PUK and enter incorrect PUK'):
|
|
|
|
keycard_popup.click_unlock_puk()
|
|
|
|
keycard_popup.input_pin_or_puk(correct_puk)
|
|
|
|
time.sleep(1)
|
|
|
|
keycard_popup.click_next()
|
|
|
|
|
|
|
|
with step('Verify that asked to choose PIN'):
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_CHOOSE_PIN.value in keycard_popup.keycard_instructions,
|
2024-07-19 06:43:44 +00:00
|
|
|
timeout), f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
assert Keycard.KEYCARD_PIN_NOTE.value in keycard_popup.keycard_instructions
|
|
|
|
|
2024-07-19 06:43:44 +00:00
|
|
|
with step('Enter and repeat PIN and verify keycard popup instructions are correct'):
|
2023-11-17 14:54:57 +00:00
|
|
|
keycard_popup.input_pin_or_puk(pin)
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_REPEAT_PIN.value in keycard_popup.keycard_instructions), \
|
2024-07-19 06:43:44 +00:00
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
keycard_popup.input_pin_or_puk(pin)
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_PIN_SET.value in keycard_popup.keycard_instructions), \
|
2024-07-19 06:43:44 +00:00
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
keycard_popup.click_next()
|
|
|
|
|
|
|
|
with step('Verify keycard popup instructions are correct'):
|
2024-07-19 06:43:44 +00:00
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_UNLOCK_SUCCESSFUL.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704608', 'Unlock Keycard: incorrect PUK')
|
|
|
|
@pytest.mark.case(704608)
|
2024-03-28 11:37:24 +00:00
|
|
|
@pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
|
2024-07-23 14:12:58 +00:00
|
|
|
@pytest.mark.skip(reason='https://github.com/status-im/status-desktop/issues/15741')
|
2023-11-17 14:54:57 +00:00
|
|
|
def test_unlock_keycard_using_incorrect_puk(main_screen: MainWindow, user_account):
|
2024-07-19 06:43:44 +00:00
|
|
|
timeout = configs.timeouts.UI_LOAD_TIMEOUT_MSEC
|
|
|
|
pin = Keycard.KEYCARD_PIN.value
|
|
|
|
incorrect_pin = Keycard.KEYCARD_INCORRECT_PIN.value
|
|
|
|
incorrect_puk = Keycard.KEYCARD_INCORRECT_PUK.value
|
2023-11-17 14:54:57 +00:00
|
|
|
main_screen.prepare()
|
|
|
|
|
2024-07-19 06:43:44 +00:00
|
|
|
with step('Plug in reader and insert keycard'):
|
2023-11-17 14:54:57 +00:00
|
|
|
main_screen.hide()
|
|
|
|
keycard_controller = MockedKeycardController().wait_until_appears()
|
2024-07-19 06:43:44 +00:00
|
|
|
keycard_controller.plugin_reader().choose_mnemonic_metadata_keycard().register_keycard().insert_keycard_1()
|
2023-11-17 14:54:57 +00:00
|
|
|
main_screen.show()
|
|
|
|
|
|
|
|
with step('Choose option Check whats on keycard in settings'):
|
|
|
|
keycard_settings = main_screen.left_panel.open_settings().left_panel.open_keycard_settings()
|
|
|
|
keycard_popup = keycard_settings.click_check_whats_on_keycard()
|
|
|
|
|
|
|
|
with step('Enter incorrect PIN 3 times and verify keycard popup instructions are correct'):
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_ENTER_PIN.value in keycard_popup.keycard_instructions,
|
2024-07-19 06:43:44 +00:00
|
|
|
timeout), f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
|
|
|
for i in range(3):
|
|
|
|
keycard_popup.input_pin_or_puk(incorrect_pin)
|
|
|
|
time.sleep(1)
|
2023-11-17 14:54:57 +00:00
|
|
|
|
2024-07-19 06:43:44 +00:00
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_LOCKED.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_LOCKED_INCORRECT_PIN.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
|
|
|
|
with step('Click Unlock keycard button'):
|
|
|
|
keycard_popup.click_next()
|
|
|
|
|
|
|
|
with step('Verify keycard popup instructions are correct'):
|
2024-07-19 06:43:44 +00:00
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_UNLOCK.value in keycard_popup.keycard_instructions), \
|
2023-11-17 14:54:57 +00:00
|
|
|
f"There is no correct keycard instruction {keycard_popup.keycard_instructions}"
|
|
|
|
|
|
|
|
with step('Click Unlock using PUK and enter incorrect PUK'):
|
|
|
|
keycard_popup.click_unlock_puk()
|
|
|
|
keycard_popup.input_pin_or_puk(incorrect_puk)
|
|
|
|
time.sleep(1)
|
|
|
|
keycard_popup.click_next()
|
|
|
|
|
|
|
|
with step('Verify that asked to choose PIN'):
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_CHOOSE_PIN.value in keycard_popup.keycard_instructions,
|
2024-07-19 06:43:44 +00:00
|
|
|
timeout), f"There is no correct keycard instruction in in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
assert Keycard.KEYCARD_PIN_NOTE.value in keycard_popup.keycard_instructions
|
|
|
|
|
|
|
|
with step('Enter PIN and repeat PIN and verify keycard popup instructions are correct'):
|
|
|
|
keycard_popup.input_pin_or_puk(pin)
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_REPEAT_PIN.value in keycard_popup.keycard_instructions), \
|
2024-07-19 06:43:44 +00:00
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
keycard_popup.input_pin_or_puk(pin)
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_PIN_SET.value in keycard_popup.keycard_instructions), \
|
2024-07-19 06:43:44 +00:00
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
keycard_popup.click_next()
|
|
|
|
|
|
|
|
with step('Verify keycard popup instructions are correct'):
|
2024-07-19 06:43:44 +00:00
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_PUK_IS_INCORRECT.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_4_ATTEMPTS_REMAINING.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
|
|
|
|
with step('Enter incorrect PUK again'):
|
|
|
|
keycard_popup.input_pin_or_puk(incorrect_puk)
|
|
|
|
time.sleep(1)
|
|
|
|
keycard_popup.click_next()
|
|
|
|
|
|
|
|
with step('Verify keycard popup instructions are correct'):
|
2024-07-19 06:43:44 +00:00
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_PUK_IS_INCORRECT.value in keycard_popup.keycard_instructions), \
|
2023-11-17 14:54:57 +00:00
|
|
|
f"There is no correct keycard instruction {keycard_popup.keycard_instructions}"
|
2024-07-19 06:43:44 +00:00
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_3_ATTEMPTS_REMAINING.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
|
|
|
|
with step('Enter incorrect PUK again'):
|
|
|
|
keycard_popup.input_pin_or_puk(incorrect_puk)
|
|
|
|
time.sleep(1)
|
|
|
|
keycard_popup.click_next()
|
|
|
|
|
|
|
|
with step('Verify keycard popup instructions are correct'):
|
2024-07-19 06:43:44 +00:00
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_PUK_IS_INCORRECT.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_2_ATTEMPTS_REMAINING.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
|
|
|
|
with step('Enter incorrect PUK again'):
|
|
|
|
keycard_popup.input_pin_or_puk(incorrect_puk)
|
|
|
|
time.sleep(1)
|
|
|
|
keycard_popup.click_next()
|
|
|
|
|
|
|
|
with step('Verify keycard popup instructions are correct'):
|
|
|
|
assert driver.waitFor(
|
|
|
|
lambda: Keycard.KEYCARD_PUK_IS_INCORRECT.value in keycard_popup.keycard_instructions), \
|
2024-07-19 06:43:44 +00:00
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
assert driver.waitFor(
|
|
|
|
lambda: Keycard.KEYCARD_1_ATTEMPT_REMAINING.value in keycard_popup.keycard_instructions), \
|
2024-07-19 06:43:44 +00:00
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
2023-11-17 14:54:57 +00:00
|
|
|
|
|
|
|
with step('Enter incorrect PUK again'):
|
|
|
|
keycard_popup.input_pin_or_puk(incorrect_puk)
|
|
|
|
time.sleep(1)
|
|
|
|
keycard_popup.click_next()
|
|
|
|
|
|
|
|
with step('Verify keycard is locked and it says that PUK entered incorrectly'):
|
2024-07-19 06:43:44 +00:00
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_LOCKED.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|
|
|
|
assert driver.waitFor(lambda: Keycard.KEYCARD_LOCKED_INCORRECT_PUK.value in keycard_popup.keycard_instructions), \
|
|
|
|
f"There is no correct keycard instruction in {keycard_popup.keycard_instructions}"
|