status-desktop/test/e2e/driver/toplevel_window.py
Vladimir Druzhinin fe724ef186 Test(pytest) start aut (#11482)
* 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
2023-08-04 20:27:03 +02:00

53 lines
1.4 KiB
Python

import squish
import toplevelwindow
import configs
def maximize(object_name):
def _maximize() -> bool:
try:
toplevelwindow.ToplevelWindow(squish.waitForObject(object_name)).maximize()
return True
except RuntimeError:
return False
return squish.waitFor(lambda: _maximize(), configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
def minimize(object_name):
def _minimize() -> bool:
try:
toplevelwindow.ToplevelWindow(squish.waitForObject(object_name)).minimize()
return True
except RuntimeError:
return False
return squish.waitFor(lambda: _minimize(), configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
def set_focus(object_name):
def _set_focus() -> bool:
try:
toplevelwindow.ToplevelWindow(squish.waitForObject(object_name)).setFocus()
return True
except RuntimeError:
return False
return squish.waitFor(lambda: _set_focus(), configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
def on_top_level(object_name):
def _on_top() -> bool:
try:
toplevelwindow.ToplevelWindow(squish.waitForObject(object_name)).setForeground()
return True
except RuntimeError:
return False
return squish.waitFor(lambda: _on_top(), configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
def close(object_name):
squish.sendEvent("QCloseEvent", squish.waitForObject(object_name))