Support for multiple browsers in a single test

Friday, November 2, 2018
Avatar

We have a project that needs to run end to end tests sequentially, but on a different browsers.

We have created separate sub-test case for each scenario that needs to open in another browser, so we call them:

Global.DoInvokeTest('%WORKDIR%/CallCenter', params);    // This runs in Chrome
Global.DoInvokeTest('%WORKDIR%/ApplicationConsole', params);    // This runs in IE

first thing that these tests call is a function (in user-defined library) that determines in which browser and environment they run in:

function selectEnvCallCenter(url) {
    Navigator.Select('Chrome');
    Navigator.Open(url);
...
function selectEnvAppConsole(url) {
    Navigator.Select('IE');
    Navigator.Open(url);
...

Invoking the sub-tests works in the main test file, but if we try to invoke these from a sub-test, it opens all (sub-)sub-test files in the same browser and doesn't change browsers...

1 Replies
Tuesday, November 6, 2018
Avatar
re: Hristovski Friday, November 2, 2018

Hi Dimitar,

There are couple of things to keep in mind when switching browsers within single test run:

1. Use Navigator.SelectBrowserProfile instead of Navigator.Select. The latter is deprecated. Browser profile is what you see in the combo in Browser Settings:

2. The root test (the one that is launched) must load browser libraries for all browser types you need for testing:

g_load_libraries=["Firefox HTML", "Chrome HTML", "Internet Explorer HTML"]

I am also attaching a sample test that opens sub-tests with Chrome and IE.

https://www.inflectra.com/Support/Attachment/89108.aspx

KB on browser selection has been updated as well:

https://www.inflectra.com/Support/KnowledgeBase/KB177.aspx

Regards,

Denis

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Friday, November 2, 2018
  • Last Reply: Tuesday, November 6, 2018
  • Replies: 1
  • Views: 5921