mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-10 06:16:32 +00:00
fe724ef186
* test(pytest) The driver methods added. Wrappers for UI elements added. #67 * test(pytest) Squishserver added #68 * test(pytest) Attach/Detach AUT methods added #69 * test(pytest) Main window handler added #70 * test(pytest) Save screenshot on fail added #71 * test(pytest) Wait for squishserver added #71 * test(pytest) Setup Windows #71 * Generate new keys (#11804) * test(pytest) Image comparison methods added #76 * test(pytest) Tesseract methods added #77 * test(pytest) The Methods to search color on image added #80 * test(onboarding) Test on generation new keys added #75 * test(pytest) Handlers for OS Native File dialog added #81 * test(Onboarding) Test on Profile image added #83 * Allure and TestRail integration (#11806) * test(Allure) Steps descriptions added #72 * test(TestRail) Integration #72
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
import logging
|
|
|
|
import allure
|
|
|
|
import configs
|
|
import driver
|
|
from gui import objects_map
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class BaseObject:
|
|
|
|
def __init__(self, name: str):
|
|
self.symbolic_name = name
|
|
self.real_name = getattr(objects_map, name)
|
|
|
|
def __str__(self):
|
|
return f'{type(self).__qualname__}({self.symbolic_name})'
|
|
|
|
def __repr__(self):
|
|
return f'{type(self).__qualname__}({self.symbolic_name})'
|
|
|
|
@property
|
|
def object(self):
|
|
raise NotImplementedError
|
|
|
|
@property
|
|
def is_visible(self) -> bool:
|
|
raise NotImplementedError
|
|
|
|
@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'
|
|
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'
|
|
|
|
@classmethod
|
|
def wait_for(cls, condition, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC) -> bool:
|
|
return driver.waitFor(lambda: condition, timeout_msec)
|