Skip to content

test(radio): enable keyboard tests - #27262

Merged
sean-perkins merged 8 commits into
mainfrom
FW-3747
Apr 28, 2023
Merged

sean-perkins merged 8 commits into
mainfrom
FW-3747

Conversation

@sean-perkins

@sean-perkins sean-perkins commented Apr 21, 2023 •

Copy link
Copy Markdown
Contributor

Issue number: Internal


What is the current behavior?

Tab keyboard navigation tests are disabled for ion-radio because they were extremely flaky in CI.

What is the new behavior?

  • Re-enables ion-radio Tab keyboard navigation tests
  • Ports a slimmed down version of Wordpress' playwright utilities for using modifier keys with Tab keyboard navigation on environments that do not support "natural tab navigation"

Does this introduce a breaking change?

  • Yes
  • No

Other information

This utility should likely be used in all places where we are using the Alt+Tab logic for webkit-based browsers today. If/when the changes are agreed upon, I can follow-up with PR that adds this behavior to those tests.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added the package: core @ionic/core package label Apr 21, 2023
@sean-perkins
sean-perkins marked this pull request as ready for review April 25, 2023 02:36
@sean-perkins
sean-perkins requested a review from a team as a code owner April 25, 2023 02:36

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you document the purpose of this file and why it works as a comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Documented here: e68643d

Let me know if you want additional details.

Our current approach for checking for webkit works great when running locally on macOS, but when ran on CI on a Linux image, the Alt+Tab key combination does not behave consistently the same. This utility detects those conditions and normalizes the key press in a shared utility that we can use across tests (instead of needing to detect per test and handle repeatedly).

@liamdebeasi liamdebeasi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good, just would like to document some parts of the util code

Comment on lines +108 to +120
const keys = key.split('+').flatMap((keyCode) => {
if (Object.prototype.hasOwnProperty.call(modifiers, keyCode)) {
return modifiers[keyCode as keyof typeof modifiers](isAppleOS).map((modifier) =>
modifier === CTRL ? 'Control' : capitalCase(modifier)
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we document what this is doing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let me know if the updated documentation makes sense 👍

Comment on lines +126 to +144
for (let i = 0; i < times; i += 1) {
await command();

if (times > 1 && pressOptions.delay !== undefined) {
await this.page.waitForTimeout(pressOptions.delay);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we document what this is doing?

@liamdebeasi liamdebeasi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great find! This should help a great deal

@sean-perkins
sean-perkins added this pull request to the merge queue Apr 28, 2023
Merged via the queue into main with commit 0bb84bb Apr 28, 2023
@sean-perkins
sean-perkins deleted the FW-3747 branch April 28, 2023 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants