zombie icon indicating copy to clipboard operation
zombie copied to clipboard

clickLink Navigates to Page But Doesn't Wait For Page to Load Completely

Open juancarlosfarah opened this issue 8 years ago • 2 comments

I upgraded to version 5.0.4 from 4.3.0 and tests that were working before using clickLink are now failing because it looks like it's not waiting anymore for the page to fully load. If I log the browser's location after the click, it is the expected location, but when I log the HTML, I see that it is not updating and thus the tests on the page fail.

describe('clicks on the link', function () {
    before(done => {
        browser.clickLink('#link').then(done);
    });
    it('should navigate to the page', () => {
        console.log(browser.location.href);       // location here is correct
        console.log(browser.html());              // html here is incorrect
        browser.assert.element('.element');       // assertion fails
        ...
    });
});

If I add a browser.wait({ element: '.element' }) before it doesn't change the outcome.

This same exact test was working before the upgrade and if I change from using clickLink to visit it works (but obviously I lose the ability of testing the link). Is there anything I should be aware of that changed between the versions? I don't see anything specific in the CHANGELOG that might have broken this. Or perhaps I'm not using this functionality correctly? Would appreciate any pointers. Thanks!

juancarlosfarah avatar Nov 11 '16 13:11 juancarlosfarah

Not sure, but maybe try:

    before(done => {
        browser.clickLink('#link', done);
    });

Or maybe:

    before(function() {
        return browser.clickLink('#link');
    });

Or something like:

https://github.com/assaf/zombie/blob/master/test/angular_compat_test.js#L48-L50

leoj3n avatar Apr 28 '17 05:04 leoj3n

Maybe related to #1102

leoj3n avatar Apr 28 '17 05:04 leoj3n