chore(all): rename _logger to LOG to match changes
Some of them were renamed in: https://github.com/status-im/desktop-qa-automation/pull/352 Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
76c04968fe
commit
255f88fbb0
|
@ -4,7 +4,7 @@ from os import path
|
||||||
from scripts.utils.system_path import SystemPath
|
from scripts.utils.system_path import SystemPath
|
||||||
from . import testpath, timeouts, testrail, squish, system
|
from . import testpath, timeouts, testrail, squish, system
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ._local import *
|
from ._local import *
|
||||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
||||||
|
|
||||||
import object
|
import object
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def walk_children(parent, depth: int = 1000):
|
def walk_children(parent, depth: int = 1000):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import pytest
|
||||||
import configs
|
import configs
|
||||||
from scripts.utils.system_path import SystemPath
|
from scripts.utils.system_path import SystemPath
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -16,11 +16,11 @@ def generate_test_data(request):
|
||||||
node_dir = configs.testpath.TEST / test_params
|
node_dir = configs.testpath.TEST / test_params
|
||||||
configs.testpath.TEST_ARTIFACTS = node_dir / 'artifacts'
|
configs.testpath.TEST_ARTIFACTS = node_dir / 'artifacts'
|
||||||
configs.testpath.TEST_VP = configs.testpath.VP / test_path / test_name
|
configs.testpath.TEST_VP = configs.testpath.VP / test_path / test_name
|
||||||
_logger.debug('Artifacts directory: %s',
|
LOG.debug('Artifacts directory: %s',
|
||||||
configs.testpath.TEST_ARTIFACTS.relative_to(configs.testpath.ROOT))
|
configs.testpath.TEST_ARTIFACTS.relative_to(configs.testpath.ROOT))
|
||||||
_logger.debug('Verification points directory: %s',
|
LOG.debug('Verification points directory: %s',
|
||||||
configs.testpath.TEST_VP.relative_to(configs.testpath.ROOT))
|
configs.testpath.TEST_VP.relative_to(configs.testpath.ROOT))
|
||||||
_logger.info(f'Start test: {test_name}')
|
LOG.info(f'Start test: {test_name}')
|
||||||
|
|
||||||
|
|
||||||
def generate_test_info(node):
|
def generate_test_info(node):
|
||||||
|
@ -40,6 +40,6 @@ def prepare_test_directory():
|
||||||
del_runs = runs[:len(runs) - keep_results]
|
del_runs = runs[:len(runs) - keep_results]
|
||||||
for run in del_runs:
|
for run in del_runs:
|
||||||
SystemPath(run).rmtree(ignore_errors=True)
|
SystemPath(run).rmtree(ignore_errors=True)
|
||||||
_logger.info(f"Remove old test run directory: {run.relative_to(configs.testpath.ROOT)}")
|
LOG.info(f"Remove old test run directory: {run.relative_to(configs.testpath.ROOT)}")
|
||||||
configs.testpath.RUN.mkdir(parents=True, exist_ok=True)
|
configs.testpath.RUN.mkdir(parents=True, exist_ok=True)
|
||||||
_logger.info(f"Created new test run directory: {configs.testpath.RUN.relative_to(configs.testpath.ROOT)}")
|
LOG.info(f"Created new test run directory: {configs.testpath.RUN.relative_to(configs.testpath.ROOT)}")
|
||||||
|
|
|
@ -14,7 +14,7 @@ from gui.elements.scroll import Scroll
|
||||||
from gui.elements.text_edit import TextEdit
|
from gui.elements.text_edit import TextEdit
|
||||||
from gui.screens.community import CommunityScreen
|
from gui.screens.community import CommunityScreen
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class CreateCommunitiesBanner(BasePopup):
|
class CreateCommunitiesBanner(BasePopup):
|
||||||
|
@ -78,7 +78,7 @@ class CreateCommunityPopup(BasePopup):
|
||||||
return OpenFileDialog().wait_until_appears()
|
return OpenFileDialog().wait_until_appears()
|
||||||
except LookupError as err:
|
except LookupError as err:
|
||||||
if attempt:
|
if attempt:
|
||||||
_logger.debug(err)
|
LOG.debug(err)
|
||||||
return self._open_logo_file_dialog(attempt - 1)
|
return self._open_logo_file_dialog(attempt - 1)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -7,7 +7,7 @@ from gui.elements.text_edit import TextEdit
|
||||||
from gui.elements.window import Window
|
from gui.elements.window import Window
|
||||||
from scripts.utils.system_path import SystemPath
|
from scripts.utils.system_path import SystemPath
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class OpenFileDialog(Window):
|
class OpenFileDialog(Window):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import allure
|
||||||
import driver
|
import driver
|
||||||
from gui.elements.object import QObject
|
from gui.elements.object import QObject
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Button(QObject):
|
class Button(QObject):
|
||||||
|
@ -20,6 +20,6 @@ class Button(QObject):
|
||||||
):
|
):
|
||||||
if None not in (x, y, button):
|
if None not in (x, y, button):
|
||||||
getattr(self.object, 'clicked')()
|
getattr(self.object, 'clicked')()
|
||||||
_logger.info(f'{self}: clicked')
|
LOG.info(f'{self}: clicked')
|
||||||
else:
|
else:
|
||||||
super(Button, self).click(x, y, button)
|
super(Button, self).click(x, y, button)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import configs
|
||||||
import driver
|
import driver
|
||||||
from gui.elements.object import QObject
|
from gui.elements.object import QObject
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class CheckBox(QObject):
|
class CheckBox(QObject):
|
||||||
|
@ -17,4 +17,4 @@ class CheckBox(QObject):
|
||||||
self.click(x, y)
|
self.click(x, y)
|
||||||
assert driver.waitFor(
|
assert driver.waitFor(
|
||||||
lambda: self.is_checked is value, configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Value not changed'
|
lambda: self.is_checked is value, configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Value not changed'
|
||||||
_logger.info(f'{self}: value changed to "{value}"')
|
LOG.info(f'{self}: value changed to "{value}"')
|
||||||
|
|
|
@ -8,7 +8,7 @@ import configs
|
||||||
import driver
|
import driver
|
||||||
from gui.elements.object import QObject
|
from gui.elements.object import QObject
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class List(QObject):
|
class List(QObject):
|
||||||
|
@ -30,7 +30,7 @@ class List(QObject):
|
||||||
@allure.step('Select item {1} in {0}')
|
@allure.step('Select item {1} in {0}')
|
||||||
def select(self, value: str, attr_name: str):
|
def select(self, value: str, attr_name: str):
|
||||||
driver.mouseClick(self.wait_for_item(value, attr_name))
|
driver.mouseClick(self.wait_for_item(value, attr_name))
|
||||||
_logger.info(f'{self}: {value} selected')
|
LOG.info(f'{self}: {value} selected')
|
||||||
|
|
||||||
@allure.step('Wait for item {1} in {0} with attribute {2}')
|
@allure.step('Wait for item {1} in {0} with attribute {2}')
|
||||||
def wait_for_item(self, value: str, attr_name: str, timeout_sec: int = configs.timeouts.UI_LOAD_TIMEOUT_SEC):
|
def wait_for_item(self, value: str, attr_name: str, timeout_sec: int = configs.timeouts.UI_LOAD_TIMEOUT_SEC):
|
||||||
|
@ -40,7 +40,7 @@ class List(QObject):
|
||||||
for index in range(self.object.count):
|
for index in range(self.object.count):
|
||||||
cur_value = str(getattr(self.object.itemAtIndex(index), attr_name, ''))
|
cur_value = str(getattr(self.object.itemAtIndex(index), attr_name, ''))
|
||||||
if cur_value == value:
|
if cur_value == value:
|
||||||
_logger.info(f'{self}: "{value}" for attribute "{attr_name}" appeared')
|
LOG.info(f'{self}: "{value}" for attribute "{attr_name}" appeared')
|
||||||
return self.object.itemAtIndex(index)
|
return self.object.itemAtIndex(index)
|
||||||
values.append(cur_value)
|
values.append(cur_value)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import driver
|
||||||
from gui import objects_map
|
from gui import objects_map
|
||||||
from scripts.tools.image import Image
|
from scripts.tools.image import Image
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class QObject:
|
class QObject:
|
||||||
|
@ -110,17 +110,17 @@ class QObject:
|
||||||
y or self.height // 2,
|
y or self.height // 2,
|
||||||
button or driver.Qt.LeftButton
|
button or driver.Qt.LeftButton
|
||||||
)
|
)
|
||||||
_logger.info(f'{self}: clicked')
|
LOG.info(f'{self}: clicked')
|
||||||
|
|
||||||
@allure.step('Hover {0}')
|
@allure.step('Hover {0}')
|
||||||
def hover(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
def hover(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
||||||
def _hover():
|
def _hover():
|
||||||
try:
|
try:
|
||||||
driver.mouseMove(self.object)
|
driver.mouseMove(self.object)
|
||||||
_logger.info(f'{self}: mouse hovered')
|
LOG.info(f'{self}: mouse hovered')
|
||||||
return getattr(self.object, 'hovered', True)
|
return getattr(self.object, 'hovered', True)
|
||||||
except RuntimeError as err:
|
except RuntimeError as err:
|
||||||
_logger.debug(err)
|
LOG.debug(err)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -138,18 +138,18 @@ class QObject:
|
||||||
y or self.height // 2,
|
y or self.height // 2,
|
||||||
driver.Qt.RightButton
|
driver.Qt.RightButton
|
||||||
)
|
)
|
||||||
_logger.info(f'{self}: clicked via Right Mouse Button')
|
LOG.info(f'{self}: clicked via Right Mouse Button')
|
||||||
|
|
||||||
@allure.step('Wait until appears {0}')
|
@allure.step('Wait until appears {0}')
|
||||||
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
||||||
assert driver.waitFor(lambda: self.is_visible, timeout_msec), f'Object {self} is not visible'
|
assert driver.waitFor(lambda: self.is_visible, timeout_msec), f'Object {self} is not visible'
|
||||||
_logger.info(f'{self}: is visible')
|
LOG.info(f'{self}: is visible')
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@allure.step('Wait until hidden {0}')
|
@allure.step('Wait until hidden {0}')
|
||||||
def wait_until_hidden(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
def wait_until_hidden(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
||||||
assert driver.waitFor(lambda: not self.is_visible, timeout_msec), f'Object {self} is not hidden'
|
assert driver.waitFor(lambda: not self.is_visible, timeout_msec), f'Object {self} is not hidden'
|
||||||
_logger.info(f'{self}: is hidden')
|
LOG.info(f'{self}: is hidden')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def wait_for(cls, condition, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC) -> bool:
|
def wait_for(cls, condition, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC) -> bool:
|
||||||
|
|
|
@ -6,7 +6,7 @@ import allure
|
||||||
import driver
|
import driver
|
||||||
from .object import QObject
|
from .object import QObject
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Scroll(QObject):
|
class Scroll(QObject):
|
||||||
|
@ -29,9 +29,9 @@ class Scroll(QObject):
|
||||||
if hasattr(element.object, 'height'):
|
if hasattr(element.object, 'height'):
|
||||||
y += int(element.object.height)
|
y += int(element.object.height)
|
||||||
driver.flick(self.object, 0, y)
|
driver.flick(self.object, 0, y)
|
||||||
_logger.info(f'{self}: scrolled to {element}')
|
LOG.info(f'{self}: scrolled to {element}')
|
||||||
except LookupError as err:
|
except LookupError as err:
|
||||||
_logger.debug(err)
|
LOG.debug(err)
|
||||||
|
|
||||||
@allure.step('Scroll down to object')
|
@allure.step('Scroll down to object')
|
||||||
def vertical_down_to(self, element: QObject, timeout_sec: int = 5):
|
def vertical_down_to(self, element: QObject, timeout_sec: int = 5):
|
||||||
|
@ -41,4 +41,4 @@ class Scroll(QObject):
|
||||||
driver.flick(self.object, 0, step)
|
driver.flick(self.object, 0, step)
|
||||||
if time.monotonic() - started_at > timeout_sec:
|
if time.monotonic() - started_at > timeout_sec:
|
||||||
raise LookupError(f'Object not found: {element}')
|
raise LookupError(f'Object not found: {element}')
|
||||||
_logger.info(f'{self}: scrolled down to {element}')
|
LOG.info(f'{self}: scrolled down to {element}')
|
||||||
|
|
|
@ -3,7 +3,7 @@ import allure
|
||||||
|
|
||||||
from gui.elements.object import QObject
|
from gui.elements.object import QObject
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Slider(QObject):
|
class Slider(QObject):
|
||||||
|
@ -34,4 +34,4 @@ class Slider(QObject):
|
||||||
if self.value > value:
|
if self.value > value:
|
||||||
while self.value > value:
|
while self.value > value:
|
||||||
self.object.decrease()
|
self.object.decrease()
|
||||||
_logger.info(f'{self}: value changed to "{value}"')
|
LOG.info(f'{self}: value changed to "{value}"')
|
||||||
|
|
|
@ -6,7 +6,7 @@ import configs
|
||||||
import driver
|
import driver
|
||||||
from gui.elements.object import QObject
|
from gui.elements.object import QObject
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TextEdit(QObject):
|
class TextEdit(QObject):
|
||||||
|
@ -27,7 +27,7 @@ class TextEdit(QObject):
|
||||||
@allure.step('Type: {1} in {0}')
|
@allure.step('Type: {1} in {0}')
|
||||||
def type_text(self, value: str):
|
def type_text(self, value: str):
|
||||||
driver.type(self.object, value)
|
driver.type(self.object, value)
|
||||||
_logger.info(f'{self}: value changed to "{value}"')
|
LOG.info(f'{self}: value changed to "{value}"')
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@allure.step('Clear {0}')
|
@allure.step('Clear {0}')
|
||||||
|
@ -36,5 +36,5 @@ class TextEdit(QObject):
|
||||||
if verify:
|
if verify:
|
||||||
assert driver.waitFor(lambda: not self.text), \
|
assert driver.waitFor(lambda: not self.text), \
|
||||||
f'Clear text field failed, value in field: "{self.text}"'
|
f'Clear text field failed, value in field: "{self.text}"'
|
||||||
_logger.info(f'{self}: cleared')
|
LOG.info(f'{self}: cleared')
|
||||||
return self
|
return self
|
||||||
|
|
|
@ -4,7 +4,7 @@ import allure
|
||||||
|
|
||||||
from gui.elements.object import QObject
|
from gui.elements.object import QObject
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TextLabel(QObject):
|
class TextLabel(QObject):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import configs
|
||||||
import driver
|
import driver
|
||||||
from gui.elements.object import QObject
|
from gui.elements.object import QObject
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Window(QObject):
|
class Window(QObject):
|
||||||
|
@ -20,39 +20,39 @@ class Window(QObject):
|
||||||
@allure.step("Maximize {0}")
|
@allure.step("Maximize {0}")
|
||||||
def maximize(self):
|
def maximize(self):
|
||||||
assert driver.toplevel_window.maximize(self.real_name), 'Maximize failed'
|
assert driver.toplevel_window.maximize(self.real_name), 'Maximize failed'
|
||||||
_logger.info(f'Window {getattr(self.object, "title", "")} is maximized')
|
LOG.info(f'Window {getattr(self.object, "title", "")} is maximized')
|
||||||
|
|
||||||
@allure.step("Minimize {0}")
|
@allure.step("Minimize {0}")
|
||||||
def minimize(self):
|
def minimize(self):
|
||||||
assert driver.toplevel_window.minimize(self.real_name), 'Minimize failed'
|
assert driver.toplevel_window.minimize(self.real_name), 'Minimize failed'
|
||||||
_logger.info(f'Window {getattr(self.object, "title", "")} is minimized')
|
LOG.info(f'Window {getattr(self.object, "title", "")} is minimized')
|
||||||
|
|
||||||
@allure.step("Set focus on {0}")
|
@allure.step("Set focus on {0}")
|
||||||
def set_focus(self):
|
def set_focus(self):
|
||||||
assert driver.toplevel_window.set_focus(self.real_name), 'Set focus failed'
|
assert driver.toplevel_window.set_focus(self.real_name), 'Set focus failed'
|
||||||
_logger.info(f'Window {getattr(self.object, "title", "")} in focus')
|
LOG.info(f'Window {getattr(self.object, "title", "")} in focus')
|
||||||
|
|
||||||
@allure.step("Move {0} on top")
|
@allure.step("Move {0} on top")
|
||||||
def on_top_level(self):
|
def on_top_level(self):
|
||||||
assert driver.toplevel_window.on_top_level(self.real_name), 'Set on top failed'
|
assert driver.toplevel_window.on_top_level(self.real_name), 'Set on top failed'
|
||||||
_logger.info(f'Window {getattr(self.object, "title", "")} moved on top')
|
LOG.info(f'Window {getattr(self.object, "title", "")} moved on top')
|
||||||
|
|
||||||
@allure.step("Close {0}")
|
@allure.step("Close {0}")
|
||||||
def close(self):
|
def close(self):
|
||||||
driver.toplevel_window.close(self.real_name)
|
driver.toplevel_window.close(self.real_name)
|
||||||
_logger.info(f'{self} closed')
|
LOG.info(f'{self} closed')
|
||||||
|
|
||||||
@allure.step("Show {0}")
|
@allure.step("Show {0}")
|
||||||
def show(self):
|
def show(self):
|
||||||
driver.waitForObjectExists(self.real_name).setVisible(True)
|
driver.waitForObjectExists(self.real_name).setVisible(True)
|
||||||
_logger.info(f'{self} is visible')
|
LOG.info(f'{self} is visible')
|
||||||
|
|
||||||
@allure.step("Hide {0}")
|
@allure.step("Hide {0}")
|
||||||
def hide(self):
|
def hide(self):
|
||||||
driver.waitForObjectExists(self.real_name).setVisible(False)
|
driver.waitForObjectExists(self.real_name).setVisible(False)
|
||||||
_logger.info(f'{self} hidden')
|
LOG.info(f'{self} hidden')
|
||||||
|
|
||||||
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
||||||
super().wait_until_appears(timeout_msec)
|
super().wait_until_appears(timeout_msec)
|
||||||
_logger.info(f'Window {getattr(self.object, "title", "")} appears')
|
LOG.info(f'Window {getattr(self.object, "title", "")} appears')
|
||||||
return self
|
return self
|
||||||
|
|
|
@ -25,7 +25,7 @@ from gui.screens.settings import SettingsScreen
|
||||||
from gui.screens.wallet import WalletScreen
|
from gui.screens.wallet import WalletScreen
|
||||||
from scripts.tools.image import Image
|
from scripts.tools.image import Image
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class LeftPanel(QObject):
|
class LeftPanel(QObject):
|
||||||
|
|
|
@ -20,7 +20,7 @@ from gui.elements.text_label import TextLabel
|
||||||
from scripts.tools.image import Image
|
from scripts.tools.image import Image
|
||||||
from scripts.utils.system_path import SystemPath
|
from scripts.utils.system_path import SystemPath
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class AllowNotificationsView(QObject):
|
class AllowNotificationsView(QObject):
|
||||||
|
|
|
@ -13,7 +13,7 @@ from gui.elements.object import QObject
|
||||||
from gui.elements.text_label import TextLabel
|
from gui.elements.text_label import TextLabel
|
||||||
from gui.screens.community_settings import CommunitySettingsScreen
|
from gui.screens.community_settings import CommunitySettingsScreen
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class CommunitiesSettingsView(QObject):
|
class CommunitiesSettingsView(QObject):
|
||||||
|
@ -43,7 +43,7 @@ class CommunitiesSettingsView(QObject):
|
||||||
try:
|
try:
|
||||||
members = self._community_template_members.text
|
members = self._community_template_members.text
|
||||||
except LookupError as err:
|
except LookupError as err:
|
||||||
_logger.info(err)
|
LOG.info(err)
|
||||||
members = 0
|
members = 0
|
||||||
image = self._community_template_image.image
|
image = self._community_template_image.image
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ from configs.system import IS_LIN
|
||||||
from scripts.tools.ocv import Ocv
|
from scripts.tools.ocv import Ocv
|
||||||
from scripts.utils.system_path import SystemPath
|
from scripts.utils.system_path import SystemPath
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Image:
|
class Image:
|
||||||
|
@ -53,7 +53,7 @@ class Image:
|
||||||
|
|
||||||
@allure.step('Grab image view from object')
|
@allure.step('Grab image view from object')
|
||||||
def update_view(self):
|
def update_view(self):
|
||||||
_logger.debug(f'Image view was grab from: {self.object_name}')
|
LOG.debug(f'Image view was grab from: {self.object_name}')
|
||||||
rect = driver.object.globalBounds(driver.waitForObject(self.object_name))
|
rect = driver.object.globalBounds(driver.waitForObject(self.object_name))
|
||||||
img = ImageGrab.grab(
|
img = ImageGrab.grab(
|
||||||
bbox=(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height),
|
bbox=(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height),
|
||||||
|
@ -77,10 +77,10 @@ class Image:
|
||||||
self.update_view()
|
self.update_view()
|
||||||
correlation = Ocv.compare_images(self.view, expected)
|
correlation = Ocv.compare_images(self.view, expected)
|
||||||
result = correlation >= threshold
|
result = correlation >= threshold
|
||||||
_logger.info(f'Images equals on: {abs(round(correlation, 4) * 100)}%')
|
LOG.info(f'Images equals on: {abs(round(correlation, 4) * 100)}%')
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
_logger.info(f'Screenshot comparison passed')
|
LOG.info(f'Screenshot comparison passed')
|
||||||
else:
|
else:
|
||||||
configs.testpath.TEST_ARTIFACTS.mkdir(parents=True, exist_ok=True)
|
configs.testpath.TEST_ARTIFACTS.mkdir(parents=True, exist_ok=True)
|
||||||
diff = Ocv.draw_contours(self.view, expected)
|
diff = Ocv.draw_contours(self.view, expected)
|
||||||
|
@ -97,7 +97,7 @@ class Image:
|
||||||
allure.attach(name='expected', body=expected_fp.read_bytes(), attachment_type=allure.attachment_type.PNG)
|
allure.attach(name='expected', body=expected_fp.read_bytes(), attachment_type=allure.attachment_type.PNG)
|
||||||
allure.attach(name='diff', body=diff_fp.read_bytes(), attachment_type=allure.attachment_type.PNG)
|
allure.attach(name='diff', body=diff_fp.read_bytes(), attachment_type=allure.attachment_type.PNG)
|
||||||
|
|
||||||
_logger.info(
|
LOG.info(
|
||||||
f"Screenshot comparison failed.\n"
|
f"Screenshot comparison failed.\n"
|
||||||
f"Actual, Diff and Expected screenshots are saved:\n"
|
f"Actual, Diff and Expected screenshots are saved:\n"
|
||||||
f"{configs.testpath.TEST_ARTIFACTS.relative_to(configs.testpath.ROOT)}.")
|
f"{configs.testpath.TEST_ARTIFACTS.relative_to(configs.testpath.ROOT)}.")
|
||||||
|
@ -112,7 +112,7 @@ class Image:
|
||||||
@allure.step('Parse text on image')
|
@allure.step('Parse text on image')
|
||||||
def to_string(self, custom_config: str):
|
def to_string(self, custom_config: str):
|
||||||
text: str = pytesseract.image_to_string(self.view, config=custom_config)
|
text: str = pytesseract.image_to_string(self.view, config=custom_config)
|
||||||
_logger.debug(f'Text on image: {text}')
|
LOG.debug(f'Text on image: {text}')
|
||||||
return text
|
return text
|
||||||
|
|
||||||
@allure.step('Verify: Image contains text: {1}')
|
@allure.step('Verify: Image contains text: {1}')
|
||||||
|
@ -227,8 +227,8 @@ def compare(actual: Image,
|
||||||
if (datetime.now() - start).seconds > timout_sec:
|
if (datetime.now() - start).seconds > timout_sec:
|
||||||
if configs.UPDATE_VP_ON_FAIL and expected_fp is not None:
|
if configs.UPDATE_VP_ON_FAIL and expected_fp is not None:
|
||||||
actual.save(expected_fp, force=True)
|
actual.save(expected_fp, force=True)
|
||||||
_logger.warning(f'VP file updated: {expected_fp}')
|
LOG.warning(f'VP file updated: {expected_fp}')
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise AssertionError('Images comparison failed')
|
raise AssertionError('Images comparison failed')
|
||||||
_logger.info(f'Screenshot comparison passed')
|
LOG.info(f'Screenshot comparison passed')
|
||||||
|
|
|
@ -5,7 +5,7 @@ import shutil
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SystemPath(pathlib.Path):
|
class SystemPath(pathlib.Path):
|
||||||
|
|
|
@ -12,7 +12,7 @@ from gui.components.picture_edit_popup import shift_image
|
||||||
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
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
Loading…
Reference in New Issue