"Waiting for page to load" since Chrome 72

Get help with testing, discuss unit testing strategies etc.
User avatar
paulb
Posts: 6
Joined: Thu Apr 11, 2019 9:47 am

"Waiting for page to load" since Chrome 72

Post by paulb » Thu Apr 11, 2019 11:09 am

Hi,
our integration tests are failing with being stuck on the "Waiting for page to load" message.
When we launch the test, we start on a blank page and use setUrl to navigate to our page. Up until Chrome 71 this has been working like a charm. Unfortunately since Chrome 72 this is broken (using a portable version of Chrome 71 still works).
The page loads fine and all tests prior to loading the page are run but as soon as the page has been loaded the test just shuts down. No error message is shown and no timeout is met. It looks like the javascript containing the testcase is lost after the reload therefore no further update of the test is done.
Is there any information about this behaviour?
Last edited by paulb on Wed May 08, 2019 8:52 am, edited 1 time in total.

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

Re: "Waiting for page to load" on since Chrome 72

Post by nickolay » Thu Apr 11, 2019 11:11 am

Hi,

No, this is something new. I'll investigate soon, stay tuned.
We offer training in both Ext JS and our products, read more here.
Read the API documentation

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

Re: "Waiting for page to load" on since Chrome 72

Post by nickolay » Mon Apr 15, 2019 5:49 pm

Sorry for the delay. I made a brief investigation, the Siesta's own tests related to the `setUrl` passes, using Chrome 73. Can try with that version? If the problem still persist, can you provide a reduced test case, reproducing the problem?
We offer training in both Ext JS and our products, read more here.
Read the API documentation

User avatar
paulb
Posts: 6
Joined: Thu Apr 11, 2019 9:47 am

Re: "Waiting for page to load" on since Chrome 72

Post by paulb » Wed Apr 17, 2019 1:28 pm

Ok looks like my test setup is not correct. We use setUrl without enablePageRedirect. Any idea how this could have worked with Chrome 71? And why it crashes since Chrome 72?
Anyhow, we updated our tests to use enablePageRedirect but now new problems occur. In our tests we rely on the existence of the ExtJS framework but it is not available now. If I understand Siesta correctly, using enablePageRedirect is creating two iframes, one for the test-case and another one for the site to test. The solution for my problem would be to load additional scripts (i.e. ext-all.js) before the test-case is executed. Is there an easy way to do this that I missed?

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

Re: "Waiting for page to load" on since Chrome 72

Post by nickolay » Wed Apr 17, 2019 1:37 pm

Weird, it should not work w/o `enablePageRedirect` of course.

Yes, `enablePageRedirect` creates 2 iframes. You can access the iframe with the website using `t.global` perhaps that will be enough? (the website will have ExtJS loaded I assume) If that is not enough, you can load any code for the test script manually (like using <script> tag), unfortunately there's no helper method for that in Siesta). Some inspiration code:

Code: Select all

            var node = document.createElement("script")

            node.setAttribute("type", 'text/javascript')
            node.setAttribute("src", URL)
            
            node.onload = node.onreadystatechange = function () {
                if (!node.readyState || node.readyState == "loaded" || node.readyState == "complete" || node.readyState == 4 && node.status == 200) {
                    node.onload = node.onreadystatechange = null
                    
                    CALLBACK()
                }
            }
            
            document.getElementsByTagName('head')[ 0 ].appendChild(node)

            return node
We offer training in both Ext JS and our products, read more here.
Read the API documentation

User avatar
paulb
Posts: 6
Joined: Thu Apr 11, 2019 9:47 am

Re: "Waiting for page to load" on since Chrome 72

Post by paulb » Thu Apr 18, 2019 8:46 am

Using t.global unfortunately is not enough.
Is there a way to override the setup method of Scope.Provider.Role.WithDOM, or better yet override the launchTest method of Siesta.Project.Browser.meta.extend so that my additional files are added to the testScriptScopeProvider before the test-case?

edit: Basically I want all of my preloads to be loaded before the test-case in the iframe that holds the test-case.

User avatar
paulb
Posts: 6
Joined: Thu Apr 11, 2019 9:47 am

Re: "Waiting for page to load" since Chrome 72

Post by paulb » Wed May 08, 2019 10:15 am

Ok I managed to make our tests run again by usind this override:

Code: Select all

Siesta.Project.Browser.meta.extend({
    override: {
        launchTest: function() {
            var me = this,
                setupFn = Scope.Provider.IFrame.prototype.setup;
            
            Scope.Provider.IFrame.prototype.setup = function(callback) {
                var iframeProvider = this;
                
                for (var i = 0; i < me.preload.length; i++) {
                    iframeProvider.addPreload(me.preload[i]);
                }
                
                setupFn.call(iframeProvider, callback);
            };
            
            me.SUPERARG(arguments);
            
            Scope.Provider.IFrame.prototype.setup = setupFn;
        }
    }
});
Does this look stable to you? Any recommendations for a better implementation?

Furthermore, isn't this a feature that should not require this override? A test script that requires some other scripts does not sound like an uncommon thing to do and using enablePageRedirect I see no option to do this. Or am I missing some other point of view here?

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

Re: "Waiting for page to load" since Chrome 72

Post by nickolay » Wed May 08, 2019 1:09 pm

Sorry, somehow missed your previous post.
A test script that requires some other scripts does not sound like an uncommon thing to do and using enablePageRedirect I see no option to do this.
Yes, this feature makes sense. I went ahead and added it to the core, as the new config option `testPreload`, which is the same as "preload" (supports `{ text : "code" }`, etc) but for the context of the test script. It will be available in the tomorrow nightly, please verify it works for you.
We offer training in both Ext JS and our products, read more here.
Read the API documentation

User avatar
paulb
Posts: 6
Joined: Thu Apr 11, 2019 9:47 am

Re: "Waiting for page to load" since Chrome 72

Post by paulb » Wed May 08, 2019 1:30 pm

Will do and get back to you tomorrow.

Thanks a lot, for your quick responses and help!

User avatar
paulb
Posts: 6
Joined: Thu Apr 11, 2019 9:47 am

Re: "Waiting for page to load" since Chrome 72

Post by paulb » Thu May 09, 2019 9:05 am

Just checked the nightly and testPreload works like a charm!
Great work!

Post Reply