Open lesn1kk opened 3 months ago
We have not researched the issue yet because we are focused on other tasks.
You can try using VSCode Uncaught Exceptions breakpoints for debugging.
Hello @Bayheck,
I believe that this issue should be reopened because the problem for Electron 29+ is not the same as for Electron 28. As originally stated by @lesn1kk, applying the fix from #110 does not solve the problem for Electron 29+. So this issue is not a duplicate.
What's the plan regarding the maintenance of this Electron plugin? It has not been made compatible with Electron 28 (2023/12) yet, despite the availability of a documented solution. Will it be deprecated? Thanks in advance for clarifying the situation (and letting us prepare ourselves accordingly).
I managed to make our TestCafe tests start with Electron 30.0.9 by patching src/injectable/index.js
as followed (just replace the entire file content).
module.exports = function (config, testPageUrl) {
const appEntryPoint = require.resolve(config.appPath);
config.appEntryPoint = appEntryPoint;
process.argv.push(appEntryPoint);
const originalAppCodeLoaded = process.appCodeLoaded;
process.appCodeLoaded = () => {
require('./electron-mocks')(config, testPageUrl);
originalAppCodeLoaded();
};
};
Note that I got rid of the decorator for Module._load()
. This reduces complexity, increases robustness and is a step in the right direction for the compatibility with ESM (I could successfully run my test with a .mjs
entrypoint).
I will reopen the issue, but we cannot give any estimates of when we will fix it.
UPDATE: the patch above works fine with Electron 30.0.9. But we just upgraded to 30.1.1 and the tests do not start anymore.
After some preliminary investigations, it looks like this function of the TestCafe test-run
module is never invoked when running the tests for Electron 30.1.1. As a consequence, 'connected'
is never emitted and the tests do not start (see here).
The problem is actually related to this code block in Hammerhead. It triggers an error that breaks the transport
mechanism, which ultimately prevents the tests from starting. It is only executed for Electron 30.1.1 because of this code change that makes fetch
available on the window
object. But win.Response
and win.Request
are both undefined
in web workers because of a bug in Electron. See this comment for more details.
The solution is to wait for a fix of Electron. The workaround is to comment out the code block in node_modules / testcafe-hammerhead / lib / client / transport-worker.js
.
I have reported the issue to the Electron team.
Hi,
It looks like the provider does not work with Electron version 29 and above (considering also the workaround proposed in another issue).
Do you plan adding such support in nearest future? Could you provide me some details how can I debug the hook responsible for decorating and mocking the electron stuff?
Thanks