playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Bug]: Component fails to render in test when importing/using a variable from the same file as the component.

Open CkSned opened this issue 1 year ago • 3 comments

Version

1.41.2

Steps to reproduce

  1. Download the attached minimal reproduction zip file.
  2. Install dependencies with pnpm install.
  3. Run the tests with pnpm test (should pass).
  4. Uncomment the console.log(links); line in the test.
  5. Run the tests again.

ct-import-bug.zip

Expected behavior

When component testing, we should be able to import & use a variable from the same file as the component currently under test.

Actual behavior

The component fails to render in test when importing/using a variable from the same file as the component.

Additional context

No response

Environment

System:
    OS: macOS 14.3.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.21 GB / 16.00 GB
  Binaries:
    Node: 18.18.2 - ~/.asdf/installs/nodejs/18.18.2/bin/node
    npm: 10.2.5 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 8.15.2 - /opt/homebrew/bin/pnpm
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/experimental-ct-react: 1.41.2 => 1.41.2

CkSned avatar Feb 15 '24 11:02 CkSned

I can reproduce, great repro, thanks! We'll look at it.

mxschmitt avatar Feb 15 '24 21:02 mxschmitt

@mxschmitt do you got any progress ?? I want to solve so may be we can work together, How is it?

Nitin6404 avatar Feb 17 '24 04:02 Nitin6404

I've also noticed that sometimes attempting to import a variable from the same file as the component under test will cause the test file itself to disappear completely from the Playwright UI.

I haven't been able to create a minimal reproduction of this to add to the bug, but it's likely related to the original issue.

This doesn't appear to be an issue when importing types or interfaces used as props passed to the component.

CkSned avatar Mar 14 '24 15:03 CkSned