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

[Regression]: Component IDs clash with relative imports #30085

Closed
mxschmitt opened this issue Mar 24, 2024 · 0 comments · Fixed by #30108
Closed

[Regression]: Component IDs clash with relative imports #30085

mxschmitt opened this issue Mar 24, 2024 · 0 comments · Fixed by #30108
Assignees
Labels

Comments

@mxschmitt
Copy link
Member

mxschmitt commented Mar 24, 2024

Last Good Version

1.41

First Bad Version

1.42

Steps to reproduce

diff --git a/tests/components/ct-react-vite/tests/repro/one/Component.tsx b/tests/components/ct-react-vite/tests/repro/one/Component.tsx
new file mode 100644
index 000000000..5b0e60d4b
--- /dev/null
+++ b/tests/components/ct-react-vite/tests/repro/one/Component.tsx
@@ -0,0 +1,3 @@
+export default () => {
+    return "one"
+}
diff --git a/tests/components/ct-react-vite/tests/repro/one/test.spec.tsx b/tests/components/ct-react-vite/tests/repro/one/test.spec.tsx
new file mode 100644
index 000000000..d5f3bb735
--- /dev/null
+++ b/tests/components/ct-react-vite/tests/repro/one/test.spec.tsx
@@ -0,0 +1,7 @@
+import { test, expect } from '@playwright/experimental-ct-react';
+import Component from './Component';
+
+test('foo', async ({ mount }) => {
+  const component = await mount(<Component/>);
+  await expect(component).toHaveText('one');
+});
diff --git a/tests/components/ct-react-vite/tests/repro/two/Component.tsx b/tests/components/ct-react-vite/tests/repro/two/Component.tsx
new file mode 100644
index 000000000..3bf222eb4
--- /dev/null
+++ b/tests/components/ct-react-vite/tests/repro/two/Component.tsx
@@ -0,0 +1,3 @@
+export default () => {
+    return "two"
+}
diff --git a/tests/components/ct-react-vite/tests/repro/two/test.spec.tsx b/tests/components/ct-react-vite/tests/repro/two/test.spec.tsx
new file mode 100644
index 000000000..061f34ea1
--- /dev/null
+++ b/tests/components/ct-react-vite/tests/repro/two/test.spec.tsx
@@ -0,0 +1,7 @@
+import { test, expect } from '@playwright/experimental-ct-react';
+import Component from './Component';
+
+test('foo', async ({ mount }) => {
+  const component = await mount(<Component/>);
+  await expect(component).toHaveText('two');
+});

Expected behavior

Works

Actual behavior

Component two gets rendered in one.

Additional context

Regressed in #29407.

Around here: https://github.com/microsoft/playwright/pull/29407/files#diff-8dd3534dc5013c3779edeaded71324b0dd1c1807668f3c6d9e9a1aab1c20ae91

1.42.0-alpha-2024-02-09 bad
1.42.0-alpha-2024-02-08 good
range: 58f580d...7a86bf4

Environment

N/A
@mxschmitt mxschmitt assigned dgozman and pavelfeldman and unassigned dgozman Mar 24, 2024
mxschmitt added a commit that referenced this issue Mar 25, 2024
This restores the [best
effort](https://github.com/microsoft/playwright/pull/29407/files#diff-8dd3534dc5013c3779edeaded71324b0dd1c1807668f3c6d9e9a1aab1c20ae91L152)
logic if its a relativ path.

Fixes #30085

---------

Signed-off-by: Max Schmitt <max@schmitt.mx>
Co-authored-by: Pavel Feldman <pavel.feldman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants