playwright
playwright copied to clipboard
Support React forwards refs and memo
This PR fixes the react selector behavior to support components that are wrapped by the memo or forwardRef React builtin functions.
Previously these components couldn't be selected. This PR fixes that behavior, enabling selecting those components.
Current behavior:
const Foo = memo(() => <div id="foo_component" />);
Foo.displayName = "Foo";
...
playwright.$("_react=Foo") -> undefined
Fixed behavior:
const Foo = memo(() => <div id="foo_component" />);
Foo.displayName = "Foo";
...
playwright.$("_react=Foo") -> <div id ="foo_component" />
@microsoft-github-policy-service agree company="OutSystems"
Hey @joaompneves, can you please add a test for this?
Done. Seems that some tests are flacky
Test Runner test results: https://mspwblobreport.z1.web.core.windows.net/run-5127460031-7e6e5f070630cd63c723b7390b329498abc2f9c9-test_test_runner/index.html
Primary test results: https://mspwblobreport.z1.web.core.windows.net/run-5127460031-7e6e5f070630cd63c723b7390b329498abc2f9c9-test_linux/index.html
Tracing test results: https://mspwblobreport.z1.web.core.windows.net/run-5127460034-7e6e5f070630cd63c723b7390b329498abc2f9c9-tracing_linux/index.html