chore(all) rename _logger to LOG to match refactor
Related to: 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
4e6d6ed740
commit
9e63b10b8b
|
@ -20,7 +20,7 @@ def generate_test_data(request):
|
|||
configs.testpath.TEST_ARTIFACTS.relative_to(configs.testpath.ROOT))
|
||||
LOG.debug('Verification points directory: %s',
|
||||
configs.testpath.TEST_VP.relative_to(configs.testpath.ROOT))
|
||||
LOG.info(f'Start test: {test_name}')
|
||||
LOG.info('Start test: %s', test_name)
|
||||
|
||||
|
||||
def generate_test_info(node):
|
||||
|
|
|
@ -20,6 +20,6 @@ class Button(QObject):
|
|||
):
|
||||
if None not in (x, y, button):
|
||||
getattr(self.object, 'clicked')()
|
||||
LOG.info(f'{self}: clicked')
|
||||
LOG.info('%s: clicked', self)
|
||||
else:
|
||||
super(Button, self).click(x, y, button)
|
||||
|
|
|
@ -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'
|
||||
LOG.info(f'{self}: value changed to "{value}"')
|
||||
LOG.info('%s: value changed to "%s"', self, value)
|
||||
|
|
|
@ -110,17 +110,17 @@ class QObject:
|
|||
y or self.height // 2,
|
||||
button or driver.Qt.LeftButton
|
||||
)
|
||||
LOG.info(f'{self}: clicked')
|
||||
LOG.info('%s: clicked', self)
|
||||
|
||||
@allure.step('Hover {0}')
|
||||
def hover(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
||||
def _hover():
|
||||
try:
|
||||
driver.mouseMove(self.object)
|
||||
LOG.info(f'{self}: mouse hovered')
|
||||
LOG.info('%s: mouse hovered', self)
|
||||
return getattr(self.object, 'hovered', True)
|
||||
except RuntimeError as err:
|
||||
LOG.debug(err)
|
||||
LOG.error(err)
|
||||
time.sleep(1)
|
||||
return False
|
||||
|
||||
|
@ -138,18 +138,18 @@ class QObject:
|
|||
y or self.height // 2,
|
||||
driver.Qt.RightButton
|
||||
)
|
||||
LOG.info(f'{self}: clicked via Right Mouse Button')
|
||||
LOG.info('%s: clicked via Right Mouse Button', self)
|
||||
|
||||
@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'
|
||||
LOG.info(f'{self}: is visible')
|
||||
LOG.info('%s: is visible', self)
|
||||
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'
|
||||
LOG.info(f'{self}: is hidden')
|
||||
LOG.info('%s: is hidden', self)
|
||||
|
||||
@classmethod
|
||||
def wait_for(cls, condition, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC) -> bool:
|
||||
|
|
|
@ -29,9 +29,9 @@ class Scroll(QObject):
|
|||
if hasattr(element.object, 'height'):
|
||||
y += int(element.object.height)
|
||||
driver.flick(self.object, 0, y)
|
||||
LOG.info(f'{self}: scrolled to {element}')
|
||||
LOG.info('%s: scrolled to %s', self, element)
|
||||
except LookupError as err:
|
||||
LOG.debug(err)
|
||||
LOG.error(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}')
|
||||
LOG.info(f'{self}: scrolled down to {element}')
|
||||
LOG.info('%s: scrolled down to %s', self, element)
|
||||
|
|
|
@ -34,4 +34,4 @@ class Slider(QObject):
|
|||
if self.value > value:
|
||||
while self.value > value:
|
||||
self.object.decrease()
|
||||
LOG.info(f'{self}: value changed to "{value}"')
|
||||
LOG.debug('%s: value changed to "%s"', self, value)
|
||||
|
|
|
@ -27,7 +27,7 @@ class TextEdit(QObject):
|
|||
@allure.step('Type: {1} in {0}')
|
||||
def type_text(self, value: str):
|
||||
driver.type(self.object, value)
|
||||
LOG.info(f'{self}: value changed to "{value}"')
|
||||
LOG.info('%s: value changed to "%s"', self, 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}"'
|
||||
LOG.info(f'{self}: cleared')
|
||||
LOG.info('%s: cleared', self)
|
||||
return self
|
||||
|
|
|
@ -17,42 +17,46 @@ class Window(QObject):
|
|||
self.on_top_level()
|
||||
return self
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
return str(getattr(self.object, 'title', ''))
|
||||
|
||||
@allure.step("Maximize {0}")
|
||||
def maximize(self):
|
||||
assert driver.toplevel_window.maximize(self.real_name), 'Maximize failed'
|
||||
LOG.info(f'Window {getattr(self.object, "title", "")} is maximized')
|
||||
LOG.info('Window %s was maximized', self.title)
|
||||
|
||||
@allure.step("Minimize {0}")
|
||||
def minimize(self):
|
||||
assert driver.toplevel_window.minimize(self.real_name), 'Minimize failed'
|
||||
LOG.info(f'Window {getattr(self.object, "title", "")} is minimized')
|
||||
LOG.info('Window %s was minimized', self.title)
|
||||
|
||||
@allure.step("Set focus on {0}")
|
||||
def set_focus(self):
|
||||
assert driver.toplevel_window.set_focus(self.real_name), 'Set focus failed'
|
||||
LOG.info(f'Window {getattr(self.object, "title", "")} in focus')
|
||||
LOG.info('Window %s was focused', self.title)
|
||||
|
||||
@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'
|
||||
LOG.info(f'Window {getattr(self.object, "title", "")} moved on top')
|
||||
LOG.info('Window %s moved on top', self.title)
|
||||
|
||||
@allure.step("Close {0}")
|
||||
def close(self):
|
||||
driver.toplevel_window.close(self.real_name)
|
||||
LOG.info(f'{self} closed')
|
||||
LOG.info('%s closed', self)
|
||||
|
||||
@allure.step("Show {0}")
|
||||
def show(self):
|
||||
driver.waitForObjectExists(self.real_name).setVisible(True)
|
||||
LOG.info(f'{self} is visible')
|
||||
LOG.info('%s is visible', self)
|
||||
|
||||
@allure.step("Hide {0}")
|
||||
def hide(self):
|
||||
driver.waitForObjectExists(self.real_name).setVisible(False)
|
||||
LOG.info(f'{self} hidden')
|
||||
LOG.info('%s hidden', self)
|
||||
|
||||
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
||||
super().wait_until_appears(timeout_msec)
|
||||
LOG.info(f'Window {getattr(self.object, "title", "")} appears')
|
||||
LOG.info('Window %s appears', self.title)
|
||||
return self
|
||||
|
|
Loading…
Reference in New Issue