Get help with testing, discuss unit testing strategies etc.


Post by Hanterdro »

Hello,

I have a Login Window with EXTJS 4.1. After the succesfull login, the viewport is generated.

Actually I test the login with this code
StartTest(function(t) {	
	
	t.requireOk('app.view.login.Login', function() {
	
		t.waitForCQ('loginWin', function(window) {

			t.diag("loginWin found");
			
			t.waitForCQ('textfield[name=name]', function(textfield) {
				
				t.diag("textfield[name=name] found");
				
				t.type(textfield[0], 'foo');				
				
				t.waitForCQ('textfield[name=pwd]', function(textfield) {
					
					t.diag("textfield[name=pwd] found");
					
						t.type(textfield[0], 'bar', function() {
							
							t.clickCQ('button[action=loginAction]', function() {
							
									t.diag("clicked button loginAction");
									
									t.waitForCQ('viewport', function(textfield) {
										
										t.diag('viewport found - login succesfull');
										
										
									});
														
							});
							
						});
										
				});
				
			});

		});
	
	});
	
});

So fair so good, this code works very nice. But if the login was not successful I want an else case, where I can do some stuff. But the Callback from t.waitForCQ('viewport', function(textfield) { }); fires only when the the Element was found. Is there actually a posibility to catch such else cases, if the element is not found?

Post by mats »

Hmm not really. Does this not count as an error in your case?

Post by Hanterdro »

Hi mats,

thank you for quick respone.

An else case would be cool for several reasons:

* The Error which is thrown is not transparent: Timeout while waiting for conditionFailed assertion [waitFor]
Condition was not fullfilled during 10000ms
. Which an else case I would throw an error my self like "Login was not succesfull", what is easly to understand.

* The QA-Guy left to me want this feature ;)

* I think this would be a nice feature, too. Because we can write with it more complexe tests and have better understanding of the error messages (see point 1).

Post by mats »

* The waitFor error message is already improved, coming in next version.

* Ask him why? :)

* See #1. In next version error msg will say: "Waited too long for Component Query: viewport to appear." If you double click the failed line, the source code line will be highlighted :)

Post by Hanterdro »

* Cool! When do we get the next version? ;)

* Because of more complex tests - but this a nice to have feature... The Error message is for us/me much more important

Post by mats »

In 1-2 weeks I guess, not sure. Adding options for custom description for waitFor commands to TODO list.

Post Reply