chore: replace file dialog interactions with direct function
This commit is contained in:
parent
774916db18
commit
1fc44f5e3d
|
@ -90,7 +90,7 @@ class CreateCommunityPopup(BasePopup):
|
||||||
@allure.step('Set community logo')
|
@allure.step('Set community logo')
|
||||||
def logo(self, kwargs: dict):
|
def logo(self, kwargs: dict):
|
||||||
self._open_logo_file_dialog().open_file(kwargs['fp'])
|
self._open_logo_file_dialog().open_file(kwargs['fp'])
|
||||||
PictureEditPopup().wait_until_appears().make_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
|
PictureEditPopup().wait_until_appears().set_zoom_shift_for_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@allure.step('Get community banner')
|
@allure.step('Get community banner')
|
||||||
|
@ -101,7 +101,7 @@ class CreateCommunityPopup(BasePopup):
|
||||||
def banner(self, kwargs: dict):
|
def banner(self, kwargs: dict):
|
||||||
self._add_banner_button.click()
|
self._add_banner_button.click()
|
||||||
OpenFileDialog().wait_until_appears().open_file(kwargs['fp'])
|
OpenFileDialog().wait_until_appears().open_file(kwargs['fp'])
|
||||||
PictureEditPopup().wait_until_appears().make_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
|
PictureEditPopup().wait_until_appears().set_zoom_shift_for_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
|
||||||
|
|
||||||
@allure.step('Set community logo without file upload dialog')
|
@allure.step('Set community logo without file upload dialog')
|
||||||
def set_logo_without_file_upload_dialog(self, path):
|
def set_logo_without_file_upload_dialog(self, path):
|
||||||
|
@ -164,9 +164,9 @@ class CreateCommunityPopup(BasePopup):
|
||||||
@allure.step('Create community without file upload dialog usage')
|
@allure.step('Create community without file upload dialog usage')
|
||||||
def create_community(self, kwargs):
|
def create_community(self, kwargs):
|
||||||
self.set_logo_without_file_upload_dialog(kwargs['logo']['fp'])
|
self.set_logo_without_file_upload_dialog(kwargs['logo']['fp'])
|
||||||
PictureEditPopup().make_picture(None, None)
|
PictureEditPopup().set_zoom_shift_for_picture(None, None)
|
||||||
self.set_banner_without_file_upload_dialog(kwargs['banner']['fp'])
|
self.set_banner_without_file_upload_dialog(kwargs['banner']['fp'])
|
||||||
PictureEditPopup().make_picture(None, None)
|
PictureEditPopup().set_zoom_shift_for_picture(None, None)
|
||||||
for key in list(kwargs):
|
for key in list(kwargs):
|
||||||
if key in ['intro', 'outro'] and self._next_button.is_visible:
|
if key in ['intro', 'outro'] and self._next_button.is_visible:
|
||||||
self._next_button.click()
|
self._next_button.click()
|
||||||
|
|
|
@ -23,7 +23,7 @@ class PictureEditPopup(BasePopup):
|
||||||
self._slider_handler = QObject(names.o_DropShadow)
|
self._slider_handler = QObject(names.o_DropShadow)
|
||||||
|
|
||||||
@allure.step('Make picture')
|
@allure.step('Make picture')
|
||||||
def make_picture(
|
def set_zoom_shift_for_picture(
|
||||||
self,
|
self,
|
||||||
zoom: int = None,
|
zoom: int = None,
|
||||||
shift: shift_image = None
|
shift: shift_image = None
|
||||||
|
|
|
@ -906,7 +906,7 @@ mainWindow_insertDetailsViewChatKeyTxt_StyledText = {"container": mainWindow_Ins
|
||||||
mainWindow_EmojiHash = {"container": statusDesktop_mainWindow, "objectName": "publicKeyEmojiHash", "type": "EmojiHash", "visible": True}
|
mainWindow_EmojiHash = {"container": statusDesktop_mainWindow, "objectName": "publicKeyEmojiHash", "type": "EmojiHash", "visible": True}
|
||||||
mainWindow_Header_Title = {"container": statusDesktop_mainWindow, "objectName": "onboardingHeaderText", "type": "StyledText", "visible": True}
|
mainWindow_Header_Title = {"container": statusDesktop_mainWindow, "objectName": "onboardingHeaderText", "type": "StyledText", "visible": True}
|
||||||
mainWindow_userImageCopy_StatusSmartIdenticon = {"container": mainWindow_InsertDetailsView, "id": "userImageCopy", "type": "StatusSmartIdenticon", "unnamed": 1, "visible": True}
|
mainWindow_userImageCopy_StatusSmartIdenticon = {"container": mainWindow_InsertDetailsView, "id": "userImageCopy", "type": "StatusSmartIdenticon", "unnamed": 1, "visible": True}
|
||||||
|
profileImageCropper = {"container": statusDesktop_mainWindow, "objectName": "imageCropWorkflow", "type": "ImageCropWorkflow", "visible": True}
|
||||||
|
|
||||||
# Create Password View
|
# Create Password View
|
||||||
mainWindow_CreatePasswordView = {"container": statusDesktop_mainWindow, "type": "CreatePasswordView", "unnamed": 1, "visible": True}
|
mainWindow_CreatePasswordView = {"container": statusDesktop_mainWindow, "type": "CreatePasswordView", "unnamed": 1, "visible": True}
|
||||||
|
|
|
@ -152,7 +152,7 @@ class EditCommunityView(QObject):
|
||||||
def logo(self, kwargs: dict):
|
def logo(self, kwargs: dict):
|
||||||
self._add_logo_button.click()
|
self._add_logo_button.click()
|
||||||
OpenFileDialog().wait_until_appears().open_file(kwargs['fp'])
|
OpenFileDialog().wait_until_appears().open_file(kwargs['fp'])
|
||||||
PictureEditPopup().wait_until_appears().make_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
|
PictureEditPopup().wait_until_appears().set_zoom_shift_for_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@allure.step('Get community banner')
|
@allure.step('Get community banner')
|
||||||
|
@ -163,7 +163,7 @@ class EditCommunityView(QObject):
|
||||||
def banner(self, kwargs: dict):
|
def banner(self, kwargs: dict):
|
||||||
self._add_banner_button.click()
|
self._add_banner_button.click()
|
||||||
OpenFileDialog().wait_until_appears().open_file(kwargs['fp'])
|
OpenFileDialog().wait_until_appears().open_file(kwargs['fp'])
|
||||||
PictureEditPopup().wait_until_appears().make_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
|
PictureEditPopup().wait_until_appears().set_zoom_shift_for_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
|
||||||
|
|
||||||
@allure.step('Set community logo without file upload dialog')
|
@allure.step('Set community logo without file upload dialog')
|
||||||
def set_logo_without_file_upload_dialog(self, path):
|
def set_logo_without_file_upload_dialog(self, path):
|
||||||
|
@ -233,9 +233,9 @@ class EditCommunityView(QObject):
|
||||||
@allure.step('Edit community')
|
@allure.step('Edit community')
|
||||||
def edit(self, kwargs):
|
def edit(self, kwargs):
|
||||||
self.set_logo_without_file_upload_dialog(kwargs['logo']['fp'])
|
self.set_logo_without_file_upload_dialog(kwargs['logo']['fp'])
|
||||||
PictureEditPopup().make_picture(None, None)
|
PictureEditPopup().set_zoom_shift_for_picture(None, None)
|
||||||
self.set_banner_without_file_upload_dialog(kwargs['banner']['fp'])
|
self.set_banner_without_file_upload_dialog(kwargs['banner']['fp'])
|
||||||
PictureEditPopup().make_picture(None, None)
|
PictureEditPopup().set_zoom_shift_for_picture(None, None)
|
||||||
for key in list(kwargs):
|
for key in list(kwargs):
|
||||||
setattr(self, key, kwargs.get(key))
|
setattr(self, key, kwargs.get(key))
|
||||||
self._save_changes_button.click()
|
self._save_changes_button.click()
|
||||||
|
|
|
@ -268,6 +268,7 @@ class YourProfileView(OnboardingView):
|
||||||
self._clear_icon = QObject(names.mainWindow_clear_icon_StatusIcon)
|
self._clear_icon = QObject(names.mainWindow_clear_icon_StatusIcon)
|
||||||
self._identicon_ring = QObject(names.mainWindow_IdenticonRing)
|
self._identicon_ring = QObject(names.mainWindow_IdenticonRing)
|
||||||
self._view_header_title = TextLabel(names.mainWindow_Header_Title)
|
self._view_header_title = TextLabel(names.mainWindow_Header_Title)
|
||||||
|
self._image_crop_workflow = QObject(names.profileImageCropper)
|
||||||
|
|
||||||
def verify_profile_view_present(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
def verify_profile_view_present(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
||||||
driver.waitFor(lambda: self._view_header_title.exists, timeout_msec)
|
driver.waitFor(lambda: self._view_header_title.exists, timeout_msec)
|
||||||
|
@ -311,7 +312,13 @@ class YourProfileView(OnboardingView):
|
||||||
self._clear_icon.click()
|
self._clear_icon.click()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@allure.step('Set user image')
|
@allure.step('Set profile picture without file upload dialog')
|
||||||
|
def set_profile_picture(self, path) -> PictureEditPopup:
|
||||||
|
image_cropper = driver.waitForObjectExists(self._image_crop_workflow.real_name)
|
||||||
|
image_cropper.cropImage(('file://' + str(path)))
|
||||||
|
return PictureEditPopup()
|
||||||
|
|
||||||
|
@allure.step('Set profile picture with file dialog upload')
|
||||||
def set_user_image(self, fp: SystemPath) -> PictureEditPopup:
|
def set_user_image(self, fp: SystemPath) -> PictureEditPopup:
|
||||||
allure.attach(name='User image', body=fp.read_bytes(), attachment_type=allure.attachment_type.PNG)
|
allure.attach(name='User image', body=fp.read_bytes(), attachment_type=allure.attachment_type.PNG)
|
||||||
self._upload_picture_button.hover()
|
self._upload_picture_button.hover()
|
||||||
|
|
|
@ -10,7 +10,7 @@ from . import marks
|
||||||
import configs.timeouts
|
import configs.timeouts
|
||||||
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
|
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
|
||||||
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
|
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
|
||||||
from gui.components.picture_edit_popup import shift_image
|
from gui.components.picture_edit_popup import shift_image, PictureEditPopup
|
||||||
from gui.components.splash_screen import SplashScreen
|
from gui.components.splash_screen import SplashScreen
|
||||||
from gui.screens.onboarding import AllowNotificationsView, WelcomeToStatusView, BiometricsView, KeysView
|
from gui.screens.onboarding import AllowNotificationsView, WelcomeToStatusView, BiometricsView, KeysView
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ def keys_screen(main_window) -> KeysView:
|
||||||
|
|
||||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703421', 'Generate new keys')
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703421', 'Generate new keys')
|
||||||
@pytest.mark.case(703421)
|
@pytest.mark.case(703421)
|
||||||
# @pytest.mark.critical TODO: https://github.com/status-im/status-desktop/issues/13483
|
@pytest.mark.critical
|
||||||
@pytest.mark.parametrize('user_name, password, user_image, zoom, shift', [
|
@pytest.mark.parametrize('user_name, password, user_image, zoom, shift', [
|
||||||
pytest.param(
|
pytest.param(
|
||||||
''.join((random.choice(
|
''.join((random.choice(
|
||||||
|
@ -59,9 +59,8 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
|
||||||
f'Error message {profile_view.get_error_message} is present when it should not'
|
f'Error message {profile_view.get_error_message} is present when it should not'
|
||||||
|
|
||||||
with step('Click plus button and add user picture'):
|
with step('Click plus button and add user picture'):
|
||||||
if user_image is not None:
|
profile_view.set_profile_picture(configs.testpath.TEST_IMAGES / user_image)
|
||||||
profile_picture_popup = profile_view.set_user_image(configs.testpath.TEST_IMAGES / user_image)
|
PictureEditPopup().set_zoom_shift_for_picture(zoom=zoom, shift=shift)
|
||||||
profile_picture_popup.make_picture(zoom=zoom, shift=shift)
|
|
||||||
# TODO: find a way to verify the picture is there (changed to the custom one)
|
# TODO: find a way to verify the picture is there (changed to the custom one)
|
||||||
assert profile_view.get_profile_image is not None, f'Profile picture was not set / applied'
|
assert profile_view.get_profile_image is not None, f'Profile picture was not set / applied'
|
||||||
assert profile_view.is_identicon_ring_visible, f'Identicon ring is not present when it should'
|
assert profile_view.is_identicon_ring_visible, f'Identicon ring is not present when it should'
|
||||||
|
|
|
@ -17,6 +17,7 @@ from gui.screens.onboarding import BiometricsView, AllowNotificationsView, Welco
|
||||||
|
|
||||||
pytestmark = marks
|
pytestmark = marks
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def keys_screen(main_window) -> KeysView:
|
def keys_screen(main_window) -> KeysView:
|
||||||
with step('Open Generate new keys view'):
|
with step('Open Generate new keys view'):
|
||||||
|
@ -63,4 +64,3 @@ def test_import_seed_phrase(aut: AUT, keys_screen, main_window, user_account, au
|
||||||
user_canvas = main_window.left_panel.open_online_identifier()
|
user_canvas = main_window.left_panel.open_online_identifier()
|
||||||
profile_popup = user_canvas.open_profile_popup_from_online_identifier()
|
profile_popup = user_canvas.open_profile_popup_from_online_identifier()
|
||||||
assert profile_popup.user_name == user_account.name
|
assert profile_popup.user_name == user_account.name
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ from gui.components.settings.changes_detected_popup import ChangesDetectedToastM
|
||||||
from gui.main_window import MainWindow
|
from gui.main_window import MainWindow
|
||||||
|
|
||||||
pytestmark = marks
|
pytestmark = marks
|
||||||
|
|
||||||
|
|
||||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703006',
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703006',
|
||||||
'Set display name, bio and social links')
|
'Set display name, bio and social links')
|
||||||
@pytest.mark.case(703006)
|
@pytest.mark.case(703006)
|
||||||
|
|
Loading…
Reference in New Issue