Strange behavior when changing URL in Safari

Get help with testing, discuss unit testing strategies etc.
Post Reply
User avatar
bjones
Posts: 6
Joined: Thu Nov 01, 2018 8:22 pm

Strange behavior when changing URL in Safari

Post by bjones » Sat Sep 14, 2019 1:52 am

I am experiencing some strange behavior when changing URLs in Safari. In our app, clicking on our main logo image re-directs to the main applet by changing the url ( window.location.href = '#'). When automating this with Siesta in Safari, clicking the logo leads to the iframe containing the app to re-direct to the Siesta browser interface instead of the main page. We are using Siesta 5.2.3.

I wrote a workaround to detect the browser we're using and to replace logo clicks with another url re-direct if we're in Safari. This works for now but it would be nice if clicking the logo in Safari did not produce this behavior.

I have included a gif and a reproducible example to produce the issue.

In Chrome - as expected
Image

In Safari
Image

Project

Code: Select all

const project = new Siesta.Project.Browser.ExtJS();

project.configure({
    title               : 'Test',
});

project.plan({
    group   : 'Classic Tests',
    items   : [{
		desc	: 'Test url redirect',
		pageUrl : '/siesta/spike.html',
		url	: 'classic-tests/system/new-survey/02_spike.js'
    }]
});

project.start();
spike.html

Code: Select all

<!DOCTYPE html>
<html>
    <head>
    </head>
    <body>
        <h1>
            <span id="clickme" onclick="changeURL()">Click me</span>
        </h1>
        <script>
            function changeURL() {
                window.location.href = '#';
            }
        </script>
    </body>
</html>
Test Case

Code: Select all

StartTest(t => {
    t.describe('Test clicking and re-directing to #', t => {
        t.chain({
            waitFor : 2000
        },{
            click : '#clickme'
        });
    });
});

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

Re: Strange behavior when changing URL in Safari

Post by nickolay » Mon Sep 16, 2019 5:22 pm

Thank you for the report, confirmed. This strange redirect only happens when the event handler is activated with the synthetic event. If you click the element manually, the same code is executed, but the result is different. Such browser's quirks are beyond Siesta control, we can not fix it, unfortunately.

I noticed you are assigning to the `window.location.href` which is meant for a full page url, shouldn't it be `window.location.hash`? The latter does not trigger this strange redirect.
We offer training in both Ext JS and our products, read more here.
Read the API documentation

Post Reply