Skip to content

Allow customization of click/paste and replace text action #377

@ferpasri

Description

@ferpasri

Description:

TESTAR currently relies on the Ctrl + A key combination to select all the text in the System Under Test (SUT) when the user intends to replace the existing text. However, this combination is not always supported as expected for some specific SUT and OS languages or non-Windows OS:

  • On a Windows system with Spanish language settings and using Notepad as the SUT, pressing Ctrl + A tries to save the text as a file instead of selecting all.

  • MacOS does not use Ctrl as a key, leading to inconsistencies in the key combination behavior.

Involved classes:

public Action clickAndReplaceText(final Position position, final String text){
Assert.notNull(position, text);
// clicking the widget to select it:
CompoundAction.Builder builder = new CompoundAction.Builder().add(leftClickAt(position), 1);
// pressing Cntr + A keys to select all text:
builder.add(new KeyDown(KBKeys.VK_CONTROL), 0.1).add(new KeyDown(KBKeys.VK_A), 0.1).add(new KeyUp(KBKeys.VK_A), 0.1).add(new KeyUp(KBKeys.VK_CONTROL), 0.1);

public Action pasteAndReplaceText(final Position position, final String text){
Assert.notNull(position, text);
// clicking the widget to select it:
CompoundAction.Builder builder = new CompoundAction.Builder().add(leftClickAt(position), 1);
// pressing Cntr + A keys to select all text:
builder.add(new KeyDown(KBKeys.VK_CONTROL), 0.1).add(new KeyDown(KBKeys.VK_A), 0.1).add(new KeyUp(KBKeys.VK_A), 0.1).add(new KeyUp(KBKeys.VK_CONTROL), 0.1);

Posible solution:
Implement a setting ConfigTag or customizable method protocol that enables users to customize the key combination or choose alternative methods for the text selection and replacement action, considering variations in keyboard shortcuts for different operating systems and language settings.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions