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

[Bug] Sync issue in failures from one test affecting another test #62

Closed
yannbf opened this issue Feb 23, 2022 · 4 comments · Fixed by #404
Closed

[Bug] Sync issue in failures from one test affecting another test #62

yannbf opened this issue Feb 23, 2022 · 4 comments · Fixed by #404
Assignees
Labels
bug Something isn't working released sev:S2

Comments

@yannbf
Copy link
Member

yannbf commented Feb 23, 2022

Describe the bug

This seems not to be an actual bug in the test-runner, but rather in Storybook. Here's an example of a diagram that shows the sequence of steps in the test-runner:

image

Steps to reproduce the behavior

  1. Change the Demo story in Button.stories.js from:
export const Demo = (args) => (
  <button type="button" onClick={() => args.onSubmit('clicked')}>
    Click
  </button>
);

to:

export const Demo = (args) => (
  <button type="button" onClick={() => { throw new Error('boom') }}>
    Click
  </button>
);
  1. Run yarn test-storybook

The boom error should not leak into the FindBy story, which actually does not even use the same component as Demo:
image

@yannbf yannbf added the bug Something isn't working label Feb 23, 2022
@yannbf yannbf added the linear label Jan 9, 2023
@sneko
Copy link

sneko commented Jan 18, 2023

@yannbf don't know if it helps but awaiting in the preRender() helped me for a "similar" issue. #244

@bryanjtc
Copy link
Member

bryanjtc commented Feb 2, 2023

Removing the following code from the testPrefixer in transformPlaywright.ts fixes this issue. By removing it, the error doesn't leak to the FindBy story and it is still shown at the Demo story.

page.on('pageerror', (err) => {
          page.evaluate(({ id, err }) => __throwError(id, err), { id: %%id%%, err: err.message });
        });

It isn’t an ideal solution. Maybe I can find the cause in the jest-playwright package

@bryanjtc
Copy link
Member

bryanjtc commented Jul 1, 2023

I recently updated the pr #264 to change the proposed fix for this issue.

Copy link

🚀 Issue was released in v0.16.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released sev:S2
Projects
Archived in project
5 participants