storybookjs / test-runner

🚕 Turn stories into executable tests
https://storybook.js.org/docs/writing-tests/interaction-testing
MIT License
221 stars 67 forks source link

[Bug] Interaction test not working with runner #268

Open bastiengrignon opened 1 year ago

bastiengrignon commented 1 year ago

Describe the bug

I made a interaction test with Storybook, it passes without errors on Storybook but when I want to run this test using storybook test-runner I've got an error.

Steps to reproduce the behavior

@storybook/addon-a11y: ^7.0.0-beta.53 => 7.0.0-beta.53 
@storybook/addon-actions: ^7.0.0-beta.53 => 7.0.0-beta.53 
@storybook/addon-coverage: ^0.0.8 => 0.0.8 
@storybook/addon-essentials: ^7.0.0-beta.53 => 7.0.0-beta.53 
@storybook/addon-interactions: ^7.0.0-beta.53 => 7.0.0-beta.53 
@storybook/addon-links: ^7.0.0-beta.53 => 7.0.0-beta.53 
@storybook/addon-viewport: ^7.0.0-beta.53 => 7.0.0-beta.53 
@storybook/blocks: ^7.0.0-beta.53 => 7.0.0-beta.53 
@storybook/jest: ^0.0.11-next.0 => 0.0.11-next.0 
@storybook/react: ^7.0.0-beta.53 => 7.0.0-beta.53 
@storybook/react-vite: ^7.0.0-beta.53 => 7.0.0-beta.53 
@storybook/test-runner: ^0.10.0-next.8 => 0.10.0-next.8 
@storybook/testing-library: ^0.0.14-next.1 => 0.0.14-next.1

Expected behavior

The runner shouldn't throw an error

Screenshots and/or logs

My code : Screen at 02-24-2023_00:44:20 The test that pass on Storybook : Screen at 02-24-2023_00:45:13 The test that fail on storybook-runner : Screen at 02-24-2023_00:50:51

Environment

Additional context

Add any other context about the problem here.

athenasbane commented 1 year ago

I have the same issue working in the UI but not in the test runner

athenasbane commented 1 year ago

Figured my problem out. The runner assumes a certain viewport size. I had to create a preRender to set it based on the params