[Fixed] What causes the problem in Protractor = Failed: script timeout error

Issue

Here is my code, it opens the page I want, input username and password, click the login button and get a wrong error or open the main page but after that nothing happens.

it('Wrong id pass input causes error', async () => {
        page = new AppPage();
        page.navigateTo();
        $("#exampleInput1").sendKeys("aaa")
        $("#exampleInput2").sendKeys("bbb")
        $("button").click();
        let isToastWarningPresent = await $("div#toast-container>.toast-warning").isDisplayed()
        expect(isToastWarningPresent)
        })

    it('Right id pass input redirect you to mainpage', async () => {
        page = new AppPage();
        page.navigateTo();
        $("#exampleInput1").sendKeys(username)
        $("#exampleInput2").sendKeys(password)
        $("button").click();
        expect(browser.getCurrentUrl()).toEqual(expectedUrl)
    })

My expects are broken. An expect need to return true or false but after waiting a couple of seconds it says:

Failed: script timeout
    (Session info: chrome=89.0.4389.82)
    (Driver info: chromedriver=89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/[email protected]{#294}),platform=Windows NT 10.0.19041 x86_64)

I try to rise allScriptsTimeout to 110000 but in that time the error changes to :

Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.

Think that it happens because of block-ui but when I try in another block-ui nothing bad happens.

Solution

browser.waitForAngularEnabled(false); solved my problem. Thanks.

Leave a Reply

(*) Required, Your email will not be published