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

Add tests for macOS key press simulation #13

Merged
merged 4 commits into from
Sep 23, 2024
Merged

Conversation

jugglinmike
Copy link
Member

@jugglinmike jugglinmike commented Sep 18, 2024

@ChrisC Here's a prototype of the system we discussed last week. I'm submitting it as a draft because there are three tests which don't work the way I expected them to work, and I'd like to try to understand why.

I documented them by including "(suspect behavior)" in their title and by skipping corresponding tests labeled "(intuitive behavior)". The "skipped test" approach surfaces my expectation in the tests' source code and in the output from executing them, which could be helpful if my hunch is correct and some of these behaviors are unavoidable.

We can't use this approach to observe press/release of the "Fn" key, but my initial testing suggested that we can't simulate pressing that key in the first place. This test suite will be especially reassuring if/when the code has to make the kinds of substitutions exemplified there (e.g. simulating "End" instead of "Fn + Right Arrow").

Resolves gh-12.

@jugglinmike jugglinmike requested a review from ChrisC September 18, 2024 03:01

const keyTestDriverRef = (getDriver, title, keyCodes, modifiers, expected) => {
test(title, async function () {
const driver = getDriver();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too thrilled about this, but I'm somewhat less thrilled by the idea of defining driver globally.

@jugglinmike jugglinmike marked this pull request as draft September 18, 2024 03:05
@jugglinmike jugglinmike marked this pull request as ready for review September 18, 2024 23:35
@jugglinmike
Copy link
Member Author

@ChrisC My research suggests that there aren't any practical workaround to the three oddities that these tests have uncovered. I've decided to simply document them; we still stand to gain a lot of insight even without addressing the underlying deficiencies.

(Also, it looks like I spoke too soon during our meeting today. The CI failures I observed were in fact transient and unrelated to the code itself.)

This is ready for review!

@ccanash ccanash merged commit 9113b19 into main Sep 23, 2024
10 checks passed
@jugglinmike jugglinmike deleted the macos-key-press-tests branch September 23, 2024 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add regression testing for key code generation for MacOS
3 participants