spectron
spectron copied to clipboard
TypeError: waitUntilWindowLoaded Cannot read property 'isLoading' of undefined
Getting this error wherever wait conditions are applied. Issue started when I switched to Spectron version 14 and Electron version 12.
On previous similar reported issues, it is suggested to set nodeIntegration: true
which is already configured and devtool is also disabled, still getting this error.
App initialization script is like this:
app = await new Application({
path: path.join(process.cwd(), getExecutablePath()),
chromeDriverArgs: [
"verbose",
"no-sandbox",
"disable-gpu",
"disable-dev-shm-usage",
],
waitTimeout: 15000,
});
return app;
}
-
And the test case is failing at this statement `await app.client.waitUntilWindowLoaded();`
Please suggest.
![image](https://user-images.githubusercontent.com/40120518/146352161-78395353-eb91-435a-92d7-c9a311c8781e.png)
can you provide full code of your test case?
Hi @xupea ,
This is how app initialization and tests are maintained: There is a setup file where app is initialized (file is called hooks.ts) let app: Application; export async function initializeApp() { app = await new Application({ path: path.join(process.cwd(), getExecutablePath()), chromeDriverArgs: [ "verbose", "no-sandbox", "disable-gpu", "disable-dev-shm-usage", ], waitTimeout: 15000, }); return app; }
export const getApp = async () => { if (app && app.isRunning()) { return app; } else { app = await initializeApp(); await app.start(); return app; } };
In my test file it is like this:
describe("App name", async function () { let app: Application; this.timeout(10000);
before(async () => { app = await hooks.getApp(); await app.client.waitUntilWindowLoaded(15000); ----- Its failing at this step });
it("Should launch single application window", async () => { return await app.client.getWindowCount().should.eventually.equal(1); }); });
Regards Harshendra
Hi @xupea @zeke @durran @juliangruber , can you guys please help with this issue?
@harshendrathakur
you don't need to await new Application(...)
operation, you had better try to run you e2e under this demo: https://github.com/electron-userland/spectron#usage
@xupea
Its not working even after removing the await from the new Application(...)
operation.
Even if I remove the await app.client.waitUntilWindowLoaded(15000)
statement from the before method. Some other test will fail where any wait conditions are are applied for example waitForExists
or waitUntil
. So, it failing for all the waits after upgrading to spectron 14.