This project is read-only.

Ajax call problem

Jun 26, 2013 at 7:58 PM
Hi,

We recently upgraded the version of the jquery libraries that we are using in our web development project from a 1.X.X version to 2.0.2.

Our web application implements an AJAX call to populate data in a grid based on a selection of an item in a drop down. The dropdown is opened, an item in a list is selected and then the drop down closes. On close, a .getJSON call is made which brings back information to populate the grid.

When we run automation tests, using CUITe to operate on the dropdown control and populate the grid, the AJAX call goes out but never returns. Our application sits in a loading status but the grid never loads.

If we run the same process manually the grid is populated.

There seems to be an interaction problem between the test and jquery 2.0.2 where the AJAX call and process start but never return anything.

Has anyone seen and interaction like this before? Any ideas on how to fix it?

We are running test in IE9. Let me know if you need any other information.

Thanks

Jeff
Jun 26, 2013 at 8:43 PM
Hi Jeff,

Can you post a sample solution that can reproduce the problem please?

This includes client side html + javascript (jquery), server side web service, and the coded ui test project.

Minimizing the code to only include the relevant pieces would be ideal for easier troubleshooting.

Thank you.
Jun 27, 2013 at 6:15 AM
Edited Jun 27, 2013 at 6:15 AM
It doesn't seem that this issue is CUITe specific as you've also posted the question to the msdn forums here.

Is that correct?

If you playback a recorded test using the built-in Visual Studio Coded UI test recorder, and it exhibits the same behavior, then it is not CUITe specific.

Thank you.
Jun 27, 2013 at 4:58 PM
I did post the question on the msdn forum but mostly because we have no idea as to the cause and we are using CUITe to work with the HTML controls on the page. We ended up rolling back the version of the jquery library from 2.0.2 to 1.9 and this fixed the problem. We also tried 1.10.1 but this also caused a problem. We are going to stick with version 1.9 since there was nothing specific in the 2.0.2 version that we needed and the only reason for implementing was that it was the latest. I'm posting the code including the javascript so that someone might benefit if they see the same problem.

CUITe Code
            CUITe_HtmlHyperlink myLink2 = Get<CUITe_HtmlHyperlink>("id=selSearchType_chzn_link");
            myLink2.Click();
            //myLink2.Click();
            CUITe_HtmlDiv myDiv = Get<CUITe_HtmlDiv>("id=selSearchType_chzn");
            CUITe_HtmlListItem myItem = myDiv.Get<CUITe_HtmlListItem>("InnerText=" + service);
            myItem.Click();
            myLink2.Click();
HTML from the page
<div id="statusDiv" class="ServiceSummarySearchOptions" style="">
<select id="selStatusType" class="quoteSearchDropdown chzn chzn-done" style="position: relative; float: left; width: 275px; display: none;" searchmode="nosearch" multiple="multiple">
<option value="0">Active</option>
<option value="1">Disconnected</option>
<option value="2">Hotlined</option>
<option value="3">Redirected</option>
<option value="4">Suspended</option>
</select>
<div id="selStatusType_chzn" class="chzn-container undefined chzn-container-single" style="width: 275px;">
<a id="selStatusType_chzn_link" class="chzn-single chzn-default" href="javascript:void(0)">
<span id="selStatusType_chzn_result">None Selected</span>
<div>
</a>
<div class="chzn-drop" style="left: -9000px; width: 350px; top: 28px;">
</div>
</div>

Java Script: It is the getJSON call that is failing:
$("#selSearchType").append(new Option("Loading...", "Loading..."));
$("#selSearchType").trigger("liszt:updated");
$.getJSON(targetURL, null, function (features) {
if (features.indexOf("Error") == 0) {
displayError(features);
return;
}

I don't have easy access to the web service code or the jquery that gets run with the call.  I think that the getJSON could be found in the 2.0.2 version of jquery which can be pulled off of the web.

Thanks

Jeff