-
Notifications
You must be signed in to change notification settings - Fork 355
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
Infrastructure: Address failing macOS regression tests #3115
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stalgiag great job on getting this work started!
Found 2 additional failures when running on MacOS:
disclosure_navigation_hybrid › content/patterns/disclosure/examples/disclosure-navigation-hybrid.html [data-test-id="link-aria-current"]: "aria-current" attribute on links
combobox_grid-combo › content/patterns/combobox/examples/grid-combo.html [data-test-id="popup-key-home"]: Home from focus on list puts focus on grid and moves cursor
They were also described in #2735
─
disclosure_navigation_hybrid › content/patterns/disclosure/examples/disclosure-navigation-hybrid.html [data-test-id="link-aria-current"]: "aria-current" attribute on links
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:167:11␊
interaction.clickElement@chrome://remote/content/marionette/interaction.sys.mjs:136:11␊
clickElement@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:205:29␊
receiveMessage@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:85:31␊
`,
message: 'Element <a href="#mythical-page-content"> could not be scrolled into view',
}
ElementNotInteractableError: Element <a href="#mythical-page-content"> could not be scrolled into view
at Object.throwDecodedError (/Users/howard/Projects/aria/aria-practices/node_modules/selenium-webdriver/lib/error.js:521:15)
at parseHttpResponse (/Users/howard/Projects/aria/aria-practices/node_modules/selenium-webdriver/lib/http.js:514:13)
at Executor.execute (/Users/howard/Projects/aria/aria-practices/node_modules/selenium-webdriver/lib/http.js:446:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async thenableWebDriverProxy.execute (/Users/howard/Projects/aria/aria-practices/node_modules/selenium-webdriver/lib/webdriver.js:742:17)
at async /Users/howard/Projects/aria/aria-practices/test/tests/disclosure_navigation_hybrid.js:85:9
combobox_grid-combo › content/patterns/combobox/examples/grid-combo.html [data-test-id="popup-key-home"]: Home from focus on list puts focus on grid and moves cursor
test/tests/combobox_grid-combo.js:880
879:
880: t.true(
881: await confirmCursorIndex(t, ex.comboboxSelector, 0),
Cursor should be at index 0 after one ARROW_HOME key
Value is not `true`:
false
› test/tests/combobox_grid-combo.js:880:11
─
I do like this approach of starting the OS specific test utilities here and targeted a specific test. It should make resolving those other 2 issues easier to handle in the future.
I'm okay with approving and pushing for this work to get merged. We should also make sure the original issue is updated with a comment so it's clear what the 2 remaining issues are.
…conversion to key chord
…losure to previous code
await links[0].click(); | ||
// Add a small delay here to ensure that the scroll to focus event | ||
// has time to complete and doesn't interfere with the next assertion | ||
await t.context.session.sleep(300); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was giving intermittent failures. I determined that this was due to the scroll to focus event fired by the link click interfering with the assertion (buttons[1]
always failed). This small delay fixes this issue.
test/util/translatePlatformKey.js
Outdated
* @param {string|string[]} keys - The key(s) to translate | ||
* @returns {string[]} - The translated key(s) as a flat array ready for spreading | ||
*/ | ||
function translatePlatformKey(keys) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is potentially prematurely complex. I wanted to support instances when a platform key translation may be represented by chord -> single key or single key -> chord. We do not need this functionality now since we don't use any examples of this. I am open to reverting to a map if that is preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It potentially is but I could see the need for this as we move to ensuring tests are platform agnostic. Perhaps providing a clear example in the JSDoc will also be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stalgiag thanks so much for doing so much research into what's happening here! Left some inline comments
.github/workflows/regression.yml
Outdated
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this alone won't be enough because the grep -P
flag being used in regression-tests.sh is invalid for macOS's grep. MacOS uses BSD grep which doesn't support perl compatible regex. GNU grep does.
The invalid use is being thrown in the build log (although not throwing an error code).
invalid grep -P option message
> Run ./scripts/regression-tests.sh
grep: invalid option -- P
usage: grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
A few options here could be to:
- Rewriting
regression-tests.sh
grep commands to not use-P
- Converting
regression-tests.sh
to use perl commands directly - Using GNU's homebrew provided grep in the workflow. (I already have an example of this here and it seems like the most straightforward option to do)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! I decided to go with number 3 since you already have a well-written example.
With these updates, I see that there are a handful of tests that do not fail on my local machine but do fail on macOS in the Github workflows. Unfortunately, many of these appear to be flakey failures. I see two options:
- Revert the changes that add mac regression testing to CI
- Address the new set of tests that only fail on CI in this PR as well
I am open to either. I just don't want to merge new workflows in that stand to impede development with flakey failures. Curious what your thoughts are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, definitely flaky. I prefer going with number 1 here. I'd rather there be some dedicated focus and surety so as to not introduce additional CI flakiness. Would rather a follow up PR to introduce these workflows after some robust testing.
Also re-ran the tests multiple times on my macOS and not seeing those failures, so some dedicated effort on figuring out why it's happening in CI would be preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Reverted!
test/util/translatePlatformKey.js
Outdated
* @param {string|string[]} keys - The key(s) to translate | ||
* @returns {string[]} - The translated key(s) as a flat array ready for spreading | ||
*/ | ||
function translatePlatformKey(keys) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It potentially is but I could see the need for this as we move to ensuring tests are platform agnostic. Perhaps providing a clear example in the JSDoc will also be helpful.
test/tests/toolbar_toolbar.js
Outdated
@@ -1115,7 +1116,8 @@ ariaTest( | |||
'toolbar-button-enter-or-space', | |||
async (t) => { | |||
let textarea = await t.context.session.findElement(By.css('textarea')); | |||
await textarea.sendKeys(Key.chord(Key.CONTROL, 'a')); | |||
let modifierKey = translatePlatformKey(Key.CONTROL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This being modifierKey
as an array could be confusing. Renaming to modifierKeys
works? Although maybe just as confusing given a single value was passed. I suppose this goes back to having the function provide a clear example of usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! I addressed with aa905f6.
Co-authored-by: Howard Edwards <howard-e@users.noreply.github.com>
…ia-practices into fix-macos-regression-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stalgiag thanks for addressing the feedback. These changes LGTM now and should also make future instances of platform based issues easier to handle!
This PR adds two small utility methods:
isMacOS()
andtranslatePlatformKeys()
. The latter utility takes a singleKey
or an array ofKey
s and returns the keys with any platform-specificKey
s translated. For example,Keys.Control
becomesKeys.Meta
on macOS.These utilities are then used in the toolbar_toolbar test to ensure that the OS-specific modifier key is used in the "select all text" chord.
This PR also adds a small delay to a
disclosure_navigation_hybrid
test to handle a scroll to focus event interfering with an assertion.see #2735
WAI Preview Link (Last built on Wed, 11 Dec 2024 17:19:43 GMT).