Community
Participate
Working Groups
The Swing - App - wait for window to close does not succeed before the timeout has expired. This is pretty annoying as the test execution get's heavily delayed due to this. This is reproducible e.g. with the DVD Tool example progress window.
I spoke to Markus yesterday and we also discussed that: - we should check whether this also occurs on dotnet and swt - we should extend the caa tests to time the closing of windows - we should check whether it also affects the actions wait for window and wait for window activation. We have a (not yet provable) feeling that it may be specific to either Win7 or Java 7 (as that was the system where it was seen), so that should be borne in mind when reproducing / fixing this.
A quick test with the SimpleAdder on our Windows Server 2008 with Java 6 did not reproduce the problem with wait for window to close. Starting the SimpleAdder with the system Java version (using the "system" configuration in the samples project) also did not reproduce the problem. I also checked on the Windows Server 2008 whether testing an RCP application reproduced the problem: it didn't. So: it looks like it may indeed be platform / java version dependent.
I was not able to reproduce this behavior when testing the caa_swing AUT which performs the Wait for Window test like this: - On main page: click button application - wait for window to close "SwingAUT" - On application page: click button close - wait for window to close "Application" I created a new TC which starts and reads timers before and after every wait for window to close action: - On main page: click button application - start timer t1 - wait for window to close "SwingAUT" (timeout = 20000ms) - read t1 - On application page: click button close - start timer t2 - wait for window to close "Application" (timeout = 20000ms) - read t2 - check numeric values (t1 < 15000, t2 < 15000) I was not able to reproduce the erroneous behavior using the caa_swing AUT but using the DVD tool. I talked to MMue about this and it seems that we have to extend our caa AUTs to include windows which "pop up" like dialogs.
The issue also occurs using Java 6 for the DVD Tool. The problem seems to be that there is only an event of the type WINDOW_FOCUS_LOST instead of WINDOW_CLOSED after the waiting dialog disappeared.
Created attachment 236845 [details] patch This patch should solve the issue in most cases. But the timeout is still maxed out if something is disturbing, so it is not completely solved.
@Sebastian: Please find out, if instead of your patch, only adding WINDOW_STATE_EVENT_MASK in class SwingApplicationTester in line 321 do the trick, e.g. - AWTEvent.WINDOW_EVENT_MASK); + AWTEvent.WINDOW_EVENT_MASK | AWTEvent.WINDOW_STATE_EVENT_MASK);
Comment on attachment 236845 [details] patch Thanks Sebastian, I have reviewed and applied your patch. Listening for the LOST_FOCUS event in combination with a not visible window is the solution for this bug. http://git.eclipse.org/c/jubula/org.eclipse.jubula.core.git/commit/?id=572feddb0a9bb5b598709404bd96bd99206e80a3
I have added checking isVisible, which was in the patch, but not in my previous commit. http://git.eclipse.org/c/jubula/org.eclipse.jubula.core.git/commit/?id=cd5d00a369ceefda93d7e7b76ad6c4b3f49fae1b
Created attachment 236887 [details] Swing Application for testing closing window A Swing application for testing the two methods dispose() and setVisible(false), which can be used to close a window. Starting the application with java -jar SwingAWTEventCloseTest.jar shows all events triggered by AWTEvent.WINDOW_EVENT_MASK.
Created attachment 236955 [details] Test result Tested ub waitForWindowToClose with different timeouts.
I close this bug due to comment 11.