Steve Coleman Steve Coleman - 2 months ago 18
ASP.NET (C#) Question

Visual Studio Performance Coded UI - Popup Window broken, Because Web Test Recorder is causing it to open in a full window

I have ASP.net webform that opens a popup window.

example window.open("");
The POPUP window closes itself when a hyperlink is clicked inside. [Like search for person by name, select person and pass the person back to the parent form.] Then posts back from the javascript. When it is a full window[not a popup], It does not postback or close the window. When not recording for a test, it opens the modal popup and closes\posts back fine.

The real problem is you cannot finish a test if you cannot close the popup and transfer the selected values back to the parent form.

How do I stop the test recorder from opening the window in full screen. Or how can I make the popup perform normally[close and postback the data] when windowed.

Here is a little info. In the popup I force a postback after closing the window here.

function CancelPopupWindow() {
self.close();
//Here to force a post back on the parent. This is used to automatically save the data
window.opener.__doPostBack('', '');
}





Anyone else hating this problem. Please vote for a fix at User Voice.
https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/16390135-make-web-performance-popup-javascript-dialogs-open

Answer

There is a workaround. The program Fiddler can be used to record the entire test then use Fiddler's menu => File => Export sessions => All sessions => Visual Studio web test and then follow the remaining prompts. That will produce a .webtest file. Like any other .webtest file it will probably need work to resolve dynamic data etc.

A variations is to record as much as you can with Visual Studio. From the start of the test up until the problem occurs. If possible you could also record the completion of the test. So just the piece with the problem is omitted. You can also record the problem part with Fiddler and save that. Now you have two or possible three .webtest files that cover the whole test. Now just merge them. With the Visual Studio web test editor you can copy requests and paste them into other tests. (Or else where in the same test. You can also drag requests in a .webtest to reorder them.

The purpose of recording the steps that use JavaScript is to learn enough of what they do so as to replicate enough of their action for the web test. So mixing pieces from different recordings is valid.

The .webtest file contains XML and so can be edited with a text editor. I often make changes in this way, for example to replace many occurrences of the same string with a context parameter. Editing at this text level can help when merging pieces from multiple files. Just be careful to make backups. Visual Studio just gives refuses to load .webtest files with mal-formed XML.