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]: Wrapping Playwright CT test with createTest breaks tests #30436

Open
alxkor-com opened this issue Feb 1, 2025 · 0 comments
Open

[Bug]: Wrapping Playwright CT test with createTest breaks tests #30436

alxkor-com opened this issue Feb 1, 2025 · 0 comments

Comments

@alxkor-com
Copy link

alxkor-com commented Feb 1, 2025

Describe the bug

When Playwright test function is wrapped with createTest, which is advised here, and a function is passed as a prop to a component, the test fails:

Image
import AllStories from './button.stories.portable';
import {
  test
} from '@playwright/experimental-ct-react';
import { createTest } from '@storybook/react/experimental-playwright';

const sbTest = createTest(test);

sbTest.describe('Button', () => {
  sbTest('Primary', async ({ mount }) => {
    await mount(<AllStories.Primary onClick={() => {}} />);
  });
});

If I do this way, everything works fine

import AllStories from './button.stories.portable';
import {
  test,
} from '@playwright/experimental-ct-react';

test.describe('Button', () => {
   test('Primary', async ({ mount }) => {
     await mount(<AllStories.Primary onClick={() => {}} />);
   });
});

Reproduction link

https://github.com/alxkor-com/sb-problem

Reproduction steps

  1. Clone repo https://github.com/alxkor-com/sb-problem
  2. yarn
  3. yarn test-ct
  4. Observe issue

System

Storybook Environment Info:

  System:
    OS: macOS 15.0
    CPU: (12) arm64 Apple M3 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.0 - /opt/homebrew/opt/node@20/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn <----- active
    npm: 10.8.2 - /opt/homebrew/opt/node@20/bin/npm
  Browsers:
    Chrome: 132.0.6834.160
    Safari: 18.0
  npmPackages:
    @storybook/addon-essentials: ^8.6.0-alpha.3 => 8.6.0-alpha.3 
    @storybook/addon-interactions: ^8.6.0-alpha.3 => 8.6.0-alpha.3 
    @storybook/addon-onboarding: ^8.6.0-alpha.3 => 8.6.0-alpha.3 
    @storybook/blocks: ^8.6.0-alpha.3 => 8.6.0-alpha.3 
    @storybook/react: ^8.6.0-alpha.3 => 8.6.0-alpha.3 
    @storybook/react-vite: ^8.6.0-alpha.3 => 8.6.0-alpha.3 
    @storybook/test: ^8.6.0-alpha.3 => 8.6.0-alpha.3 
    storybook: ^8.6.0-alpha.3 => 8.6.0-alpha.3

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants