Get help with testing, discuss unit testing strategies etc.


Post by Erik2012 »

Hello,

I get a weird error message on my test suite. The test runs through completely because when I placed a log in the last function this is reached by siesta. The message you can see in the image below. Here is my testcode. I am using Siesta Lite.
StartTest(function(t) {
    t.chain(
        
		{ waitFor : 'CQ', args : 'loginPanel' },
		
		function (next) {
			var userNameField = t.cq('#usernameTextField');
			t.type(userNameField, 'ADMIN', next);
		}
	);
})  
When I delete the row
t.type(userNameField, 'ADMIN', next);
The Test passes green. Do you have any idea where my problem is?

Thank you
Erik
Attachments
timeout bug.jpg
timeout bug.jpg (44.64 KiB) Viewed 2906 times

Post by nickolay »

Hm.. Can you double check and confirm that removing this row
t.type(userNameField, 'ADMIN', next);
fixes the problem. It seems test stucks _before_ this line, so it can not affect the result in any way.

Things to try also: 1) set "overrideSetTimeout" config option to false 2) If you are using "hostPageUrl" config - check that you don't double preload the things.

Post by nickolay »

Also do you see any exceptions in the console (enable the "transparent exceptions" mode)?

Post by Erik2012 »

Hi,

I do the following
StartTest(function(t) {
    t.chain(
        
		{ waitFor : 'CQ', args : 'loginPanel' },
		
		function (next) {
			var userNameField = t.cq('#usernameTextField');
			//t.type(userNameField, 'ADMIN', next);
			console.log('The test is over now');
		}
	);
})  
Then the test passes. When I recomment the t.type row the test fails again. I edit my Harness configuration with the overrideSetTimeout in the following way.
var Harness = Siesta.Harness.Browser.ExtJS;

Harness.configure({
    title       : 'MVC Test Suite SecurityModule',
    loaderPath  : { 'MyApp' : 'app' },
    
    preload : [
        "ext/resources/css/ext-all.css",
        "ext/ext-all-debug.js"
    ]
});

Harness.start(
	{
        group               : 'Sanity',
        items               : [
            'tests/sanity.js'
        ]
    },
    {
        group               : 'UI Tests',
        
        // need to set the `preload` to empty array - to avoid the double loading of dependencies
        preload             : [],
        
        items : [
            {
                hostPageUrl         : 'index.html',
                url                 : 'tests/test.js'
            }
        ]
    }
);

Harness.overrideSetTimeout(false);
The warning from my post before with the hint to execute overrideSetTimeout(false) is still coming, even when it is already changed. When it fails the log message comes to the console. I become no exceptions in the console. The image below is from the code status without t.type so it passes in the other case it fails even with overrideSetTimeout.

Thank you
Erik
Attachments
13022013_141734.jpg
13022013_141734.jpg (45.28 KiB) Viewed 2901 times

Post by nickolay »

Hello,

Should be:
Harness.configure({
    title       : 'MVC Test Suite SecurityModule',
    loaderPath  : { 'MyApp' : 'app' },
    overrideSetTimeout   : false,
   
    preload : [
        "ext/resources/css/ext-all.css",
        "ext/ext-all-debug.js"
    ]
});
Try this please. Can you check also that `userNameField` is correctly found with the component query (and not an empty variable)? You can specify it directly as `t.type(">>#usernameTextField", "ADMIN", next)` btw.

Post by Erik2012 »

Thank you, now it works fine. I still ask my self why the overrideSetTimeout command is necessary. Sometimes magic happens :D . I did not test this because it was no expected behaviour and I never has to use this configuration.

Best reguards
Erik

Post by nickolay »

Yup, in the next Siesta release it will be set to "false" by default - its a quite specific feature, sometimes preventing the tests from finishing.

Post Reply