2023-10-31 10:53:49 +00:00
|
|
|
import logging
|
2023-08-04 18:27:03 +00:00
|
|
|
import typing
|
|
|
|
|
|
|
|
import allure
|
|
|
|
|
|
|
|
import driver
|
2023-10-06 08:33:42 +00:00
|
|
|
from gui.elements.object import QObject
|
2023-08-04 18:27:03 +00:00
|
|
|
|
2023-12-01 13:58:22 +00:00
|
|
|
LOG = logging.getLogger(__name__)
|
2023-10-31 10:53:49 +00:00
|
|
|
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
class Button(QObject):
|
|
|
|
|
|
|
|
@allure.step('Click {0}')
|
|
|
|
def click(
|
|
|
|
self,
|
|
|
|
x: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
|
|
|
|
y: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
|
|
|
|
button: driver.MouseButton = None
|
|
|
|
):
|
|
|
|
if None not in (x, y, button):
|
|
|
|
getattr(self.object, 'clicked')()
|
2023-12-04 18:16:52 +00:00
|
|
|
LOG.info('%s: clicked', self)
|
2023-08-04 18:27:03 +00:00
|
|
|
else:
|
|
|
|
super(Button, self).click(x, y, button)
|