Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions testui/support/testui_driver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import base64
import os
import warnings

from datetime import datetime
from os import path
Expand All @@ -17,6 +18,21 @@
from testui.support.configuration import Configuration


def deprecated(message):
def decorator(func):
def wrapper(*args, **kwargs):
warnings.warn(
f"{func.__name__} is deprecated: {message}",
category=DeprecationWarning,
stacklevel=2
)
return func(*args, **kwargs)

return wrapper

return decorator


class TestUIDriver:
"""
This class is the main class for the TestUI framework. It is used to
Expand Down Expand Up @@ -120,6 +136,7 @@ def remove_log_file(self, when_no_errors=True):
logger.log_debug("Log file already removed")
return self

@deprecated("This method is deprecated and will be removed in a future version. Use actions() instead")
def touch_actions(self) -> TouchAction:
"""
Deprecated function, soon to be removed, use actions instead.
Expand Down Expand Up @@ -212,12 +229,12 @@ def network_connection(self) -> int:
return self.driver.network_connection

def find_image_match(
self,
comparison,
threshold=0.90,
assertion=False,
not_found=False,
image_match="",
self,
comparison,
threshold=0.90,
assertion=False,
not_found=False,
image_match="",
) -> bool:
"""
Will find an image match based on the comparison type and threshold
Expand Down Expand Up @@ -476,13 +493,13 @@ def stop_recording_screen(self, file_name="testui-video.mp4"):
return self

def stop_recording_and_compare(
self,
comparison,
threshold=0.9,
fps_reduction=1,
not_found=False,
keep_image_as="",
assertion=True,
self,
comparison,
threshold=0.9,
fps_reduction=1,
not_found=False,
keep_image_as="",
assertion=True,
) -> bool:
"""
Stop recording the screen and compare the video with the given image
Expand Down