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

Experiments with extending testdriver.js for platform accessibility API testing #2

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

spectranaut
Copy link
Collaborator

@spectranaut spectranaut commented May 1, 2024

To run example test

(see platform specific notes below)

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

# Chromium
./wpt run --binary <chromiumbinary> --force-renderer-accessibility --log-mach-level debug --log-mach - chromium core-aam/acacia

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

# Safari
./wpt run --no-headless --log-mach-level debug --log-mach - safari core-aam/acacia

On linux

To run against Firefox, you need accessibility turned on. You can run on the orca screen reader or export GNOME_ACCESSIBILITY=1 and use --no-headless.

On macOS:

Dependencies:
python -m pip install pyobjc-framework-Accessibility pyobjc-framework-ApplicationServices

To run against Firefox, you need to turn on VoiceOver the screen reader.
To run against Chrome, you need to include --no-headless.

On Windows

Requirements: comtypes python library

pip install comtypes

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

Issues

  1. Is this the right way to extend testdriver.js for this purpose?
  2. We can't have two of the same browsers running on a machine.
    1. The browser is found by "product name", so, looking for "chrome" or "chromium" or "firefox" in the application name.

@spectranaut spectranaut changed the title Trying to get testdriver.js working Experiments with extending testdriver.js May 6, 2024
@spectranaut spectranaut changed the base branch from acacia-test to master May 6, 2024 16:20
@spectranaut spectranaut requested a review from alice May 6, 2024 16:23
@spectranaut spectranaut changed the title Experiments with extending testdriver.js Acacia experiments with extending testdriver.js May 6, 2024

return None

class AcaciaPlatformAccessibilityProtocolPart(PlatformAccessibilityProtocolPart):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cookiecrook, thanks so much for your offer to take a look :) We are curious primarily, at this point, about the direction of extending testharness in this way. This executoracacia will be responsible for accessing different APIs based on the operating system. Obviously, its not related to webdriver, even though AcaciaPlatformAccessibilityProtocolPart is being "implemented" as a protocol part in the class WebDriverProtocol(Protocol) object.

You'll see a lot of files touched because I've bubbled up the "product name" in order to have it here, so we can find the correct browser to test the accessibility API of.

Copy link

@cookiecrook cookiecrook May 8, 2024

Choose a reason for hiding this comment

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

I support any exploration for improving reliable testability of any aspect of web accessibility, including the platform APIs. I don't have strong opinions about extending the testharness this way. @gsnedders may have more ideas or questions.

That said, my primary questions came up in yesterday's call.

  • It's not clear to me how platform-dependent API output will be tested in a platform-independent way using WPT.
    • As I understand it, each test expectation will be different per platform and, at least temporarily, would expose some implementation details.
    • Are the results for testing the Mac APIs intended to be listed as "N/A" for the Windows or Linux CI platforms?
    • Or is the intent to compare Mac-specific platform API results to Windows- or Linux-specific results? If so that'd be an Apples to Oranges comparison. Please forgive the terrible pun.
  • I also wonder if this testing path might be logical to consider downstream of (after completing) AccessibleNode, rather than bypassing it.
    • What if there was a new accessor to get the platform-specific tree from the accessible node of an element? These may be similar to the WebKit or Chrome platform-specific tests.
      • for a DOM element (any element, including body), get the accessible node, then get the tree output (new accessor defined in webdriver?) for a specific platform parameter: [mac | atk | win_uia or win_ia2 | etc].
      • It might be similar to the serialized tree dump exploration the group just abandoned, but passing in a parameter to get a platform-dependent tree expectation instead of the non-standardized engine-internal representation of the tree.
      • Of note for others, these expectations are partially defined in Core-AAM and elsewhere. It would take a lot more effort to ensure those trees were interoperable. More toward this might come out of the tree walker exploration discussed in Interop Accessibility #90.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the comment! I'll reply with my thoughts, and @spectranaut can add hers later on.

It's not clear to me how platform-dependent API output will be tested in a platform-independent way using WPT.

  • As I understand it, each test expectation will be different per platform and, at least temporarily, would expose some implementation details.

Yeah, we've talked about whether this project is a good fit for WPT, given WPT is generally testing browser internals and, as you point out, those are platform-independent by design philosophy; conversely, accessibility mappings are platform-dependent by necessity.

That said, I don't know that it's the case that it should expose implementation details. The intent for the scope is to test the Accessibility API Mappings specifications, such as Core-AAM. Obviously these don't cover the complete picture of what is involved in making web content accessible to assistive technology, but they should, in theory, be consistently implemented across browsers, shouldn't they?

  • Are the results for testing the Mac APIs intended to be listed as "N/A" for the Windows or Linux CI platforms?

This is an important technical question: how do we implement platform-specific behaviour and expectations? I don't know enough about WPT to know what's currently technically possible, but I would hope that we could have platform-specific tests (since the APIs are different on each platform, they won't even be able to run on other platforms) which contain their own assertions about correct behaviour, and then have the appropriate tests collected and run by the runner based on the platform.

  • that'd be an Apples to Oranges comparison. Please forgive the terrible pun.

This is magnificent.

  • What if there was a new accessor to get the platform-specific tree from the accessible node of an element?

I like the approach prototyped here because it is a good integration test: because it goes via the same "read" API as the assistive technologies would, rather than inspecting the browser's internal representation of its accessibility tree.

That said, if this approach turns out to be infeasible, I think it would be good to expose platform-specific information through the webdriver API eventually (though we'd still run into the platform-specific expectations problem regardless.)

Also, I don't know that we need to get the tree - Valerie has implemented just getting the properties for a single Element, which allows us to test the AAMs, which was the goal of this work. Would restricting the API to the properties for a single Element resolve your concerns about exposing implementation details?

(It would also be good to have more standards about how the tree is built, and as you know I'm excited about that work! Thanks for the pointer to the Tree Walker work, I didn't know about that until now.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks James for all the thoughts, it brings up a lot to think about, and thanks Alice for the replies, I don't actually have a lot to add :)

I have vaguely thought of handling the platform specific tests in one of two ways, neither is perfect:

  1. We have a test files that are platform specific, and the test harness only runs the tests relevant to the platform. So, when on mac, only run the mac test files. I'm not sure how this will look in wpt.fyi, it would require some work and exploration -- but at the file level we would see some files don't apply to some platforms: https://wpt.fyi/results/wai-aria/role?label=experimental&label=master&aligned

  2. We could also write a test that contains expectations for all platforms, request the platform accessibility node, then the based on the response (did I get a AX API node, or a Atspi node) processes either AX API expectations or Atspi expections as appropriate. This would also look weird in wpt.fyi, because the expectation is in the name, so would we list all platform expectations in the name (for example)? Also there would be a different number of expectations depending on the platform.

resources/testdriver.js Outdated Show resolved Hide resolved
* @returns {Promise} Fullfilled with object representing accessibilty node
* rejected in the cases of failures
*/
get_accessibility_api_node: async function(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.

I believe there's an open question (still @cookiecrook?) with the WebDriver accessibility APIs about whether to have a way to get this kind of bag of properties, or to instead behave more like the rest of the WebDriver APIs and only support fetching single properties.

We should probably consider for ourselves which will work better for us as well - getting the bag of properties might be slow if any of the properties are slow to compute or cause exceptions, etc.; however, accessing individual properties instead would probably require a kind of "stringly typed" (i.e. passing a string representing the property to query) API rather than having every single property we might want to test on each operating system as its own method.

Still, it might be worth prototyping what it might look like to access single properties as well as this bag of properties API?


return None

class AcaciaPlatformAccessibilityProtocolPart(PlatformAccessibilityProtocolPart):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the comment! I'll reply with my thoughts, and @spectranaut can add hers later on.

It's not clear to me how platform-dependent API output will be tested in a platform-independent way using WPT.

  • As I understand it, each test expectation will be different per platform and, at least temporarily, would expose some implementation details.

Yeah, we've talked about whether this project is a good fit for WPT, given WPT is generally testing browser internals and, as you point out, those are platform-independent by design philosophy; conversely, accessibility mappings are platform-dependent by necessity.

That said, I don't know that it's the case that it should expose implementation details. The intent for the scope is to test the Accessibility API Mappings specifications, such as Core-AAM. Obviously these don't cover the complete picture of what is involved in making web content accessible to assistive technology, but they should, in theory, be consistently implemented across browsers, shouldn't they?

  • Are the results for testing the Mac APIs intended to be listed as "N/A" for the Windows or Linux CI platforms?

This is an important technical question: how do we implement platform-specific behaviour and expectations? I don't know enough about WPT to know what's currently technically possible, but I would hope that we could have platform-specific tests (since the APIs are different on each platform, they won't even be able to run on other platforms) which contain their own assertions about correct behaviour, and then have the appropriate tests collected and run by the runner based on the platform.

  • that'd be an Apples to Oranges comparison. Please forgive the terrible pun.

This is magnificent.

  • What if there was a new accessor to get the platform-specific tree from the accessible node of an element?

I like the approach prototyped here because it is a good integration test: because it goes via the same "read" API as the assistive technologies would, rather than inspecting the browser's internal representation of its accessibility tree.

That said, if this approach turns out to be infeasible, I think it would be good to expose platform-specific information through the webdriver API eventually (though we'd still run into the platform-specific expectations problem regardless.)

Also, I don't know that we need to get the tree - Valerie has implemented just getting the properties for a single Element, which allows us to test the AAMs, which was the goal of this work. Would restricting the API to the properties for a single Element resolve your concerns about exposing implementation details?

(It would also be good to have more standards about how the tree is built, and as you know I'm excited about that work! Thanks for the pointer to the Tree Walker work, I didn't know about that until now.)

@@ -0,0 +1,91 @@
import acacia_atspi
Copy link
Collaborator

Choose a reason for hiding this comment

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

We probably want to have eventually separate executor implementations per platform, and then a cross-platform implementation which can import the appropriate one and call its get_accessibility_api_node (or whatever API we go with) method.

@spectranaut spectranaut marked this pull request as draft May 16, 2024 21:35
@spectranaut spectranaut changed the title Acacia experiments with extending testdriver.js Experiments with extending testdriver.js for platform accessibility API testing May 21, 2024
schenney-chromium pushed a commit that referenced this pull request Jul 15, 2024
Bug #1: AbstractRange::(Mark|Unmark)Descendants should always use
the shadow tree of web-exposed shadow root, instead of using
light DOM elements of the host.

Bug #2: aRange could possibly create mCrossShadowBoundaryRange
first (due to boundaries are in different tree), and later
moves the boundaries to the same tree. When this happens, we
should remove mCrossShadowBoundaryRange and use the default
range to represent it.

Differential Revision: https://phabricator.services.mozilla.com/D207608

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1891783
gecko-commit: 0f54a84c32d1c22d71ff7307944b824639adbd6f
gecko-reviewers: jjaschke, smaug, dom-core
schenney-chromium pushed a commit that referenced this pull request Jul 15, 2024
Since @page border box layout objects aren't in the the layout tree, any
code that wants to walk up the tree to find the containing block will be
in for a surprise.

This would happen if percentage-based @page padding was used [1].
Recomputing padding during painting when we have already done it during
layout is rather pointless anyway. Read it out directly from the
fragment.

[1] #1 blink::LayoutBox::ContainingBlockLogicalWidthForContent()
    #2 blink::LayoutBoxModelObject::ComputedCSSPadding()
    #3 blink::LayoutBoxModelObject::PaddingTop()
    #4 blink::LayoutBoxModelObject::PaddingOutsets()
    #5 blink::BoxPainterBase::PaintFillLayer()
    #6 blink::BoxPainterBase::PaintFillLayers()
    #7 blink::BoxFragmentPainter::PaintBackground()

Bug: 40286153
Change-Id: I1e6e92c2ce1d81aab2673ec9a877eac455534102
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5526469
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1300711}
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.

4 participants