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

ToolsPanel: improve unit tests #35057

Closed
3 tasks
Tracked by #34345
ciampo opened this issue Sep 22, 2021 · 1 comment · Fixed by #35658
Closed
3 tasks
Tracked by #34345

ToolsPanel: improve unit tests #35057

ciampo opened this issue Sep 22, 2021 · 1 comment · Fixed by #35658
Assignees
Labels
[Feature] Component System WordPress component system [Feature] UI Components Impacts or related to the UI component system [Status] In Progress Tracking issues with work in progress [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Code Quality Issues or PRs that relate to code quality

Comments

@ciampo
Copy link
Contributor

ciampo commented Sep 22, 2021

What

Improve unit tests by partially rewriting them. They should not be checking implementation details (like classnames, the presence of certain react components...), but instead, they should test the ToolsPanel component replicating the way end-users interact with it.

Why

Here's a great explainer

A/C

  • There should be no usages of querySelector, querySelectorAll or any similar way of getting an element from the DOM.
  • Similarly, we should not test the exact DOM structure (e.g. getting parent elements, or checking for the existence of a specific React component). We should instead, for example, find components by role, or accessible text
  • Add coverage for behaviour related to unique panelIds to cover the user behaviour of switching between similar blocks that share common ToolsPanels. A concrete example is to cover the bug fix in ToolsPanelItem: Add panelId check before calling toggle methods #35375
@ciampo ciampo mentioned this issue Sep 22, 2021
62 tasks
@ciampo ciampo changed the title ToolsPanel: Rewrite unit tests to use querySelector less, and to test less implementation details and more the behaviour that the user should expect ToolsPanel: improve unit tests Sep 22, 2021
@ciampo ciampo added [Feature] Component System WordPress component system [Feature] UI Components Impacts or related to the UI component system [Type] Code Quality Issues or PRs that relate to code quality [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. labels Sep 22, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Oct 15, 2021
@aaronrobertshaw
Copy link
Contributor

A PR has been created addressing as much as possible from the list in the description: #35658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Component System WordPress component system [Feature] UI Components Impacts or related to the UI component system [Status] In Progress Tracking issues with work in progress [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants