Skip to content

[Bug]: Not able to achieve 100% interaction tests coverage for specific components  #499

Open
@Manuela-Sousa

Description

@Manuela-Sousa

Describe the bug

At the moment I´m trying to create interaction tests for several components in storybook. However i realized that for specific components (Checkbox, and Link) I´m not being able to achieve 100% test coverage even thought I´m sure I´m covering the specific scenario mentioned not being covered.
Example for link component: Code Line: text-decoration: ${props => (props.underline ? 'underline' : 'none')}; and Validation in test: expect(link).toHaveStyle('text-decoration: none solid rgb(40, 96, 215)');
Did anyone noticed this before? and also sometimes the results varies a lot not always giving the same coverage data even if the code is not changed.

To Reproduce

1 - Having a code line like this and create the validation test Example: Code Line: text-decoration: ${props => (props.underline ? 'underline' : 'none')}; and Validation in test: expect(link).toHaveStyle('text-decoration: none solid rgb(40, 96, 215)');
2 - Execute the test coverage command to check if the scenario appears covered

System

Storybook Environment Info:

  System:
    OS: Windows 11 10.0.22631
    CPU: (8) x64 Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
  Binaries:
    Node: 20.11.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD <----- active
    npm: 10.8.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (126.0.2592.113)
  npmPackages:
    @storybook/addon-a11y: ^8.1.11 => 8.2.4
    @storybook/addon-coverage: ^1.0.4 => 1.0.4
    @storybook/addon-essentials: ^8.1.11 => 8.1.11
    @storybook/addon-interactions: ^8.1.11 => 8.1.11
    @storybook/addon-links: ^8.1.11 => 8.1.11
    @storybook/addon-onboarding: ^8.1.11 => 8.1.11
    @storybook/blocks: ^8.1.11 => 8.1.11
    @storybook/react: ^8.1.11 => 8.1.11
    @storybook/react-vite: ^8.1.11 => 8.1.11
    @storybook/test: ^8.1.11 => 8.1.11
    @storybook/test-runner: ^0.19.0 => 0.19.0
    eslint-plugin-storybook: ^0.8.0 => 0.8.0
    storybook: ^8.1.11 => 8.2.4

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions