ComboBox gets mouse on document.Get<>

Mar 31, 2010 at 7:43 AM
Edited Mar 31, 2010 at 7:44 AM

It seems that each time I get a White UIItem for a ComboBox, the mouse is placed on the ComboBox. This means that just checking if the Combo box is enabled can move the mouse.

For example the code:

 

 _document.Get<ComboBox>("myComboBox");

 

Results in the mouse being moved to the ComboBox. I had properties in my page's test jig exposing this like:

 

public LobComboBox MyComboBox
{
     get
     {
             return = new LobComboBox(_document.Get<ComboBox>("myComboBox"));
     }
}

 

So each time I checked if the ComboBox was enabled the mouse moved.

I could not eliminate this but a work around to give more predictability was:

 

        public LobComboBox MyComboBox
        {
            get
            {
                if (_myComboBox == null)
                {
                    _myComboBox = new LobComboBox(_document.Get<ComboBox>("myComboBox"));
                }
                return _myComboBox;
            }
        }

Or ... perhaps I've missed something? Just getting a tester should not move the mouse.

 

FYI: I'm using White on .Net 4, Silverlight 4, VS 2010 RC.

 

Rob Smyth

Mar 31, 2010 at 9:57 AM

This beahviour seems to be needed for White.

 

it seems that internal the mouse clicks on the combobox to get the list of comboBox items.

 

so every time you use a Get<ComboBox> the comboxBox will open the dropdown list.

Apr 1, 2010 at 1:49 AM
Throndorin wrote:

This beahviour seems to be needed for White.

Yea, it is needed for selection but it means that if you try to get a state of any element the mouse moves and the current page element looses focus. This was failing our tests.

But it get a little worse ... I've just found that if the mouse is over another combo box when you try:

item = _comboBox.Items.Single(thisItem => thisItem.Text == itemText);

The item list is reads is from the other combo box not the _combo box instance at all. Your using a UIItem instance which is getting its items from another comobox because that is where the mouse is. That is a bug.

Also, my test was waiting for a label to disappear. It got the _comboBox, then watied for the label to disappear so it could then set the combo box. But when the label dissapears the _document.Get<> call results in the mouse moving to the next element on the page ...

 

Rob Smyth