Replies: 2 comments
-
|
@yynnooot Hi, thanks for reporting this. If you can supply a reproduction, I can change this into a bug report and prioritize it. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Have you tried using import { expect, fn, userEvent, waitFor } from 'storybook/test';
WaitingForDataFetch.test('has items', async ({ canvas }) => {
// Wait for component to be populated
await waitFor(
async () => {
const items = canvas.getAllByRole('treeitem');
await expect(items).toHaveLength(6);
},
{ timeout: 2000 },
);
});Note that I'm using the new syntax here, but the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I keep getting "TypeError: Cannot read propertoes of null ('reading useState') on the initial run of interaction tests. However, on subsequent runs the test pass. There is something going on where either React or Storybook is not ready on the first run.
The useState error suggests that React is not fully initialized when the component is rendered and/or there could be a race condition between Storybook's initialization and the test execution.
Please help, I have been trying to solve this for days now!
Additional information
I am using:
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions