Get help with testing, discuss unit testing strategies etc.


Post by pfongkye »

Hello,
I'm trying to simulate a click on an option from a <select/> html object.
I tried:

t.chain({click: '#mySelect'}, {click:'option[value=firstVal]'});

without success.
Can you tell me how to simulate the actions to choose from dropdown of a select?
Thanks in advance.
Regards,
Pascal.

Post by mats »

This is a limitation of the current Siesta version. I've opened a ticket to investigate this and see if we can get it fixed.

https://www.assembla.com/spaces/bryntum ... rk/details#

Post by pfongkye »

ok thanks for your reply.

Post by mats »

Please try using the next available nightly build, should be fixed now!

Post by pfongkye »

mats wrote:Please try using the next available nightly build, should be fixed now!
Hello,
I tried the nightly siesta-2016-02-09-standard.
My observations:

t.chain({click: '#mySelect'}, {click:'option[value=firstVal]'});

{click: '#mySelect'} does click on the select element without opening the dropdown.

{click:'option[value=firstVal]'} does change the value of the select but does not trigger the corresponding event so my other component listening to this change does not change its state.

Regards,
Pascal.

Post by richardsonkane »

onclick event on option tag will fail on most versions of IE, Safari and Chrome: reference

If you want to trigger an event whenever user select, why not simply use:

<select onclick="check()">
<option>one</option>
<option>two</option>
<option>three</option>
And if you want to do something with the specific option user selected:

<select onclick="if (typeof(this.selectedIndex) != 'undefined') check(this.selectedIndex)">
<option>one</option>
<option>two</option>
<option>three</option>
This way you are guaranteed to call check() if and only if an option is selected.

Post by mats »

{click: '#mySelect'} does click on the select element without opening the dropdown.
Correct, no way we can expand it.
{click:'option[value=firstVal]'} does change the value of the select but does not trigger the corresponding event so my other component listening to this change does not change its state.
It should fire 'change', we have a test covering this. Can you post the code you use?

Post by dr1990 »

I want to know is there anyway to cilck on element using xPath in siesta test script.

Post by pfongkye »

mats wrote:
{click: '#mySelect'} does click on the select element without opening the dropdown.
Correct, no way we can expand it.
{click:'option[value=firstVal]'} does change the value of the select but does not trigger the corresponding event so my other component listening to this change does not change its state.
It should fire 'change', we have a test covering this. Can you post the code you use?
Got it working now. Thanks

Post Reply