chore: image verifications added to keycard tests (#297)

This commit is contained in:
Valentina1133 2023-11-13 11:46:48 +01:00 committed by GitHub
parent 1ab9c878e9
commit 9491e0b28f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 72 additions and 7 deletions

View File

@ -2,3 +2,10 @@
PERMISSION_WELCOME_IMAGE_PATH = '/imports/assets/png/community/permissions2_3.png'
AIRDROPS_WELCOME_IMAGE_PATH = '/imports/assets/png/community/airdrops8_1.png'
TOKENS_WELCOME_IMAGE_PATH = '/imports/assets/png/community/mint2_1.png'
PLUG_IN_KEYCARD_IMAGE_PATH = '/imports/assets/png/keycard/empty-reader.png'
INSERT_KEYCARD_IMAGE_PATH = '/imports/assets/png/keycard/card_insert/img-15.png'
EMPTY_KEYCARD_IMAGE_PATH = '/imports/assets/png/keycard/card-empty.png'
KEYCARD_INSERTED_IMAGE_PATH = '/imports/assets/png/keycard/card-inserted.png'
CHOOSE_KEYCARD_PIN_IMAGE_PATH = '/imports/assets/png/keycard/enter-pin-0.png'
KEYCARD_SUCCESS_IMAGE_PATH = '/imports/assets/png/keycard/strong_success/img-20.png'
KEYCARD_RECOGNIZED_IMAGE_PATH = '/imports/assets/png/keycard/success/img-13.png'

View File

@ -17,7 +17,7 @@ class KeycardPopup(BasePopup):
def __init__(self):
super().__init__()
self._keycard_image = QObject('image_KeycardImage')
self._keycard_image = QObject('img_Image')
self._keycard_popup_header = TextLabel('headerTitle')
self._keycard_instruction_text = TextLabel('keycard_reader_instruction_text')
self._next_button = Button('nextStatusButton')
@ -39,9 +39,9 @@ class KeycardPopup(BasePopup):
self._cancel_button = Button('cancel_StatusButton')
@property
@allure.step('Get keycard image')
def keycard_image(self) -> Image:
return self._keycard_image.image
@allure.step('Get keycard image source path')
def keycard_image_source_path(self) -> str:
return str(self._keycard_image.object.source.path)
@property
@allure.step('Get keycard popup header')
@ -182,14 +182,13 @@ class KeycardPopup(BasePopup):
@allure.step('Import keycard via seed phrase')
def import_keycard_via_seed_phrase(self, seed_phrase_words: list, pin: str, keycard_name: str, account_name: str):
self.input_seed_phrase(seed_phrase_words)
self.name_keycard_and_account(keycard_name, account_name)
self.input_pin(pin)
self.input_pin(pin)
self.click_next()
self.name_keycard_and_account(keycard_name, account_name)
@allure.step('Input seed phrase')
def input_seed_phrase(self, seed_phrase_words: list):
self.click_next()
if len(seed_phrase_words) == 12:
self._seed_phrase_12_words_button.click()
elif len(seed_phrase_words) == 18:

View File

@ -322,6 +322,7 @@ leave_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_
# Create Keycard account with new seed phrase popup
cancel_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "id": "cancelButton", "type": "StatusButton", "visible": True}
image_KeycardImage = {"container": statusDesktop_mainWindow_overlay, "id": "image", "type": "KeycardImage", "unnamed": 1, "visible": True}
img_Image = {"container": statusDesktop_mainWindow_overlay, "id": "img", "type": "Image", "unnamed": 1, "visible": True}
headerTitle = {"container": statusDesktop_mainWindow_overlay, "objectName": "headerTitle", "type": "StatusBaseText", "visible": True}
o_KeycardInit = {"container": statusDesktop_mainWindow_overlay, "type": "KeycardInit", "unnamed": 1, "visible": True}
keycard_reader_instruction_text = {"container": statusDesktop_mainWindow_overlay, "type": "StatusBaseText", "visible": True}

View File

