Comments (3)
Hey @bonchuk, could you make it easier to help by sending a minimal sample GitHub repository?
from playwright.
Description:
I am experiencing an issue with rendering the component from react-router-dom in my Playwright component tests. Specifically, I have a BoxLayout component that includes an , which should render the BoxScreen component when the URL matches /:language/basket/. However, the BoxScreen component is never shown during testing.
Expected Behavior:
The BoxScreen component should render correctly within the BoxLayout when the URL is /:language/box/.
Current Behavior:
The BoxScreen component does not render, and I am unable to verify its presence in the test.
Steps to Reproduce:
- Set up a React component test with Playwright.
- Include a BoxLayout component with an to render BoxScreen.
- Use BrowserRouter and await page.evaluate(() => {
window.history.pushState({}, '', '/com/box/');
}); before mount to simulate the URL /:language/box/. - Observe that the BoxScreen component does not render.
test snippet:
test.only('box-empty @theme', async ({ mount }, testInfo) => { await page.evaluate(() => { window.history.pushState({}, '', '/com/box/'); }); const component = await mount( <WrapperForTests> <boxContext.Provider value={context}> <boxLayout /> </boxContext.Provider> </WrapperForTests>, ); const screenshot = await component.screenshot(); expect(screenshot).toMatchSnapshot(); }); });
Additional Information:
Library Versions:
react-router-dom: [6.11.2]
@playwright/experimental-ct-react: [1.39.0]
@playwright/test: [1.39.0],
Environment:
Node.js version: [v21.7.3]
npm version: [10.8.1]
Operating System: [ubuntu 22.04]
Request:
Could you please provide guidance on how to correctly render components nested within using playwright and react-router-dom in component tests? Any help or examples would be greatly appreciated.
from playwright.
We need to be able to reproduce the problem to make this report actionable. Please file a new bug and provide a minimal reproducible example which we could run locally.
from playwright.
Related Issues (20)
- [Bug]: In CLI, workers option make NaN.
- [Bug]: Playwright Trace Viewer not loading UI when used via WebView2 HOT 1
- [Feature]: PageGotoOptions.Timeout should support any kind of errors HOT 1
- [Questions]gmail.com: This browser or app may not be secure. HOT 1
- [Feature]: Vue typesafe mount slots and events
- [While Runing Test in ADO with chrome]: net::ERR_HTTP2_PROTOCOL_ERROR HOT 3
- [Feature]: Vue generate hooksConfig boilerplate
- [Feature]: Custom Assert Messages within the .NET Bindings HOT 1
- [Bug]: The userAgent set in newContext cannot take effect in the worker HOT 3
- [Feature]: Expose `BrowserServer` contexts for hooking lifecycle methods HOT 2
- [Bug]: Missing_Document_Or_Link_For_Playwright_Python_Pytest_Reports HOT 2
- [Bug]: Cannot type French special characters (ç/é/ù/etc…) using page.keyboard.press HOT 2
- Want to understand how codegen works ? HOT 2
- [Feature]: Permission Granting for Storage Access API
- [Bug]: Browser cannot be closed properly in `bun` throwing `Target page, context or browser has been closed` HOT 1
- [Bug]: HOT 3
- [Bug]: Timeout Error when Launching Chromium with Bun JS HOT 1
- by using chromium.connect always browser.contexts() are empty HOT 2
- [Feature]: dynamic port in webServer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from playwright.