Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: waitUntilWindowLoaded Cannot read property 'isLoading' of undefined #1049

Open
harshendrathakur opened this issue Dec 16, 2021 · 5 comments

Comments

@harshendrathakur
Copy link

harshendrathakur commented Dec 16, 2021

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)
@xupea
Copy link
Contributor

xupea commented Dec 20, 2021

can you provide full code of your test case?

@harshendrathakur
Copy link
Author

harshendrathakur commented 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
Copy link
Author

Hi @xupea @zeke @durran @juliangruber , can you guys please help with this issue?

@xupea
Copy link
Contributor

xupea commented 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#usage

@harshendrathakur
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants