Posted 28 Jul 2014
Link to this post
I want to test the following situation, we have 2 type of Silverlight application (lets say admin and client UI) which communicates with eachother using SignalR. If the user clicks on something on the admin UI it does something on the client UI without refreshing the browser. Now I want to test this schenario with the following steps in order: open client UI, check a UI element property, open admin UI, do some action on admin ui, go back to client UI (doesn't matter if admin ui closes or not), do multiple interactions and verification on client UI. The key here is that I have to see if the communication between the components are working and the client refreshes the connecting ui elements without refreshing the whole window. I cannot do this in 1 browser istance.
I read the following on another thread:
"Test Studio is designed around the concept of the "Active Browser". All test steps are automatically directed at the Active Browser. Test Studio does not have the concept of "run this step in window A" and "run this step in window B". It will only use the Active Browser.
"Active Browser" is defined as the last window that was opened. When the test starts a browser window is opened and Active Browser points to this window. If a popup opens as the result of some UI action (e.g. clicking a button) Test Studio will automatically connect to it and consider that browser to now be the Active Browser from that point forward. When the popup window closes Active Browser reverts back to the parent window. Thus if you have Parent -> Popup A -> Popup B, as the windows close Active Browser will revert back to Popup A first then Parent when Popup B closes followed by Popup A closing."
I tried this approach without any good success. Here is what I do:
1. step: coded:
client = Manager.Browsers;
client .NavigateTo("client UI url", true);
popupButton = Find.ById<HtmlButton>("popup");
Manager.WaitForNewBrowserConnect("admin UI url", true, 50000);
So I navigate to the client UI, open up a popup window by calling InvokeEvent(ScriptEventType.OnClick) and then navigate to the admin UI on the popup window. The javasript what opens the popup window is a simple window.open('admin ui url')
2. step: doing some recorded action on ActiveBrowser, which is admin UI at this point.
3. step: coded:
At this point, if I try to do some recorded steps on the client UI I get the following exception, or the Test Studio Test Runner just freeze and stops working.
InnerException: System.InvalidOperationException: This client 'Client_8d7f954c-bfe5-4774-9078-3bf30db32e8f' is not connected to remote to be able to process command.
at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
So my question is the following, can I do what I want wit the Test Studio, and if i can how? Also it is not clear for me that the Active Browser revert back if I use Manager.LaunchNewBrowser to open the second Browser instance too, or only if it is opened by UI action from the Parent window.