Skip to content

ToolsPanel: improve unit tests #35057

Closed

Description

@ciampo

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

Activity

  1. 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[/+] on Sep 22, 2021
  2. added
    [Feature] Component System
    [Feature] UI Components
    [Type] Code Quality
    [Type] Automated Testing
    on Sep 22, 2021
  3. added
    [Status] In Progress
    on Oct 15, 2021
  4. aaronrobertshaw commented on Oct 15, 2021

    @aaronrobertshaw
    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

Metadata

Metadata

Labels

[Feature] Component System[Feature] UI Components[Status] In Progress[Type] Automated Testing[Type] Code Quality

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions