w3c/aria-practices

Failing `disclosure_navigation.js` test

howard-e opened this issue · 1 comments

A failure I've been noticing happening more frequently across all PR contribution is the following:

error shown in regression test logs: 'Element < a href="#mythical-page-content"> could not be scrolled into view'
not ok 193 - disclosure_navigation › content/patterns/disclosure/examples/disclosure-navigation.html [data-test-id="link-aria-current"]: "aria-current" attribute on links
  ---
    name: AssertionError
    message: Rejected promise returned by test
    values:
      'Rejected promise returned by test. Reason:': |-
        ElementNotInteractableError {
          remoteStacktrace: `RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8␊
          WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:193:5␊
          ElementNotInteractableError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:353:5␊
          webdriverClickElement@chrome://remote/content/marionette/interaction.sys.mjs:166:11␊
          interaction.clickElement@chrome://remote/content/marionette/interaction.sys.mjs:135:11␊
          clickElement@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:204:29␊
          receiveMessage@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:84:31␊
          `,
          message: 'Element <a href="#mythical-page-content"> could not be scrolled into view',
        }
    at: >-
      Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)

      parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)

      Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)

      async thenableWebDriverProxy.execute
      (node_modules/selenium-webdriver/lib/webdriver.js:745:17)

      async test/tests/disclosure_navigation.js:76:9
  ...

Forcing the test to manually scroll to the element may be useful here.

I'm also able to consistently replicate this failure on main with Windows 11 + Node v20.11.1 by running the following command locally:

npm run regression -- -t test/tests/disclosure_navigation.js

Looks to still be happening in the latest PRs changes. Running the previously suggested fix from #2997 test locally in 25 attempts gave 5 out of 25 failures.

Aligning the change instead with how the other tests' scrollIntoView calls are done passes all 25 attempts locally, that is:

await t.context.session.executeScript(function () {
  const link = arguments[0];
- link.scrollIntoView({ block: 'center' });
+ link.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}, links[l]);

But still fails when ran in CI, with changes I've pushed here.