From 5508cd96c913c351c12eb69c4ba3b492867cb2d0 Mon Sep 17 00:00:00 2001 From: Anastasiya Semenkevich Date: Mon, 17 Jun 2024 10:44:39 +0300 Subject: [PATCH] chore: do not hardcode fileuri so it becomes OS agnostic --- .../gui/components/community/create_community_popups.py | 7 +++++-- test/e2e/gui/screens/community_settings.py | 7 +++++-- test/e2e/gui/screens/messages.py | 4 +++- test/e2e/gui/screens/onboarding.py | 4 +++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/test/e2e/gui/components/community/create_community_popups.py b/test/e2e/gui/components/community/create_community_popups.py index 8b37498b41..c529d973df 100644 --- a/test/e2e/gui/components/community/create_community_popups.py +++ b/test/e2e/gui/components/community/create_community_popups.py @@ -1,4 +1,5 @@ import logging +import pathlib import typing import allure @@ -131,13 +132,15 @@ class CreateCommunityPopup(BasePopup): @allure.step('Set community logo without file upload dialog') def set_logo_without_file_upload_dialog(self, path): self._scroll.vertical_scroll_to(self._add_logo_button) - self._cropped_image_logo_item.object.cropImage('file://' + str(path)) + fileuri = pathlib.Path(str(path)).as_uri() + self._cropped_image_logo_item.object.cropImage(fileuri) return PictureEditPopup() @allure.step('Set community banner without file upload dialog') def set_banner_without_file_upload_dialog(self, path): self._scroll.vertical_scroll_to(self._add_banner_button) - self._cropped_image_banner_item.object.cropImage('file://' + str(path)) + fileuri = pathlib.Path(str(path)).as_uri() + self._cropped_image_banner_item.object.cropImage(fileuri) return PictureEditPopup() @allure.step('Get community color') diff --git a/test/e2e/gui/screens/community_settings.py b/test/e2e/gui/screens/community_settings.py index 8497a10656..693049f7aa 100644 --- a/test/e2e/gui/screens/community_settings.py +++ b/test/e2e/gui/screens/community_settings.py @@ -1,3 +1,4 @@ +import pathlib import time import typing @@ -180,12 +181,14 @@ class EditCommunityView(QObject): @allure.step('Set community logo without file upload dialog') def set_logo_without_file_upload_dialog(self, path): - self._cropped_image_edit_logo_item.object.cropImage('file://' + str(path)) + fileuri = pathlib.Path(str(path)).as_uri() + self._cropped_image_edit_logo_item.object.cropImage(fileuri) return PictureEditPopup() @allure.step('Set community banner without file upload dialog') def set_banner_without_file_upload_dialog(self, path): - self._cropped_image_edit_banner_item.object.cropImage('file://' + str(path)) + fileuri = pathlib.Path(str(path)).as_uri() + self._cropped_image_edit_banner_item.object.cropImage(fileuri) return PictureEditPopup() @property diff --git a/test/e2e/gui/screens/messages.py b/test/e2e/gui/screens/messages.py index f520652ddb..58962c8105 100644 --- a/test/e2e/gui/screens/messages.py +++ b/test/e2e/gui/screens/messages.py @@ -1,3 +1,4 @@ +import pathlib import time import typing from typing import List @@ -420,7 +421,8 @@ class ChatMessagesView(QObject): @allure.step('Send image to chat') def send_image_to_chat(self, path): - self._chat_input.object.selectImageString('file://' + str(path)) + fileuri = pathlib.Path(str(path)).as_uri() + self._chat_input.object.selectImageString(fileuri) for i in range(2): driver.nativeType('') diff --git a/test/e2e/gui/screens/onboarding.py b/test/e2e/gui/screens/onboarding.py index bf9f2d2bf5..9c20c8ae6b 100755 --- a/test/e2e/gui/screens/onboarding.py +++ b/test/e2e/gui/screens/onboarding.py @@ -1,4 +1,5 @@ import logging +import pathlib import time import typing from abc import abstractmethod @@ -333,7 +334,8 @@ class YourProfileView(OnboardingView): @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))) + fileuri = pathlib.Path(str(path)).as_uri() + image_cropper.cropImage(fileuri) return PictureEditPopup() @allure.step('Set profile picture with file dialog upload')