This is a migrated thread and some comments may be shown as answers.

Steps in multiple browser instance

2 Answers 87 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Balazs
Top achievements
Rank 1
Balazs asked on 28 Jul 2014, 09:25 AM
Hello,

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[0];
client .NavigateTo("client UI url", true);
popupButton = Find.ById<HtmlButton>("popup");
Manager.SetNewBrowserTracking(true);
popupButton.InvokeEvent(ScriptEventType.OnClick);
Manager.WaitForNewBrowserConnect("admin UI url", true, 50000);
Manager.SetNewBrowserTracking(false);

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:
ActiveBrowser.Window.Close();

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.
ExecuteCommand failed!
BrowserCommand (Type:'Information',Info:'DocumentMarkup',Action:'NotSet',Target:'null',Data:'',ClientId:'Client_8d7f954c-bfe5-4774-9078-3bf30db32e8f',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'False',Response:'')
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.

Thank you,
Balazs


















2 Answers, 1 is accepted

Sort by
0
Balazs
Top achievements
Rank 1
answered on 28 Jul 2014, 01:12 PM
Luckily I got it working now. What I changed is I used ActiveBrowser.Close() instead of ActiveBrowser.Window.Close() in step 3. This was the ActiveBrowser reverts back to the parent Browser instance.

Thank you,
Balazs
0
Boyan Boev
Telerik team
answered on 30 Jul 2014, 11:28 AM
Hello Balazs,

Glad to hear that.

If you need further assistance, please let us know.

Regards,
Boyan Boev
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Balazs
Top achievements
Rank 1
Answers by
Balazs
Top achievements
Rank 1
Boyan Boev
Telerik team
Share this question
or