Get help with testing, discuss unit testing strategies etc.


Post by team.avesta »

Hey,
I am using ExtJs 4.1.2 and Siesta 1.1.2..
.
I have a problem with a combo Box drop-down arrow button id. ExtJs generates automatically and so i am not able to write a testcase in which i need to specify the button Id....and this id changes everytime....kindly help me out.
.
for visualizing my problem more clearly here is a screenshot
1.png
1.png (17.5 KiB) Viewed 4574 times
I am taking Id like this :
2.png
2.png (42.13 KiB) Viewed 4574 times
.
.
If you want more information please let me know.
.
Thanks in advance.

Post by nickolay »

Did you try composite query like
t.click("combobox => .x-form-trigger", callback)
? That element has specific CSS classes.

Post by team.avesta »

Thanks Nickolay,
.
Yeaa i have done that......but i am having more than one combo in my form
.
and so it gives me this error : ComponentQuery combo matched more than 1 Ext.Component.
.
please let me know how to deal with this error

Post by nickolay »

Well, as the error says - "combobox" is too generic component query (which is a first step in composite query). It matches all comboxes on the page. Make it more specific, to match only the combobox that you are interested in.
See https://docs.sencha.com/ext-js/4-1/#!/ap ... onentQuery

Post by team.avesta »

I am not able to figure out the problem i am facing...i study ur link but somehow i am not getting solution to my problem
.
here is my problem :

i am having total 4 combo in my testing module....one in toolbar and remaining 3 in formPanel.
.
here is screen shot.
3.png
3.png (27.28 KiB) Viewed 4568 times
.
and in writing a test case i need a unique permanent Id.
.
in my first combo i wrote this code and it works fine...but the same didnot work for form panel combo.
t.chain
          {
           action : 'click',
           target : 'combo => .x-form-trigger'
        }
           
.
it gives an error : ComponentQuery combo matched more than 1 Ext.Component

Post by nickolay »

You need to make query more specific, for example: 'combo[type="sometype"] => .x-form-trigger'. Here we assume that combobox was configured with { type : "someType" } option.

Post by team.avesta »

Thanks Nickolay... It works for me..
.
but now i am not able to select the value from the combo.
.
i selected the combo value by writting a code
t.chain 
{
           {
                  action : 'click',
                  target : 'combo[type="combo1"] => .x-form-trigger'
            },
            {
                   action : 'click',
                    target : '.x-boundlist-item'
            } 
}       
but now i have a situation in which there are 4 options in combo box...
4.png
4.png (39.86 KiB) Viewed 4559 times
.
i tried all possible combination to select option and also used getPicker().getNode() but still no Luck.. :(
i wrote my code this way :
          {
              action : 'click',
              target : 'combo[type="combo1"].getPicker().getNode(1)'
           }
.
Please tell me how to select option among them.
.
Thanks in advance.
Last edited by team.avesta on Sat Oct 20, 2012 10:24 am, edited 1 time in total.

Post by mats »

To target only this particular BoundList you'll need to decorate it with a CSS class. Use listConfig for this: https://docs.sencha.com/ext-js/4-1/#!/ap ... listConfig (see cls option)

Then:
target : 'combo[type="combo1"] => .x-form-trigger'
            },
            {
                   action : 'click',
                    target : '.myBoundListClass'
            } 

Post by team.avesta »

Thanks for your response Mats
.
I tried listConfig
listConfig: {
                  tpl : '<tpl for="."><div class=".x-boundlist-item {CountryName}">{CountryName}</div></tpl>'
                  },
.
and this code differentiated my boundlist class with different name.
.
and then wrote this code :
                {
                               action : 'click',
                               target : '.x-boundlist-item India'
                },
6.png
6.png (39.03 KiB) Viewed 4557 times
.
but No successs :(
.
and also tried the other way around like this :
                {
                               action : 'click',
                               target : '.India'
                },
.
5.png
5.png (37.85 KiB) Viewed 4557 times
Still NO Luck :((
.
Please let me know where i am making a mistake.
.
Thanks in advance.

Post by mats »

Please dump your full test and I'll inspect it.

Post Reply