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 Windows IA2 support #10

Merged
merged 4 commits into from
Jul 19, 2024
Merged

Conversation

spectranaut
Copy link
Collaborator

@spectranaut spectranaut commented Jul 13, 2024

This patch does the following:

  1. Returns a serialized node for the MSAA/IA2 interface
  2. Passes the test page title back with the ID. Otherwise, I was not able to find an easy way to poll the tree until the webpage is loaded. Sending the test page title will also allow us to know when it is time to poll again -- when a new test page has been loaded.

Requirements: comtypes python library

pip install comtypes

Running the code is the same as for other platforms:

# Chrome
python wpt run --force-renderer-accessibility --log-mach-level debug --log-mach - chrome core-aam/acacia/all_apis_example.html

# Firefox
python wpt run --no-headless --log-mach-level debug --log-mach - firefox core-aam/acacia/all_apis_example.html

The code to get access to IA2 interface was very inspired by James Teh's API test infrastructure in Firefox: https://searchfox.org/mozilla-central/source/accessible/tests/browser/windows/a11y_setup.py

@spectranaut spectranaut changed the base branch from master to acacia-test-testdriver July 13, 2024 00:07
@spectranaut spectranaut changed the title Windows support Add Windows IA2 test Jul 17, 2024
@spectranaut spectranaut changed the title Add Windows IA2 test Add Windows IA2 support Jul 17, 2024
Copy link
Collaborator

@alice alice left a comment

Choose a reason for hiding this comment

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

Lots of suggestions, but this is amazing.

for i in range(1, root.accChildCount + 1):
child = to_ia2(root.accChild(i))
if child.accRole(CHILDID_SELF) == ROLE_SYSTEM_DOCUMENT:
if child.accName(CHILDID_SELF) == title:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if child.accName(CHILDID_SELF) == title:
if child.accValue(CHILDID_SELF) == url:

(Not an actual suggestion to be applied directly, just documenting how we get the URL, if we wanted to do that)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done!

@@ -1076,7 +1076,7 @@
* rejected in the cases of failures.
*/
get_accessibility_api_node: async function(dom_id) {
return window.test_driver_internal.get_accessibility_api_node(dom_id)
return window.test_driver_internal.get_accessibility_api_node(document.title, dom_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we sent location.href here instead of document.title, we could match based on the URL rather than the (potentially ambiguous) title.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good idea!

@spectranaut spectranaut merged commit 5edd923 into acacia-test-testdriver Jul 19, 2024
2 checks passed
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.

2 participants