Skip to content

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

Open

Description

@harshendrathakur

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)

Activity

  1. xupea commented on Dec 20, 2021

    @xupea
    Contributor

    can you provide full code of your test case?

  2. harshendrathakur commented on Dec 20, 2021

    @harshendrathakur
    Author

    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

  3. harshendrathakur commented on Dec 22, 2021

    @harshendrathakur
    Author

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

  4. xupea commented on Dec 23, 2021

    @xupea
    Contributor

    @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

  5. harshendrathakur commented on Dec 23, 2021

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions