Suddenly unable to find WPFObject
Today I've been building a test case for a repetitive task I needed to plow through. Everything was fine, it was working perfectly. Then out of the blue, for no reason at all that I can see, one of the very first steps in the test began to fail due to WPFObject not existing.
I'm testing a WPF Desktop app, and it has a main menu called "Menu". When clicked, it drops down to reveal other items including one called "Connections". Within that, are various datafeed sources the user can select.
This is brain-dead simple, and it's a core component of many of the tests I've created. I have never, ever, had it fail in the months I've ben working in TestComplete. It works on Visual Studio source branches, and it works on compiled/obfuscated builds. Never an issue, until now.
U stick to Keyword Tests at all times unless there is absolutely no other option. I can manually record a test of me clicking Menu, then Connections, then a sub-menu item, and the result is an extremely simply Menu Action operation like this:
"MENU|Connections|[4]"
It doesn't get much simpler. But now, out of nowhere, it just fails 100% of the time. It doesn't even get to selecting Connections, which is where the failure is. It clicks Menu, then just loops infinitely looking for WPFObject (until I kill it).
I thought maybe somehow there was something in the TC update I installed this morning before I began building the test, so I uninstalled and rolled back. No change.
I thought maybe somehow something had gone wrong with the new build of our app that came out today, so I removed it and rolled back to what I began with this morning. No change.
I thought maybe it was obfuscation related (we've seen strange things crop up occasionally due to it) so I ran from source. No change.
Relaunched TC and our app several times, no change.
Rebooted my PC, no change.
I'm at my wits' end. This worked perfectly, right up until the moment it didn't, and I hadn't changed anything between it working, and not working. Anyone have any suggestions on what to do or look for here?
I almost can't believe it, but I seem to have fixed this issue. Still stumped as to why it happened in the first place, but I'll attempt to explain how I seem to have fixed it.
So the Menu Item I'm trying to select, "Connections", is an item in our object "Menu". But for reasons unknown, it was no longer being able to be recognized, for no obvious reason. Point & Fix couldn't select it either.
But I was looking through the NameMapping and noticed that everything in the menu was below a node called "Popup". I guess this is a WPF thing? One of our devs explained it to me recently but I only vaguely grasped it.
Anyway, this got me thinking... so I went to remap the object "Popup" (which was not locatable nor viewable in the Object Browser) but I wasn't sure what to select from the Spy. I decided to highlight the boundary AROUND all the menu items (which was tricky as there's only a couple of pixels that cause it to select):
As SOON as I did this, everything behaved again! The Menu TC had previously recorded now works perfectly again:
"MENU|Connections|[4]"
And my variable version that generates it dynamically, also works perfectly:
"MENU|Connections|[" + str(Project.Variables.Counter) + "]"
Amazing. So, at least now if this happens again, I'll have some idea of how to fix it. I just wish I knew what on earth happened in the first place!