Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ferpasri opened this issue Nov 14, 2023 · 0 comments
Open

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

ferpasri opened this issue Nov 14, 2023 · 0 comments

Comments

@ferpasri
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant