microsoft / microsoft/PowerToys

[Testing] UI Tests assume a US English keyboard layout and fail on others

Open
#47,067 1 comment 0 reactions 1 assignee Claimed by @daverayment View on GitHub
Area-Tests Issue-Bug Needs-Triage Product-General
Dominant language
C
Stars
139k
Forks
8.6k
PR merge metrics
PR metrics pending

Description

### Microsoft PowerToys version

0.98.1

### Installation method

Dev build in Visual Studio

### Area(s) with issue?

General

### Steps to reproduce

1. Set your keyboard layout to UK English
2. Run the UI tests for PowerRename

### ✔️ Expected Behavior

All tests pass.

### ❌ Actual Behavior

The `BasicRegularMatch()` test fails.

## Analysis

The issue is not with the test itself, but with actually setting the value of the search textbox accurately. The test attempts to set the text to `^test.*\.txt$`, but what appears on a UK English system is `^test.*#.txt$` - the backslash has been interpreted as a `#`.

This is because Appium/WinAppDriver is flawed in that it maps letters to scan codes to simulate key presses, and those codes produce different results on different keyboard layouts. This is a long-standing issue with the driver:

https://github.com/microsoft/WinAppDriver/issues/194

Potential solutions are to simulate typing Alt + the Unicode number for the character, or to use the clipboard for copying and pasting the text directly.

The CI build is unaffected because it's presumably running on an en-US server. If it were to be run elsewhere, e.g. for a self-hosted build, it could break.

### Upload Bug Report ZIP-file

_No response_

### Additional Information

Windows 11 latest.
UK English keyboard layout.

### Other Software

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.