You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeError: waitUntilWindowLoaded Cannot read property 'isLoading' of undefined #1049
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.

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;
}
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.
Activity
xupea commentedon Dec 20, 2021
can you provide full code of your test case?
harshendrathakur commentedon Dec 20, 2021
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
harshendrathakur commentedon Dec 22, 2021
Hi @xupea @zeke @durran @juliangruber , can you guys please help with this issue?
xupea commentedon Dec 23, 2021
@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#usageharshendrathakur commentedon Dec 23, 2021
@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 examplewaitForExistsorwaitUntil. So, it failing for all the waits after upgrading to spectron 14.