<commit_before>"""UI-based test steps not tied to any specific UI program."""

from behave import then, when


@when('I look at the whole screen')
def look_at_the_whole_screen(context):
    """Create the screenshot of the whole screen."""
    screenshot = context.pyautogui.screenshot()
    assert screenshot is not None, "Unable to create screenshot"
    context.screenshot = screenshot


@when('I click on the region')
@when('I click on that region')
def click_on_the_region(context):
    """Click on region found by previous test step."""
    location = context.location
    assert location is not None, "Region can not be found"
    x, y = context.pyautogui.center(location)
    context.pyautogui.click(x, y)


def filename_for_region(region):
    """Proper filename for file containing pattern for region."""
    region = region.replace(" ", "_")
    filename = "regions/" + region + ".png"
    return filename


@then('I should find the region with {region}')
def find_the_region(context, region):
    """Try to find region on screen based on specified pattern."""
    location = context.pyautogui.locateOnScreen(filename_for_region(region))
    assert location is not None, "Region can not be found"
    context.location = location<commit_msg>Refactored - UI checks<commit_after>"""UI-based test steps not tied to any specific UI program."""

from behave import then, when
from src.gui import perform_click_on_the_region, perform_find_the_region


@when('I look at the whole screen')
def look_at_the_whole_screen(context):
    """Create the screenshot of the whole screen."""
    screenshot = context.pyautogui.screenshot()
    assert screenshot is not None, "Unable to create screenshot"
    context.screenshot = screenshot


@when('I click on the region')
@when('I click on that region')
def click_on_the_region(context):
    """Click on region found by previous test step."""
    perform_click_on_the_region(context)


@then('I should find the region with {region}')
def find_the_region(context, region):
    """Try to find region on screen based on specified pattern."""
    assert region is not None
    perform_find_the_region(context, region)
{'fraction_non_alphanumeric': 0.09925788497217068, 'fraction_numerical': 0.0, 'mean_word_length': 4.474619289340102, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3863292', 'n_tokens_mistral': 618, 'n_tokens_neox': 601, 'n_words': 229}