Make it possible to programmatically end test running in CrossBrowserTesting (CBT)
Reference: SmartBear Support Case #00456278
Scenario: I would like to execute some test in a loop in the CBT environment (using scripting) against different platforms.
Problem: Every loop iteration starts new test in CBT leaving the previous test running.
Question: How to programmatically end running test in CBT?
Please find below sample code been used.
The problem is that every execution of the
Browsers.RemoteItem(...)
line of code starts a new test session in CBT. (This is fine and expected.)
How can I gracefully end the current test before the loop iteration?
I was thinking about something like
Browsers.CurrentBrowser.End()
but unfortunately only .Run() and .Navigate() methods are supported for remote browsers.
//---
function RunScalableWebInCBT()
{
var url = Project.Variables.pvURL;
var server = "http://hub.crossbrowsertesting.com:80/wd/hub";
var username = Project.Variables.userName;
var authkey = Project.Variables.authkey;
var remotes = [
{
browserName: 'safari',
version: '13',
platform: 'Mac OSX 10.15',
username: username,
password: authkey
},
{
browserName: 'chrome',
deviceName: 'Nexus 9',
username: username,
password: authkey
}];
for (var i = 0; i < remotes.length; i++)
{
Browsers.RemoteItem(server, JSON.stringify(remotes[i])).Run(url);
KeywordTests.Login.Run();
KeywordTests.Logout.Run();
// === I would like to end current test running in CBT at this point ===
}
}
//---
Thanks,
/Alex
=============================