chore: do not hardcode fileuri so it becomes OS agnostic

This commit is contained in:
Anastasiya Semenkevich 2024-06-17 10:44:39 +03:00 committed by Anastasiya
parent 4f999e3709
commit 5508cd96c9
4 changed files with 16 additions and 6 deletions

View File

@ -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')

View File

@ -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

View File

@ -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('<Return>')

View File

@ -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')