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 . import testpath, timeouts, testrail, squish, system
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
from ._local import *
|
||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
|||
|
||||
import object
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def walk_children(parent, depth: int = 1000):
|
||||
|
|
|
@ -6,7 +6,7 @@ import pytest
|
|||
import configs
|
||||
from scripts.utils.system_path import SystemPath
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -16,11 +16,11 @@ def generate_test_data(request):
|
|||
node_dir = configs.testpath.TEST / test_params
|
||||
configs.testpath.TEST_ARTIFACTS = node_dir / 'artifacts'
|
||||
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))
|
||||
_logger.debug('Verification points directory: %s',
|
||||
LOG.debug('Verification points directory: %s',
|
||||
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):
|
||||
|
@ -40,6 +40,6 @@ def prepare_test_directory():
|
|||
del_runs = runs[:len(runs) - keep_results]
|
||||
for run in del_runs:
|
||||
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)
|
||||
_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.screens.community import CommunityScreen
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CreateCommunitiesBanner(BasePopup):
|
||||
|
@ -78,7 +78,7 @@ class CreateCommunityPopup(BasePopup):
|
|||
return OpenFileDialog().wait_until_appears()
|
||||
except LookupError as err:
|
||||
if attempt:
|
||||
_logger.debug(err)
|
||||
LOG.debug(err)
|
||||
return self._open_logo_file_dialog(attempt - 1)
|
||||
else:
|
||||
raise
|
||||
|
|
|
@ -7,7 +7,7 @@ from gui.elements.text_edit import TextEdit
|
|||
from gui.elements.window import Window
|
||||
from scripts.utils.system_path import SystemPath
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpenFileDialog(Window):
|
||||
|
|
|
@ -6,7 +6,7 @@ import allure
|
|||
import driver
|
||||
from gui.elements.object import QObject
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Button(QObject):
|
||||
|
@ -20,6 +20,6 @@ class Button(QObject):
|
|||
):
|
||||
if None not in (x, y, button):
|
||||
getattr(self.object, 'clicked')()
|
||||
_logger.info(f'{self}: clicked')
|
||||
LOG.info(f'{self}: clicked')
|
||||
else:
|
||||
super(Button, self).click(x, y, button)
|
||||
|
|
|
@ -6,7 +6,7 @@ import configs
|
|||
import driver
|
||||
from gui.elements.object import QObject
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CheckBox(QObject):
|
||||
|
@ -17,4 +17,4 @@ class CheckBox(QObject):
|
|||
self.click(x, y)
|
||||
assert driver.waitFor(
|
||||
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
|
||||
from gui.elements.object import QObject
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class List(QObject):
|
||||
|
@ -30,7 +30,7 @@ class List(QObject):
|
|||
@allure.step('Select item {1} in {0}')
|
||||
def select(self, value: str, attr_name: str):
|
||||
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}')
|
||||
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):
|
||||
cur_value = str(getattr(self.object.itemAtIndex(index), attr_name, ''))
|
||||
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)
|
||||
values.append(cur_value)
|
||||
time.sleep(1)
|
||||
|
|
|
@ -9,7 +9,7 @@ import driver
|
|||
from gui import objects_map
|
||||
from scripts.tools.image import Image
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class QObject:
|
||||
|
@ -110,17 +110,17 @@ class QObject:
|
|||
y or self.height // 2,
|
||||
button or driver.Qt.LeftButton
|
||||
)
|
||||
_logger.info(f'{self}: clicked')
|
||||
LOG.info(f'{self}: clicked')
|
||||
|
||||
@allure.step('Hover {0}')
|
||||
def hover(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
||||
def _hover():
|
||||
try:
|
||||
driver.mouseMove(self.object)
|
||||
_logger.info(f'{self}: mouse hovered')
|
||||
LOG.info(f'{self}: mouse hovered')
|
||||
return getattr(self.object, 'hovered', True)
|
||||
except RuntimeError as err:
|
||||
_logger.debug(err)
|
||||
LOG.debug(err)
|
||||
time.sleep(1)
|
||||
return False
|
||||
|
||||
|
@ -138,18 +138,18 @@ class QObject:
|
|||
y or self.height // 2,
|
||||
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}')
|
||||
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'
|
||||
_logger.info(f'{self}: is visible')
|
||||
LOG.info(f'{self}: is visible')
|
||||
return self
|
||||
|
||||
@allure.step('Wait until hidden {0}')
|
||||
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'
|
||||
_logger.info(f'{self}: is hidden')
|
||||
LOG.info(f'{self}: is hidden')
|
||||
|
||||
@classmethod
|
||||
def wait_for(cls, condition, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC) -> bool:
|
||||
|
|
|
@ -6,7 +6,7 @@ import allure
|
|||
import driver
|
||||
from .object import QObject
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Scroll(QObject):
|
||||
|
@ -29,9 +29,9 @@ class Scroll(QObject):
|
|||
if hasattr(element.object, 'height'):
|
||||
y += int(element.object.height)
|
||||
driver.flick(self.object, 0, y)
|
||||
_logger.info(f'{self}: scrolled to {element}')
|
||||
LOG.info(f'{self}: scrolled to {element}')
|
||||
except LookupError as err:
|
||||
_logger.debug(err)
|
||||
LOG.debug(err)
|
||||
|
||||
@allure.step('Scroll down to object')
|
||||
def vertical_down_to(self, element: QObject, timeout_sec: int = 5):
|
||||
|
@ -41,4 +41,4 @@ class Scroll(QObject):
|
|||
driver.flick(self.object, 0, step)
|
||||
if time.monotonic() - started_at > timeout_sec:
|
||||
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
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Slider(QObject):
|
||||
|
@ -34,4 +34,4 @@ class Slider(QObject):
|
|||
if self.value > value:
|
||||
while self.value > value:
|
||||
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
|
||||
from gui.elements.object import QObject
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TextEdit(QObject):
|
||||
|
@ -27,7 +27,7 @@ class TextEdit(QObject):
|
|||
@allure.step('Type: {1} in {0}')
|
||||
def type_text(self, value: str):
|
||||
driver.type(self.object, value)
|
||||
_logger.info(f'{self}: value changed to "{value}"')
|
||||
LOG.info(f'{self}: value changed to "{value}"')
|
||||
return self
|
||||
|
||||
@allure.step('Clear {0}')
|
||||
|
@ -36,5 +36,5 @@ class TextEdit(QObject):
|
|||
if verify:
|
||||
assert driver.waitFor(lambda: not self.text), \
|
||||
f'Clear text field failed, value in field: "{self.text}"'
|
||||
_logger.info(f'{self}: cleared')
|
||||
LOG.info(f'{self}: cleared')
|
||||
return self
|
||||
|
|
|
@ -4,7 +4,7 @@ import allure
|
|||
|
||||
from gui.elements.object import QObject
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TextLabel(QObject):
|
||||
|
|
|
@ -6,7 +6,7 @@ import configs
|
|||
import driver
|
||||
from gui.elements.object import QObject
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Window(QObject):
|
||||
|
@ -20,39 +20,39 @@ class Window(QObject):
|
|||
@allure.step("Maximize {0}")
|
||||
def maximize(self):
|
||||
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}")
|
||||
def minimize(self):
|
||||
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}")
|
||||
def set_focus(self):
|
||||
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")
|
||||
def on_top_level(self):
|
||||
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}")
|
||||
def close(self):
|
||||
driver.toplevel_window.close(self.real_name)
|
||||
_logger.info(f'{self} closed')
|
||||
LOG.info(f'{self} closed')
|
||||
|
||||
@allure.step("Show {0}")
|
||||
def show(self):
|
||||
driver.waitForObjectExists(self.real_name).setVisible(True)
|
||||
_logger.info(f'{self} is visible')
|
||||
LOG.info(f'{self} is visible')
|
||||
|
||||
@allure.step("Hide {0}")
|
||||
def hide(self):
|
||||
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):
|
||||
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
|
||||
|
|
|
@ -25,7 +25,7 @@ from gui.screens.settings import SettingsScreen
|
|||
from gui.screens.wallet import WalletScreen
|
||||
from scripts.tools.image import Image
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LeftPanel(QObject):
|
||||
|
|
|
@ -20,7 +20,7 @@ from gui.elements.text_label import TextLabel
|
|||
from scripts.tools.image import Image
|
||||
from scripts.utils.system_path import SystemPath
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AllowNotificationsView(QObject):
|
||||
|
|
|
@ -13,7 +13,7 @@ from gui.elements.object import QObject
|
|||
from gui.elements.text_label import TextLabel
|
||||
from gui.screens.community_settings import CommunitySettingsScreen
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CommunitiesSettingsView(QObject):
|
||||
|
@ -43,7 +43,7 @@ class CommunitiesSettingsView(QObject):
|
|||
try:
|
||||
members = self._community_template_members.text
|
||||
except LookupError as err:
|
||||
_logger.info(err)
|
||||
LOG.info(err)
|
||||
members = 0
|
||||
image = self._community_template_image.image
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ from configs.system import IS_LIN
|
|||
from scripts.tools.ocv import Ocv
|
||||
from scripts.utils.system_path import SystemPath
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Image:
|
||||
|
@ -53,7 +53,7 @@ class Image:
|
|||
|
||||
@allure.step('Grab image view from object')
|
||||
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))
|
||||
img = ImageGrab.grab(
|
||||
bbox=(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height),
|
||||
|
@ -77,10 +77,10 @@ class Image:
|
|||
self.update_view()
|
||||
correlation = Ocv.compare_images(self.view, expected)
|
||||
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:
|
||||
_logger.info(f'Screenshot comparison passed')
|
||||
LOG.info(f'Screenshot comparison passed')
|
||||
else:
|
||||
configs.testpath.TEST_ARTIFACTS.mkdir(parents=True, exist_ok=True)
|
||||
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='diff', body=diff_fp.read_bytes(), attachment_type=allure.attachment_type.PNG)
|
||||
|
||||
_logger.info(
|
||||
LOG.info(
|
||||
f"Screenshot comparison failed.\n"
|
||||
f"Actual, Diff and Expected screenshots are saved:\n"
|
||||
f"{configs.testpath.TEST_ARTIFACTS.relative_to(configs.testpath.ROOT)}.")
|
||||
|
@ -112,7 +112,7 @@ class Image:
|
|||
@allure.step('Parse text on image')
|
||||
def to_string(self, custom_config: str):
|
||||
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
|
||||
|
||||
@allure.step('Verify: Image contains text: {1}')
|
||||
|
@ -227,8 +227,8 @@ def compare(actual: Image,
|
|||
if (datetime.now() - start).seconds > timout_sec:
|
||||
if configs.UPDATE_VP_ON_FAIL and expected_fp is not None:
|
||||
actual.save(expected_fp, force=True)
|
||||
_logger.warning(f'VP file updated: {expected_fp}')
|
||||
LOG.warning(f'VP file updated: {expected_fp}')
|
||||
break
|
||||
else:
|
||||
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
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
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.screens.onboarding import AllowNotificationsView, WelcomeToStatusView, BiometricsView, KeysView
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
Loading…
Reference in New Issue