Get help with testing, discuss unit testing strategies etc.


Post by sudhanshu_siesta »

Hi ,

i am getting exception
Test suite threw an exception : typeError: Cannot read property 'nodeName' of null
But i am not able to find what is the actual cause

This is my test.js file which is throeing error on running
StartTest(function(t) {

t.ok(Siesta, "Siesta is here")

t.ok(Siesta.Test, "Siesta.Test is here")
t.ok(Siesta.Harness, "Siesta.Harness is here")

t.chain(
{
action : 'type',
target : Ext.ComponentQuery.query('textfield')[0],
text : 'sudhanshu'
}


)
})
Kindly help me on this.

Thanks,
sudhanshu

Post by nickolay »

This feels incorrect - it should fail with "Siesta is not defined" exception. You should remove these checks:
t.ok(Siesta, "Siesta is here")

t.ok(Siesta.Test, "Siesta.Test is here")
t.ok(Siesta.Harness, "Siesta.Harness is here")
Otherwise all should work if you have a text field on your test page (I see that your are not creating it before typing).

Post by mats »

That's not a complete test case for us to look at, since you do not create the text field anywhere. Please submit a full test case we can inspect easily.

Post by sudhanshu_siesta »

mats wrote:That's not a complete test case for us to look at, since you do not create the text field anywhere. Please submit a full test case we can inspect easily.
Hi,

I am using my application file where my text field is created and using test.js to access textfield

Harness.start(
{
hostPageUrl :'https://localhost/iberepo/webui/index.html',
url :'test.js'

},
)
Am i doing right.
This is earlier suggested by community guys only.

Thanks,
Sudhanshu

Post by mats »

I would suggest waiting for the component to exist first. Try using
{ waitFor : 'CQ', args : ['textfield'] }
Since you can't type into it if it doesn't exist...

Post by sudhanshu_siesta »

mats wrote:I would suggest waiting for the component to exist first. Try using
{ waitFor : 'CQ', args : ['textfield'] }
Since you can't type into it if it doesn't exist...
Hi Mats,

I have to put this in test.js file before text field accessing code. M i right.

Second thing to access ext UI elements which is best way because when i see dom the id that given by me in code for text field will set up on div that will be parent of inputfield(in dom).

Thanks,
Sudhanshu

Post by sudhanshu_siesta »

mats wrote:I would suggest waiting for the component to exist first. Try using


{ waitFor : 'CQ', args : ['textfield'] }


Since you can't type into it if it doesn't exist...
Hi,

I tried using ext.waitforxtype method but getting error
object # no method waitForXtype
StartTest(function(t) {
    Ext.waitForXType('textfield',function(){
	t.chain(
	
		{
			action      : 'type',
			target      : Ext.ComponentQuery.query('textfield')[0],
			text        : 'sudhanshu'
		}
		
		
    )},this)
})    
Am i doing something wrong.
Kindly help.

Thanks,
Sudhanshu

Post by nickolay »

You are lost. Why don't you start by examining our numerous examples in the /examples folder? Try modifying them here and there to understand the basics. Then you can continue on testing your application.

Post by sudhanshu_siesta »

nickolay wrote:You are lost. Why don't you start by examining our numerous examples in the /examples folder? Try modifying them here and there to understand the basics. Then you can continue on testing your application.
HI Nikolay,

I will starting that only.
One last doubt is
StartTest(function(t) {
    var otextfield = Ext.getCmp('ibe-input-user')
    t.ok(Ext.Window, '.. indeed')
	t.ok(otextfield,'textfield')
    t.type(otextfield,'sudhanshu')
	
	t.done();

})    
By running this test first two cases are green but whan i am using t.type then i am getting error
Type error : cannot read property nodeName of null
My doubt is when my second test i.e.
t.ok(otextfield,'textfield')
showing green then why this type one is giving error.
Thanks,
Sudhanshu

Post by nickolay »

Try checking that field is already rendered, before typing:
t.ok(otextfield.rendered,'Text field is already rendered')

Post Reply