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

test: final ct-audit tests and component tweaks #19948

Merged
merged 45 commits into from
Feb 1, 2022

Conversation

marktnoonan
Copy link
Contributor

@marktnoonan marktnoonan commented Jan 28, 2022

User facing changelog

This PR addresses some problems noticed when writing tests for some the components, so there are some user-facing changes, mainly for keyboard and screen reader accessibility for our Cards and the Specs List. There is more that can be done, especially to make the main Specs List match the Inline Specs List keyboard behavior, but I think these are still improvements worth having.

Additional details

File by file, this PR:

  • updates tests checking tabindex of Cards, since we no longer set tabindex on the outer element
  • updates RowDirectory to render a button so that it can be toggled with keyboard in the Specs List
  • adds Specs List test to catch Clear Search button bug, check link href, check keyboard interactions
  • fixes Clear Search bug in Specs List - virtual list was failing after the no-results state because it had no DOM element to render into, v-show preserves the DOM of the list even when hidden by the "no results" state.
  • prevents "cmd-click" from opening new tabs from specs list links (per Slack convo with Jennifer)
  • gives directory rows in Specs List a unique ID to manage aria expanded state
  • makes the rows have an outline more like the Inline Specs List when an item has keyboard focus
  • adds cypress-real-events to frontend-shared (same version we already have)
  • adds assertions and states to the Card component test
  • tweaks card markup for accessibility
  • adds an assertion to CopyButton. Our usual way of asserting text getting copied doesn't seem to work in component tests, need to look into this
  • adds component tests for StandardModal. This is tested plenty in E2E but it is nice to gather the expectations in one place and test the props directly.
  • adds some i18n imports in StandardModal components, and some class re-ordering caused by file save
  • fixes a random font-weight that didn't get updated to semi bold in the header yet
  • also fixes some percy snapshot issues caused by having multiple unnamed snapshots in the same test.

How has the user experience changed?

PR Tasks

  • Have tests been added/updated?
  • [na] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?
  • [na] Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jan 28, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Jan 28, 2022



Test summary

17925 0 211 0Flakiness 3


Run details

Project cypress
Status Passed
Commit 4135fe1
Started Feb 1, 2022 2:11 PM
Ended Feb 1, 2022 2:23 PM
Duration 12:10 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/e2e/commands/net_stubbing.cy.ts Flakiness
1 network stubbing > intercepting request > should delay the same amount on every response
2 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"
3 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@marktnoonan marktnoonan changed the title update card markup to be more accessible test: final ct-audit tests and component tweaks Jan 28, 2022
@marktnoonan marktnoonan marked this pull request as ready for review January 28, 2022 16:10
@marktnoonan marktnoonan marked this pull request as draft January 28, 2022 16:25
@@ -421,6 +421,8 @@ function validateExternalLink (subject, options: ValidateExternalLinkOptions | s
})
}

Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver loop limit exceeded'))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is here because in CI there were 16 tests failing due to the error. The error itself is safe to ignore in that it doesn't represent something that blows up the UI and it's debatable that it should be an error instead of a warning. I'm open to suggestions for handling this differently though.

Copy link
Contributor

Choose a reason for hiding this comment

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

This exception has been a pain in the butt forever.

ZachJW34
ZachJW34 previously approved these changes Jan 31, 2022
in order to render the virtual dom. Virtualized lists require stable containers and it
can be tricky to debug after this has happened.
-->
<div
Copy link
Contributor

Choose a reason for hiding this comment

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

How can a conditional with v-if be stable in the first place (what does stable mean, exactly?)

If we need a DOM node that will never change, we could use the v-once directive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good point, "stable" was vague. I've moved the comment to be better placed, and updated the wording. The part with v-if is OK coming and going, it's the next element that shouldn't follow the v-if rule. We would have liked to use v-show but it clashed with tailwind's grid class.

Maybe it's overdoing it to have this long comment in the first place, I think some "here be dragons" is useful for future developers, but there are tests now to catch regressions of the specific stuff this fixes.

Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't fully understand the problem, I guess I need to pull and try it out - but that's okay, the comment should suffice. Hopefully I don't need to edit this anytime soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The specific problem that this change fixes is that if the container element is not present in the DOM with when this code runs, it doesn't update the virtualized list, so "clearing the search" from the no-results state was broken, as the old v-if had removed the element needed. @ZachJW34 has some ideas for making this more robust in general when we get a chance. But in this PR I just wanted to fix the bug I found when adding the coverage for that behavior, and give a bit of a here-be-dragons, because some of my first changes seemed to work great locally, but had actually broken the virtualization.

@marktnoonan
Copy link
Contributor Author

@ZachJW34 @tbiethman I made a couple small changes since yesterday so tagged you to re-review when you get a chance. Tests are green now 🎉

Copy link
Contributor

@ZachJW34 ZachJW34 left a comment

Choose a reason for hiding this comment

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

LGTM!

@ZachJW34 ZachJW34 merged commit 4787cc1 into 10.0-release Feb 1, 2022
@ZachJW34 ZachJW34 deleted the UNIFY-693-last-component-tests branch February 1, 2022 15:45
tgriesser added a commit that referenced this pull request Feb 4, 2022
* 10.0-release:
  feat: validate specPattern root level (#19980)
  feat(unify): unsupported browsers (#19997)
  feat: persist isSideNavigationOpen (#20026)
  feat: add types for urqlCacheKeys (#20027)
  fix: rename spec.js to spec.cy.js (#20029)
  feat: waiting for dependencies to be installed in wizard (#19955)
  fix: migrate config fields to correct the location (#19940)
  feat: relaunch browser when switching testing types from app (#19961)
  test: final ct-audit tests and component tweaks (#19948)
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