Closed volosincu closed 8 months ago
Hello @volosincu,
Could you please pack all necessary files into a public repository?
The cause is upgrade of axios-hooks to version 5.0.0 or greater. The issue is the change on default lru cache settings in axios-hooks starting with 5.0.0. If my remote (exposed from webpack-module-federation) use axios-hooks smaller than v5.0.0 then test cafe has no issue running the tests.
The solution was to disable cache when initialize axios-hooks configure({ cache: false });
.
To reproduce the bug I created this repo with basic setup React webpack modfed.
If remote app doesn't start after npm start
just run npm start
in the remote directory.
See lines 4 and 5 code
import { Selector } from "testcafe";
fixture`Smoke Test`.page("http://localhost:3000/");
test("crawl homepage", async (t) => {
await t.setNativeDialogHandler(() => true);
await t.wait(5000);
await t.click("#btn-hello");
await t.click("#btn-clean");
await t.wait(5000);
await t.wait(5000);
await t.click("#btn-refetch");
await t.wait(5000);
await t.click(Selector("#id-3Gti52e4r344"));
await t.wait(5000);
});
hammerhead.js:20803 Uncaught (in promise) Error: Cannot set property '0' of undefined
at PropertyAccessorsInstrumentation._error (hammerhead.js:20803:16)
at PropertyAccessorsInstrumentation._propertySetter (hammerhead.js:20856:47)
at LRUCache.set (index.js:856:14)
at tryStoreInCache (index.js:133:11)
at _callee2$ (index.js:193:13)
at tryCatch (regeneratorRuntime.js:45:16)
at Generator.eval (regeneratorRuntime.js:133:17)
at Generator.eval [as next] (regeneratorRuntime.js:74:21)
at fastApply (hammerhead.js:20899:26)
at value (hammerhead.js:20987:25)
Hello,
Thank you for creating an example repo.
I did not encounter any issues when running your test in Native Automation mode. Starting from version 3.0, TestCafe runs tests with the Native Automation option enabled by default. If you can reproduce the issue using native automation mode, please create a separate ticket using this template
What is your Scenario?
NPM dependencies package.json
Webpack config
What is the Current behavior?
Scenario
The tests flows break with following errors
When rendering the 2 components from the remote microfrontend the error below appears. It happens only in the TestCafe browser window. Not sure why but I reckon that hooks from the components loaded with dynamic import in React.lazy break cause WEBPACK_DEFAULT_EXPORT is missing ( the same code works if not in TestCafe context)
What is the Expected behavior?
To render the 2 components from the remote microfrontend.
What is the public URL of the test page? (attach your complete example)
https://localhost:80/
What is your TestCafe test code?
Your complete configuration file
Your complete test report
No response
Screenshots
No response
Steps to Reproduce
TestCafe version
3.4.0
Node.js version
18.10
Command-line arguments
npx testcafe ./test_examples/test_smoke.js --config-file .testcafenight.js
Browser name(s) and version(s)
Chrome 120
Platform(s) and version(s)
Windows 11
Other
No response