[Webtest] Anyone testing Dojo filtering selects & onchange JS?

Lisa Crispin Lisa Crispin <lisa.crispin@gmail.com>
Thu, 9 Jun 2011 12:05:23 -0600


--00504502d44b0a58d804a54b4ca4
Content-Type: text/plain; charset=ISO-8859-1

We recently started using these Dojo filtering select widgets (are they
widgets? I'm not sure of the right term - they are something our programmers
are putting in the code that is, in turn, generating HTML and JS) and
they're giving us problems. This must be in common usage now so I hope
someone else is using them in their code and knows how to test them with
WebTest?

Basically the selection enables or disables something else on the page using
JS. The select list is some weird kind of hidden field, the only way we can
select it is with forceHiddenInputField
   <forceHiddenInputField description="choose advisor"
                                       name="advisorId" value="226783"/>

But nothing I've tried will enable the subsequent select lists or radio
buttons so that the script can set those values. I've tried
emulateSetElementAttribute and forceInputFieldAttribute, they pass, but they
don't enable anything, for example:
<emulateSetElementAttribute description="enable select fields"

htmlId="serviceLevels[0].serviceLevelTiers[0].selectedRate"
                                          attributeName="disabled"
                                          attributeValue=""/>

Does anyone have this type of code, and if so, how are you scripting your
tests?

When I inspect element on the select list, this is what comes up (I can't
see this in the html source, only via Firebug):
<input type="text" waistate="haspopup-true,autocomplete-list"
wairole="textbox" dojoattachpoint="textbox,focusNode"
dojoattachevent="onkeypress:_onKeyPress,compositionend" class="dijitReset"
autocomplete="off" role="textbox" aria-haspopup="true"
aria-autocomplete="list" aria-invalid="false" id="advisorId" tabindex="0"
aria-required="true" value="No Advisor">

Here is what is in the html source for the select list:

<select dojoType="dijit.form.FilteringSelect" id='advisorId'
name='advisorId' onchange="selectPlanAdvisor();">
                    <option value="0"  selected >

                No Advisor
            </option>
                    <option value="211018" >
                Advisor, AdvisorSelect401k
            </option>
                    <option value="211020" >
                Advisor, Fast401k
            </option>
                    <option value="226783" >
                Paychex, Jill R
            </option>

            </select>

When I inspect element on the select list further down, which is disabled
since I didn't select anything in the first list, I see:
<select name="serviceLevels[0].serviceLevelTiers[0].selectedRate"
id="serviceLevels[0].serviceLevelTiers[0].selectedRate" disabled="">
                    <option selected="selected" value="0.00%">
            0.00%</option>
                    <option value="0.05%">
(etc, it has a lot of values)

I can't get this select list to enable.

I'm having the same problem with our Watir scripts. I get the impression
that lots of people use these techniques in their GUI code, so someone must
have a way to automate tests against them.

Thanks,
Lisa