@ -1,3 +1,5 @@
import time
import allure
import pytest
from allure import step
@ -6,6 +8,8 @@ import configs
import constants
import driver
from constants import aut_options
from constants.images_paths import PLUG_IN_KEYCARD_IMAGE_PATH, INSERT_KEYCARD_IMAGE_PATH, EMPTY_KEYCARD_IMAGE_PATH, \
KEYCARD_SUCCESS_IMAGE_PATH, KEYCARD_INSERTED_IMAGE_PATH
from constants.keycard import Keycard
from gui.main_window import MainWindow
from gui.mocked_keycard_controller import MockedKeycardController
@ -27,6 +31,9 @@ def test_check_whats_on_keycard(main_screen: MainWindow, user_account, options):
assert Keycard.KEYCARD_INSTRUCTIONS_PLUG_IN.value in keycard_popup.keycard_instructions, \
"There is no correct keycard instruction"
with step('Keycard welcome image source path is correct'):
assert PLUG_IN_KEYCARD_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Plug in reader'):
main_screen.hide()
keycard_controller = MockedKeycardController().wait_until_appears()
@ -38,6 +45,9 @@ def test_check_whats_on_keycard(main_screen: MainWindow, user_account, options):
lambda: Keycard.KEYCARD_INSTRUCTIONS_INSERT_KEYCARD.value in keycard_popup.keycard_instructions,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), "There is no correct keycard instruction"
with step('Keycard image source path is correct'):
assert INSERT_KEYCARD_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Register and insert not status keycard'):
main_screen.hide()
keycard_controller.choose_not_status_keycard()
@ -70,6 +80,9 @@ def test_check_whats_on_keycard(main_screen: MainWindow, user_account, options):
assert driver.waitFor(lambda: Keycard.KEYCARD_NO_KEYPAIR.value in keycard_popup.keycard_instructions,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), "There is no correct keycard instruction"
with step('Keycard image source path is correct'):
assert EMPTY_KEYCARD_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Close keycard popup'):
keycard_popup.click_next()
@ -113,9 +126,16 @@ def test_check_whats_on_keycard(main_screen: MainWindow, user_account, options):
assert driver.waitFor(lambda: Keycard.KEYCARD_PIN_VERIFIED.value in keycard_popup.keycard_instructions), \
"There is no correct keycard instruction"
with step('Keycard image source path is correct'):
time.sleep(2)
assert KEYCARD_SUCCESS_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Close keycard popup'):
keycard_popup.click_next()
with step('Keycard image source path is correct'):
assert KEYCARD_INSERTED_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Verify that preview shows correct keycard and instructions are correct'):
assert driver.waitFor(lambda: Keycard.KEYCARD_ACCOUNTS.value in keycard_popup.keycard_instructions), \
"There is no correct keycard instruction"

View File

