Hello,
In the application under test, we have a button which is not visible to TC object spy. To deal with this, we use coordinates of the parent window, which is a modal popup. This works fine and stable. But in some cases we just need to assert the button Enabled state. We have a not very comfortable way for this: click the button coords, and check that window is still opened - this will mean that button was disabled. But then we have to deal with popup restoration in case of assertion fail (e.g. if button was unexpectedly enabled).
When button is enabled, it changes its color on MouseDown event. When it's disabled, the color stays the same. So recently I tried this:
1. Save popup picture
2. Execute MouseDown() at the button coordinates (counted for Sys.Desktop)
2.1 Delay for 2 seconds
3. Save popup picture
3.1 Delay for 4 seconds
4. Execute MouseUp for (1; 1) coords, to avoid the actual click.
5. Compare 2 pics
... 01 pic1 = TCS_GetKeypad().Picture(0, 0, -1, -1, false); 02 Sys.Desktop.MouseDown(1, X, Y); 03 Delay(2000);//delay because button response is slow 04 pic2 = TCS_GetKeypad().Picture(0, 0, -1, -1, false); 05 Delay(4000);//this delay is only to prove the described problem 06 Sys.Desktop.MouseUp(1, 1, 1); 07 //picture comparison goes here
What I noticed, is that MouseDown is 'cancelled' when Picture() method is called for the popup (line 04). I'm sure this happens because button becomes visually 'unclicked' before 'Delaying script for 4000 ms' indicator text appears.
As a result, pic1 and pic2 are the same. Do you have any ideas for workaround?
Thank you,
Sergey