-- 
Lisa Crispin
Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers
and Agile Teams_ (Addison-Wesley 2009)
Contributor to _Beautiful Testing_ (O'Reilly 2009)
http://lisacrispin.com
@lisacrispin on Twitter
http://entaggle.com/lisacrispin

--00504502d44b0a58d804a54b4ca4
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

We recently started using these Dojo filtering select widgets (are they wid=
gets? I&#39;m not sure of the right term - they are something our programme=
rs are putting in the code that is, in turn, generating HTML and JS) and th=
ey&#39;re giving us problems. This must be in common usage now so I hope so=
meone else is using them in their code and knows how to test them with WebT=
est?<br>
<br>Basically the selection enables or disables something else on the page =
using JS. The select list is some weird kind of hidden field, the only way =
we can select it is with forceHiddenInputField<br>=A0=A0 &lt;forceHiddenInp=
utField description=3D&quot;choose advisor&quot;<br>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 name=3D&quot;advisorId&quot; value=
=3D&quot;226783&quot;/&gt;<br><br>But nothing I&#39;ve tried will enable th=
e subsequent select lists or radio buttons so that the script can set those=
 values. I&#39;ve tried emulateSetElementAttribute and forceInputFieldAttri=
bute, they pass, but they don&#39;t enable anything, for example:<br>
&lt;emulateSetElementAttribute description=3D&quot;enable select fields&quo=
t;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 htmlId=3D&quot;servi=
ceLevels[0].serviceLevelTiers[0].selectedRate&quot;<br>=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 attributeName=3D&quot;disabled&quot;<br>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 attributeValue=3D&quot;&qu=
ot;/&gt;<br><br>Does anyone have this type of code, and if so, how are you =
scripting your tests?<br><br>When I inspect element on the select list, thi=
s is what comes up (I can&#39;t see this in the html source, only via Fireb=
ug):<br>
&lt;input type=3D&quot;text&quot; waistate=3D&quot;haspopup-true,autocomple=
te-list&quot; wairole=3D&quot;textbox&quot; dojoattachpoint=3D&quot;textbox=
,focusNode&quot; dojoattachevent=3D&quot;onkeypress:_onKeyPress,composition=
end&quot; class=3D&quot;dijitReset&quot; autocomplete=3D&quot;off&quot; rol=
e=3D&quot;textbox&quot; aria-haspopup=3D&quot;true&quot; aria-autocomplete=
=3D&quot;list&quot; aria-invalid=3D&quot;false&quot; id=3D&quot;advisorId&q=
uot; tabindex=3D&quot;0&quot; aria-required=3D&quot;true&quot; value=3D&quo=
t;No Advisor&quot;&gt;<br>
<br>Here is what is in the html source for the select list:<br><pre id=3D"l=
ine147">&lt;<span class=3D"start-tag">select</span><span class=3D"attribute=
-name"> dojoType</span>=3D<span class=3D"attribute-value">&quot;dijit.form.=
FilteringSelect&quot; </span><span class=3D"attribute-name">id</span>=3D<sp=
an class=3D"attribute-value">&#39;advisorId&#39; </span><span class=3D"attr=
ibute-name">name</span>=3D<span class=3D"attribute-value">&#39;advisorId&#3=
9; </span><span class=3D"attribute-name">onchange</span>=3D<span class=3D"a=
ttribute-value">&quot;selectPlanAdvisor();&quot;</span>&gt;<br>
                    &lt;<span class=3D"start-tag">option</span><span class=
=3D"attribute-name"> value</span>=3D<span class=3D"attribute-value">&quot;0=
&quot;  </span><span class=3D"attribute-name">selected </span>&gt;<br></pre=
><pre id=3D"line157">
                No Advisor<br>            &lt;/<span class=3D"end-tag">opti=
on</span>&gt;<br>                    &lt;<span class=3D"start-tag">option</=
span><span class=3D"attribute-name"> value</span>=3D<span class=3D"attribut=
e-value">&quot;211018&quot; </span>&gt;<br>
                Advisor, AdvisorSelect401k<br>            &lt;/<span class=
=3D"end-tag">option</span>&gt;<br>                    &lt;<span class=3D"st=
art-tag">option</span><span class=3D"attribute-name"> value</span>=3D<span =
class=3D"attribute-value">&quot;211020&quot; </span>&gt;<br>
                Advisor, Fast401k<br>            &lt;/<span class=3D"end-ta=
g">option</span>&gt;<br>                    &lt;<span class=3D"start-tag">o=
ption</span><span class=3D"attribute-name"> value</span>=3D<span class=3D"a=
ttribute-value">&quot;226783&quot; </span>&gt;<br>
                Paychex, Jill R<br>            &lt;/<span class=3D"end-tag"=
>option</span>&gt;<br></pre><pre id=3D"line168">            &lt;/<span clas=
s=3D"end-tag">select</span>&gt;<br></pre>When I inspect element on the sele=
ct list further down, which is disabled since I didn&#39;t select anything =
in the first list, I see:<br>
&lt;select name=3D&quot;serviceLevels[0].serviceLevelTiers[0].selectedRate&=
quot; id=3D&quot;serviceLevels[0].serviceLevelTiers[0].selectedRate&quot; d=
isabled=3D&quot;&quot;&gt;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 &lt;option selected=3D&quot;selected&quot; value=3D&quot;0.00%=
&quot;&gt;<br>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 0.00%&lt;/option&gt;<br>=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &lt;option value=3D&quot;0.05%&q=
uot;&gt;<br>(etc, it has a lot of values)<br><br>I can&#39;t get this selec=
t list to enable. <br><br>I&#39;m having the same problem with our Watir sc=
ripts. I get the impression that lots of people use these techniques in the=
ir GUI code, so someone must have a way to automate tests against them.<br>
<br>Thanks,<br>Lisa<br><br clear=3D"all"><br>-- <br>Lisa Crispin<br>Co-auth=
or with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Ag=
ile Teams_ (Addison-Wesley 2009)<br>Contributor to _Beautiful Testing_ (O&#=
39;Reilly 2009)<br>
<a href=3D"http://lisacrispin.com" target=3D"_blank">http://lisacrispin.com=
</a><br>@lisacrispin on Twitter<br><a href=3D"http://entaggle.com/lisacrisp=
in" target=3D"_blank">http://entaggle.com/lisacrispin</a><br><br>

--00504502d44b0a58d804a54b4ca4--