Bug 413792 - Swing - App - wait for window to close does not succeed before the timeout has expired
Summary: Swing - App - wait for window to close does not succeed before the timeout ha...
Status: CLOSED FIXED
Alias: None
Product: Jubula (Archived)
Classification: Technology
Component: RC (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Oliver Goetz CLA
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2013-07-26 05:38 EDT by Markus Tiede CLA
Modified: 2013-10-28 10:01 EDT (History)
4 users (show)

See Also:


Attachments
patch (2.08 KB, patch)
2013-10-24 10:26 EDT, Sebastian Struckmann CLA
raimar.buehmann: iplog+
Details | Diff
Swing Application for testing closing window (4.95 KB, application/zip)
2013-10-25 08:01 EDT, Raimar Bühmann CLA
no flags Details
Test result (109.44 KB, application/octet-stream)
2013-10-28 09:48 EDT, Ajantha Yogamoorthy CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Tiede CLA 2013-07-26 05:38:00 EDT

    
Comment 1 Markus Tiede CLA 2013-07-26 05:39:31 EDT
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.
Comment 2 Alexandra Schladebeck CLA 2013-08-02 02:59:38 EDT
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.
Comment 3 Alexandra Schladebeck CLA 2013-08-02 04:16:33 EDT
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.
Comment 4 Oliver Goetz CLA 2013-10-24 05:45:39 EDT
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.
Comment 5 Sebastian Struckmann CLA 2013-10-24 08:51:36 EDT
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.
Comment 6 Sebastian Struckmann CLA 2013-10-24 10:26:40 EDT
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.
Comment 7 Raimar Bühmann CLA 2013-10-24 12:19:55 EDT
@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 8 Raimar Bühmann CLA 2013-10-25 06:59:57 EDT
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
Comment 9 Raimar Bühmann CLA 2013-10-25 07:09:51 EDT
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
Comment 10 Raimar Bühmann CLA 2013-10-25 08:01:46 EDT
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.
Comment 11 Ajantha Yogamoorthy CLA 2013-10-28 09:48:35 EDT
Created attachment 236955 [details]
Test result

Tested ub waitForWindowToClose with different timeouts.
Comment 12 Raimar Bühmann CLA 2013-10-28 10:01:37 EDT
I close this bug due to comment 11.