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]: @playwright/experimental-ct-react fails to render if the root element is a React fragment #32853

Open
Kirdock opened this issue Sep 27, 2024 · 0 comments
Assignees
Labels

Comments

@Kirdock
Copy link

Kirdock commented Sep 27, 2024

Version

1.47.2

Steps to reproduce

Code:

import { test, expect } from '@playwright/experimental-ct-react';

test('should work', async ({ mount }) => {
  const component = await mount(<>Learn React</>); // fails to render
  await expect(component).toContainText('Learn React');
});

or:

  1. Clone repo https://github.com/Kirdock/playwright-bugs
  2. npm install
  3. npm run test:ct
  4. Execute the test that is shown
  5. React error. Nothing rendered

Expected behavior

The component renders even if a React fragment is on top.

Actual behavior

Nothing is rendred at all. Empty page with react errors
image

Additional context

Also worth to mention: npm init playwright@latest -- --ct did not work for me. The component test part was not included

Environment

System:
    OS: Windows 11 10.0.22631
    CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13950HX
    Memory: 35.94 GB / 63.69 GB
  Binaries:
    Node: 20.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD
    npm: 10.8.3 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.15.4 - C:\Program Files\nodejs\pnpm.CMD
  IDEs:
    VSCode: 1.92.2 - C:\Users\klaus.striessnig\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  Languages:
    Bash: 5.1.16 - C:\WINDOWS\system32\bash.EXE
  npmPackages:
    @playwright/experimental-ct-react: 1.47.2 => 1.47.2 
    @playwright/test: ^1.47.2 => 1.47.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants