Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coded UI Controls need to refresh

I am using a coded UI testing harness that looks at a jQuery grid that we have written. The problem that I am encountering is that when the grid pages, the coded ui keeps track of the old controls when I try to call the paging again. I guess an example would explain it better:

BaseMap.MSMaintenanceMap.PageNext(); BaseMap.MSMaintenanceMap.PageNext();

this is the code that I am trying to get to work. The problem is here in the generated designer file:

if ((this.mUITitlePagingRowRow == null)) { this.mUITitlePagingRowRow = new UITitlePagingRowRow(this); }

When I change it to this:

this.mUITitlePagingRowRow = new UITitlePagingRowRow(this);

it works every time. Problem is when the uitest gets re-generated, this reverts back for obvious reasons. Is there any additional parameters that anyone knows that I can put in the .uitest file to always get the latest version of a control?

like image 810
light Avatar asked Aug 27 '26 01:08

light


2 Answers

Add AlwaysSearch to the SearchConfigurations of the control, this forces the test not to cache the control but always look for it using the defined properties. Hope this helps.

like image 79
Attila Szasz Avatar answered Aug 28 '26 17:08

Attila Szasz


You can refresh the map from your test method. So when you are calling the method in the partial class for a second time just put something like BaseMap BaseMap = new BaseMap(); Then this will refresh the map and you can call BaseMap.MSMaintenanceMap.PageNext(); without the refresh problem.

Another way around this is to not rely on BaseMap.Designer.cs. You can manually write the method in the BaseMap.cs partial class. This does not get generated. Record the PageNext() object into the map. Then write a method like this:

public void PageNext()
{
    BaseMap = new BaseMap();

    Mouse.Click('TheObjectYouRecorded');
}

Hope this helps.

like image 29
chrisg Avatar answered Aug 28 '26 17:08

chrisg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!