Stuck on "Waiting for page to load"

Get help with testing, discuss unit testing strategies etc.
Post Reply
User avatar
Giga12
Posts: 6
Joined: Thu Mar 07, 2019 8:42 pm

Stuck on "Waiting for page to load"

Post by Giga12 » Thu Mar 07, 2019 10:02 pm

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

Code: Select all

t.it('Should be able to load website', function (t) {
        t.chain({
            setUrl: '/workspace/main/index.html'
        },
            t.expect(1).toBe(1)
        )
    });
Image

User avatar
mats
Core Developer
Core Developer
Posts: 14131
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: Stuck on "Waiting for page to load"

Post by mats » Fri Mar 08, 2019 10:10 am

Hm, looks odd. Any errors on the console?
Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

User avatar
Giga12
Posts: 6
Joined: Thu Mar 07, 2019 8:42 pm

Re: Stuck on "Waiting for page to load"

Post by Giga12 » Fri Mar 08, 2019 5:57 pm

Unfortunately not.

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

Code: Select all

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

User avatar
Giga12
Posts: 6
Joined: Thu Mar 07, 2019 8:42 pm

Re: Stuck on "Waiting for page to load"

Post by Giga12 » Fri Mar 08, 2019 11:31 pm

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?

User avatar
nickolay
Core Developer
Core Developer
Posts: 3329
Joined: Mon May 16, 2011 10:48 am

Re: Stuck on "Waiting for page to load"

Post by nickolay » Mon Mar 11, 2019 9:23 am

Perhaps "earlySetup()" is what you are looking for? https://www.bryntum.com/docs/siesta/#!/ ... earlySetup
We offer training in both Ext JS and our products, read more here.
Read the API documentation

User avatar
Giga12
Posts: 6
Joined: Thu Mar 07, 2019 8:42 pm

Re: Stuck on "Waiting for page to load"

Post by Giga12 » Mon Mar 11, 2019 8:55 pm

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.

Code: Select all

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?

User avatar
nickolay
Core Developer
Core Developer
Posts: 3329
Joined: Mon May 16, 2011 10:48 am

Re: Stuck on "Waiting for page to load"

Post by nickolay » Tue Mar 12, 2019 9:53 am

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?
We offer training in both Ext JS and our products, read more here.
Read the API documentation

User avatar
Giga12
Posts: 6
Joined: Thu Mar 07, 2019 8:42 pm

Re: Stuck on "Waiting for page to load"

Post by Giga12 » Tue Mar 12, 2019 12:15 pm

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

User avatar
Giga12
Posts: 6
Joined: Thu Mar 07, 2019 8:42 pm

Re: Stuck on "Waiting for page to load"

Post by Giga12 » Wed Mar 13, 2019 6:37 am

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.

Post Reply