cancel
Showing results for 
Search instead for 
Did you mean: 

WaitAliasChild taking way longer than specified timeout to return exists = false

Super Contributor

WaitAliasChild taking way longer than specified timeout to return exists = false

var sessionPresence = Aliases.browser.pageMain.wndWindowContent.WaitAliasChild("panLogin", ProjectSuite.Variables.TinyWaitTimeout); // 0 represents immediate return.

 

So I have this line of code which is intended to wait for the panel specified by the alias. I then check the Exists property to decide what to do if it is there. TinyWaitTimeout suite variable is set to 200. 

 

When the panel is present, it is found quickly and the sessionPresence is identified as existing and everything is lovely. If the panel is not present, the code delays for WAAAAAY more than TinyWaitTimeout. I tried

 

aqUtils.Delay(ProjectSuite.Variables.TinyWaitTimeout);
var sessionPresence = Aliases.browser.pageMain.wndWindowContent.WaitAliasChild("panLogin", 0); // 0 represents immediate return.

 

for giggles and still that line waits for a very long time.

 

When I set a break point there, and step over the line, the wait is executed perfectly, waits the right amoung of time to give up and return Exists true or false. 

 

This is going to slow my runtime since this line is executed with every single test in my quite large (and getting larger) suite as it has to do with handling a login gone wrong. While I always prioritize stability over run time speed, this one makes no sense. 

 

Does anyone have any idea how to make this Wait execute for the correct time out period? Honeslty, I think I am missing something obvious because I use this kind of technique All The Time.

Thanks

 

 

13 REPLIES 13
Community Hero

Re: WaitAliasChild taking way longer than specified timeout to return exists = false

The problem may not be with the specific panel but with the parent.  Can you confirm that wndWindowContent is available as well?  Because the waiting may not be for  the child object itself but for the parent.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Super Contributor

Re: WaitAliasChild taking way longer than specified timeout to return exists = false

Yes I can confirm that wndWindowContent is present.  This is a very top level element that is pretty much always present. For giggles I stopped the execution of a test at this point in code and confirm with the highlight element that it is present and very quickly identified.

Community Hero

Re: WaitAliasChild taking way longer than specified timeout to return exists = false

Hi,

 

> Aliases.browser.pageMain.wndWindowContent.WaitAliasChild("panLogin", ProjectSuite.Variables.TinyWaitTimeout);

> wndWindowContent is present.  This is a very top level element [...]

This might be the reason depending how panLogin alias is mapped.

Guessing that if it is mapped using Advanced Find, then TestComplete will drill-down complete objects tree in order to check if the sought for alias exists.

The more definite and precise identification criteria and search path are defined in NameMapping, the more fast .WaitXXX() method will work.

 

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Super Contributor

Re: WaitAliasChild taking way longer than specified timeout to return exists = false

So I am guessing by Advanced Find you mean extended search? It WAS using extended search. And it did not need to. I removed the selection of extended search on wndWindowContent. I confirm that it is still found properly. That element is used all over the place and does not take a long time to find. panLogin, when present, is found immediately. When NOT present, the timeout is not being honored. That is the crux of my issue.

Thanks

Super Contributor

Re: WaitAliasChild taking way longer than specified timeout to return exists = false

I replaced the WaitAliasChild with FindChild and properties. It is much faster. Still kinda wonder why WaitAliasChild is taking so long. I want it to timeout when I want it to! I don't love the FindChild in this case since it mimimizes the effectiveness of reuse of a well constructed NameMapping. Ah well. Such is life.

Community Hero

Re: WaitAliasChild taking way longer than specified timeout to return exists = false

Can you screenshot your NameMapping of the relevant section, making sure you expand to show the "Extended Find" column?  Also, a bit more of your workflow/automation in a screenshot would be helpful.  Obviously, there's a reason why you're waiting at that point... but I wonder if there might be something else that needs to be considered.  If this is a web page, there could be other Active components and loads and things that are happening that calling WaitAliasChild at that point is causing other things to trigger.

This could also be a caching thing. Have you tried calling "RefreshNameMapping" on the parent object before you call WaitAliasChild?


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Super Contributor

Re: WaitAliasChild taking way longer than specified timeout to return exists = false

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.

 

 

Super Contributor

Re: WaitAliasChild taking way longer than specified timeout to return exists = false

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);
	}
  
}
Community Hero

Re: WaitAliasChild taking way longer than specified timeout to return exists = false

Hi,

 

Thank you for the screenshot of your NameMapping/Aliasing.

Aliases is the means to provide you with more convenient and stable logical structure of your tested application's UI. Aliases are based on NameMapping which corresponds to the physical organization of application's UI. (Consider NameMapping as a translation table between physical and logical UI layouts.)

 

With the above in mind, my current understanding of your problem is this:

-- While aliased name of the sought for control is

Aliases.browser.pageMain.wndWindowContent.panLogin,

the physical layout (from NameMapping) is

Aliases.browser.pageMain.wndWindowContent.panel.panLogin;

 

-- It is my guess that if panLogin does not exist, its parent panel object does not exist as well;

-- If my guess is correct, then, when you ask TestComplete to wait for the panLogin aliased object, TestComplete internally first looks for the panel object. And if this object does not exist, then TestComplete waits for it using default project timeout.

 

I hope that this is the reason of the delay you are observing.

 

As a way to speed things up, you may try to add a panel object from NameMapping as another Aliased element and put it on the same level as panLogin one (in order to keep your existing code unchanged). For better usability you may rename the alias for this panel to, say, panLoginPanel.

Then, change your code line to this:

var sessionPresence = Aliases.browser.pageMain.wndWindowContent.WaitAliasChild("panLoginPanel", ProjectSuite.Variables.TinyWaitTimeout);

and keep the rest of your code as it is.

 

Does this help?

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors