Forum Discussion
So this code that I have shown is on the OpenStandard procedure that is used in all the tests. Picture the desired workflow
- Open browser.
- Login.
- Do test stuff.
- Logout.
- Close browser.
Where bolded is the intent of StandardOpen()
If the test that preceeded the current one barfed for whatever reason, the browser is closed without logging out. So the next time login occurs, the page prompts do you want to resume the last session. The standard open then becomes
- Open browser.
- Login.
- If the login panel is present, you are seeing the session resumption prompt. Select to resume previous session.
- Logout ending session
- Login
Aliases.browser.pageMain.wndWindowContent.RefreshMappingInfo();
var sessionPresence = Aliases.browser.pageMain.wndWindowContent.WaitAliasChild("panLogin", ProjectSuite.Variables.TinyWaitTimeout);
if (sessionPresence.Exists)
{
sessionPresencedialog = Aliases.browser.pageMain.wndWindowContent.panLogin.WaitAliasChild("selSession", ProjectSuite.Variables.TinyWaitTimeout);
}
The WaitAliasChild here (re-added the code so it might not be precisely the same) is taking a loooooooong time to return the object with the exists stub only when the object does not exist. When it does, it returns right away. All is well.
var propNames = new Array("ObjectType", "ObjectIdentifier");
var propValues = new Array("Panel", "ng_login_container");
var sessionPresence = Aliases.browser.pageMain.wndWindowContent.FindChild(propNames, propValues, 10);
This works well. But, I happen to be in the middle of a big port to our app under test's new UI. One of the reasons it is going super well is that the NameMapping was pretty well organized. So I don't LOVE using Find. But this is not a hill I am going to die on. It really is just one function. That said, I sure would like to know what is going on for my greater understanding.
More info.
function OpenStandard()
{
var userName = Project.Variables.UserName;
var password = Project.Variables.Password;
CloseBrowserWithConfirm();
Browsers.Item(ProjectSuite.Variables.BrowserUnderTest).Run(Project.Variables.Url);
Aliases.browser.BrowserWindow(0).Maximize();
Login(userName, password);
var propNames = new Array("ObjectType", "ObjectIdentifier");
var propValues = new Array("Panel", "ng_login_container");
var sessionPresence = Aliases.browser.pageMain.wndWindowContent.FindChild(propNames, propValues, 10);
if (sessionPresence.Exists)
{
sessionPresencedialog = Aliases.browser.pageMain.wndWindowContent.panLogin.WaitAliasChild("selSession", ProjectSuite.Variables.TinyWaitTimeout);
}
if (sessionPresence.Exists)
{
Aliases.browser.pageMain.wndWindowContent.panLogin.btnContinue.Click();
aqUtils.Delay(ProjectSuite.Variables.TinyWaitTimeout);
LogoutEndSession();
Login(userName, password);
}
}