@ -1,3 +1,5 @@
import time
import allure
import pytest
from allure import step
@ -5,6 +7,8 @@ from allure import step
import configs
import driver
from constants import ColorCodes, aut_options
from constants.images_paths import PLUG_IN_KEYCARD_IMAGE_PATH, INSERT_KEYCARD_IMAGE_PATH, KEYCARD_SUCCESS_IMAGE_PATH, \
CHOOSE_KEYCARD_PIN_IMAGE_PATH
from constants.keycard import Keycard
from gui.main_window import MainWindow
from gui.mocked_keycard_controller import MockedKeycardController
@ -28,6 +32,9 @@ def test_create_keycard_account_with_new_seed_phrase(main_screen: MainWindow, op
assert Keycard.KEYCARD_INSTRUCTIONS_PLUG_IN.value in keycard_popup.keycard_instructions, \
"There is no correct keycard instruction"
with step('Keycard welcome image source path is correct'):
assert PLUG_IN_KEYCARD_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Plug in reader'):
main_screen.hide()
keycard_controller = MockedKeycardController().wait_until_appears()
@ -39,6 +46,9 @@ def test_create_keycard_account_with_new_seed_phrase(main_screen: MainWindow, op
lambda: Keycard.KEYCARD_INSTRUCTIONS_INSERT_KEYCARD.value in keycard_popup.keycard_instructions,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), "There is no correct keycard instruction"
with step('Keycard image source path is correct'):
assert INSERT_KEYCARD_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Register and insert keycard'):
main_screen.hide()
keycard_controller.register_keycard()
@ -53,6 +63,7 @@ def test_create_keycard_account_with_new_seed_phrase(main_screen: MainWindow, op
assert driver.waitFor(lambda: Keycard.KEYCARD_CHOOSE_PIN.value in keycard_popup.keycard_instructions,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), "There is no correct keycard instruction"
assert Keycard.KEYCARD_PIN_NOTE.value in keycard_popup.keycard_instructions
assert CHOOSE_KEYCARD_PIN_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Insert PIN and repeat PIN and verify keycard popup instructions are correct'):
pin = Keycard.KEYCARD_PIN.value
@ -76,4 +87,8 @@ def test_create_keycard_account_with_new_seed_phrase(main_screen: MainWindow, op
assert keycard_popup.keypair_account_name == account_name, "Account name in preview is incorrect"
assert keycard_popup.keypair_account_color == ColorCodes.BLUE.value, "Color in preview is incorrect"
with step('Keycard image source path is correct'):
time.sleep(2)
assert KEYCARD_SUCCESS_IMAGE_PATH == keycard_popup.keycard_image_source_path
keycard_popup.click_next()

View File

@ -1,3 +1,5 @@
import time
import allure
import pytest
from allure import step
@ -6,6 +8,7 @@ import configs
import constants
import driver
from constants import ColorCodes, aut_options
from constants.images_paths import PLUG_IN_KEYCARD_IMAGE_PATH, INSERT_KEYCARD_IMAGE_PATH, KEYCARD_SUCCESS_IMAGE_PATH
from constants.keycard import Keycard
from gui.main_window import MainWindow
from gui.mocked_keycard_controller import MockedKeycardController
@ -29,6 +32,8 @@ def test_import_restore_keycard_via_seed_phrase(main_screen: MainWindow, user_ac
with step('Verify instructions are correct'):
assert Keycard.KEYCARD_INSTRUCTIONS_PLUG_IN.value in keycard_popup.keycard_instructions, \
"There is no correct keycard instruction"
with step('Keycard welcome image source path is correct'):
assert PLUG_IN_KEYCARD_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Plug in reader'):
main_screen.hide()
@ -41,6 +46,9 @@ def test_import_restore_keycard_via_seed_phrase(main_screen: MainWindow, user_ac
lambda: Keycard.KEYCARD_INSTRUCTIONS_INSERT_KEYCARD.value in keycard_popup.keycard_instructions,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), "There is no correct keycard instruction"
with step('Keycard image source path is correct'):
assert INSERT_KEYCARD_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Register and insert keycard'):
main_screen.hide()
keycard_controller.register_keycard()
@ -66,4 +74,8 @@ def test_import_restore_keycard_via_seed_phrase(main_screen: MainWindow, user_ac
assert keycard_popup.keypair_account_name == account_name, "Account name in preview is incorrect"
assert keycard_popup.keypair_account_color == ColorCodes.BLUE.value, "Color in preview is incorrect"
keycard_popup.click_next()
with step('Keycard image source path is correct'):
time.sleep(2)
assert KEYCARD_SUCCESS_IMAGE_PATH == keycard_popup.keycard_image_source_path
keycard_popup.click_next()

View File

@ -1,3 +1,4 @@
import time
from pathlib import Path
import allure
@ -8,6 +9,8 @@ import configs
import constants
import driver
from constants import ColorCodes, aut_options
from constants.images_paths import PLUG_IN_KEYCARD_IMAGE_PATH, INSERT_KEYCARD_IMAGE_PATH, CHOOSE_KEYCARD_PIN_IMAGE_PATH, \
KEYCARD_SUCCESS_IMAGE_PATH
from constants.keycard import Keycard
from gui.components.community.authenticate_popup import AuthenticatePopup
from gui.main_window import MainWindow
@ -61,6 +64,9 @@ def test_setup_keycard_with_existing_account(main_screen: MainWindow, user_accou
assert Keycard.KEYCARD_INSTRUCTIONS_PLUG_IN.value in keycard_popup.keycard_instructions, \
"There is no correct keycard instruction"
with step('Keycard welcome image source path is correct'):
assert PLUG_IN_KEYCARD_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Verify input seed phrase button is disabled'):
assert not keycard_popup.is_next_button_enabled
@ -95,6 +101,7 @@ def test_setup_keycard_with_existing_account(main_screen: MainWindow, user_accou
assert driver.waitFor(lambda: Keycard.KEYCARD_CHOOSE_PIN.value in keycard_popup.keycard_instructions,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), "There is no correct keycard instruction"
assert Keycard.KEYCARD_PIN_NOTE.value in keycard_popup.keycard_instructions
assert CHOOSE_KEYCARD_PIN_IMAGE_PATH == keycard_popup.keycard_image_source_path
with step('Insert PIN and repeat PIN and verify keycard popup instructions are correct'):
pin = Keycard.KEYCARD_PIN.value
@ -122,4 +129,8 @@ def test_setup_keycard_with_existing_account(main_screen: MainWindow, user_accou
assert driver.waitFor(
lambda: Keycard.KEYCARD_COMPLETE_MIGRATION.value in keycard_popup.keycard_instructions,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), "There is no correct keycard instruction"
with step('Keycard image source path is correct'):
time.sleep(2)
assert KEYCARD_SUCCESS_IMAGE_PATH == keycard_popup.keycard_image_source_path
keycard_popup.click_next()