You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Other info: It seems to happen in React 18 as well, although the error message doesn't get displayed.
Source code
I provided exact source code that allows reproducing the issue locally.
Config file
// playwright-ct.config.tsimport{defineConfig,devices}from'@playwright/experimental-ct-react17';/** * See https://playwright.dev/docs/test-configuration. */exportdefaultdefineConfig({testDir: './',// Glob patterns or regular expressions that match test files.testMatch: '*.spec.ts[x]',/* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */snapshotDir: './__snapshots__',/* Maximum time one test can run for. */timeout: 10*1000,/* Run tests in files in parallel */fullyParallel: true,/* Fail the build on CI if you accidentally left test.only in the source code. */forbidOnly: !!process.env.CI,/* Retry on CI only */retries: process.env.CI ? 2 : 0,/* Opt out of parallel tests on CI. */workers: process.env.CI ? 1 : undefined,/* Reporter to use. See https://playwright.dev/docs/test-reporters */reporter: 'html',/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */use: {/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */trace: 'on-first-retry',/* Port to use for Playwright component endpoint. */ctPort: 3100,},/* Configure projects for major browsers */projects: [{name: 'chromium',use: { ...devices['Desktop Chrome']},},{name: 'firefox',use: { ...devices['Desktop Firefox']},},{name: 'webkit',use: { ...devices['Desktop Safari']},},],});
Test file (self-contained)
import{test}from'@playwright/experimental-ct-react17';test('MyComponent-fails',async({ mount })=>{constchildren=[<div>hello</div>,'world'];constparent=<div>{children}</div>;console.log(JSON.stringify(parent,null,' '));awaitmount(parent);});test('MyComponent-works',async({ mount })=>{constchildren=[<div>hello</div>,'world'];// using the spread operator fixes it.constparent=<div>{ ...children}</div>;console.log(JSON.stringify(parent,null,' '));awaitmount(parent);});
Steps
Run the test
Expected
It should render without an error, and the JSON should be formed properly.
If I use the spread operator, it works fine. The issue is, the rest of our project does not use the spread operator to render children, since React then says Spread children are not supported in React..
System info
Source code
Config file
Test file (self-contained)
Steps
Expected
It should render without an error, and the JSON should be formed properly.
Actual
I get this error:
Also the JSON does not properly expand the children.
If I use the spread operator, it works fine. The issue is, the rest of our project does not use the spread operator to render children, since React then says
Spread children are not supported in React.
.Is there a workaround or configuration for this? Also I wonder if this is related to #26936.
The text was updated successfully, but these errors were encountered: