Page 1 of 1

Stuck on "Waiting for page to load"

Posted: Thu Mar 07, 2019 10:02 pm
by Giga12
I have the following chain which when ran it sits on "Waiting for page to load". The page does in fact load so I don't know what I am missing
t.it('Should be able to load website', function (t) {
        t.chain({
            setUrl: '/workspace/main/index.html'
        },
            t.expect(1).toBe(1)
        )
    });
Image

Re: Stuck on "Waiting for page to load"

Posted: Fri Mar 08, 2019 10:10 am
by mats
Hm, looks odd. Any errors on the console?

Re: Stuck on "Waiting for page to load"

Posted: Fri Mar 08, 2019 5:57 pm
by Giga12
Unfortunately not.

I decided to instead implement the url portion at the project plan level which works fine.

project.plan(
    {
        pageUrl     : '/workspace/main/index.html',
        url: 'test/main.js'
    }
);

Re: Stuck on "Waiting for page to load"

Posted: Fri Mar 08, 2019 11:31 pm
by Giga12
Ok so my last fix broke another part of my application. I override setup in Siesta.Test.Browser, with authentication information. It seems that the url in pageUrl is called first before the my setup override, how do I fix this?

Re: Stuck on "Waiting for page to load"

Posted: Mon Mar 11, 2019 9:23 am
by nickolay
Perhaps "earlySetup()" is what you are looking for? https://www.bryntum.com/docs/siesta/#!/ ... earlySetup

Re: Stuck on "Waiting for page to load"

Posted: Mon Mar 11, 2019 8:55 pm
by Giga12
nickolay wrote: Mon Mar 11, 2019 9:23 am Perhaps "earlySetup()" is what you are looking for? https://www.bryntum.com/docs/siesta/#!/ ... earlySetup
Switching to this function causes my Test to go through the chain before the webpage is ready.

Note: This is only after making a single change of the function name from setup to earlySetup in my override class. I can see in the siesta UI that it jumps through the chain even before the site loads in the preview window.
Class('MyProject.MyTestClass', {
    isa     : Siesta.Test.Browser,

    override : {

        earlySetup : function (callback, errback) {
            this.SUPER(function () {
                //We want authentication before every Test
                Ext.Ajax.request({
                    url: '/auth/login',
                    method: 'POST',
                    params: {
                        username: 'username',
                        password: 'password'
                    },
                    success: function (res) {
                        callback();
                    },
                    failure: function () {
                        errback('Login Failed');
                    }
                });

            }, errback)
        }
    }
})
I guess what I really need to do is figure out why siesta can't find the page after setUrl is called instead of trying to find a work around for it. How can I assist with this?

Re: Stuck on "Waiting for page to load"

Posted: Tue Mar 12, 2019 9:53 am
by nickolay
With `setUrl` you need `enablePageRedirect`: https://www.bryntum.com/docs/siesta/#!/ ... geRedirect

But I'd recommend to use `pageUrl` instead, what was the issue with it again?

Re: Stuck on "Waiting for page to load"

Posted: Tue Mar 12, 2019 12:15 pm
by Giga12
PageUrl + Setup Override:
PageUrl is being called before my authorization the setup override. In the screenshot, main is called before login

Image

PageUrl + EarlySetup Override
Authorization works but the test runs through its self before the page loads in the preview window

Re: Stuck on "Waiting for page to load"

Posted: Wed Mar 13, 2019 6:37 am
by Giga12
We have figured out a solution with the earlySetup and implementing a wait.

Thank you both for your assistance, I wouldn't have gotten this far without them.