Add object names for all keys#44
Conversation
frogarian
commented
Feb 18, 2026
- added object names to all keys to necessary for automated UI tests
- disable dummy key only used as placeholder
Summary of ChangesHello @frogarian, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the testability of the keyboard application by systematically assigning unique identifiers to all interactive key elements. This change facilitates the development and maintenance of automated UI tests, ensuring the application's stability and functionality. Additionally, it refines the behavior of non-interactive layout elements by explicitly disabling them. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds objectName properties to various keyboard components to facilitate UI testing, which is a valuable addition. The changes are mostly correct and follow a consistent pattern. However, I've found a significant issue regarding the usage of ShiftKey components in layout files. They are missing the inputPanelRef property, which makes them fragile and inconsistent with other keys. I've left a comment with a suggestion to fix this. I also found a minor opportunity for code simplification in Key.qml. Please review my comments.
src/qml/Key.qml
Outdated
| objectName: { | ||
| var prefix = inputPanelRef.objectName + "Key_" | ||
| if (btnDisplayedText) { | ||
| return prefix + btnDisplayedText | ||
| } | ||
| return prefix + btnText | ||
| } |
There was a problem hiding this comment.
This logic for determining the
objectNamecan be expressed more concisely using a single line with a ternary operator.objectName: inputPanelRef.objectName + "Key_" + (btnDisplayedText ? btnDisplayedText : btnText)
@frogarian, I would apply this suggestion for better code quality.
There was a problem hiding this comment.
@AndreaRicchi good point, before my logic was a little more involved which would have caused multiple ternary, but for this version I agree - Fixed it
|
Hi @frogarian, thanks for your contribution. Can you rewrite the commit messages to be capitalised in the subject and, more importantly, to describe the what and why in the commit body to better understand the needs for these changes? |
Most layouts use a dummy placeholder key for better alignment. Since this in not an actual key it should be disabled to not have a clickable space which looks like background.
Improves consistency and enables using its object name as prefix for each keys object name
828d450 to
5c56588
Compare
@AndreaRicchi Sure, no problem. Updated my commit messages and added a bit of context. |
It is necessary for automated UI tests to have a unique object name for every qml element you want to access.
5c56588 to
05075ff
Compare
EddyTheCo
left a comment
There was a problem hiding this comment.
It seems this PR gives a unique value to the objectName property of each key on the keyboard.
It seems the latter is done because UI testing wants to be performed on screens where the keyboard is used.
An issue describing the why of this PR and how this object name will be used for UI testing would be nice.
I find the changes implemented correctly, but I wonder if assigning a unique value for all the keys is required, maybe setting the same objectName for all the keys, iterate over all the objects, and then querying the btnText property will be enough.
The way is done give you more granularity, but it could be difficult to maintain in the future.