Bug 340808 - In Helios, some ".click()" calls are unexpected failing.
Summary: In Helios, some ".click()" calls are unexpected failing.
Status: NEW
Alias: None
Product: SWTBot
Classification: Technology
Component: EclipseBot (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-23 16:40 EDT by Jessica Deery CLA
Modified: 2013-10-22 04:19 EDT (History)
3 users (show)

See Also:


Attachments
Example project showing problem (8.78 KB, application/x-zip-compressed)
2013-02-12 17:43 EST, John Cortell CLA
no flags Details
SWTBotRadio Fix (649.59 KB, application/octet-stream)
2013-10-22 02:10 EDT, Wael Mashal CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jessica Deery CLA 2011-03-23 16:40:55 EDT
Build Identifier: 3.6.1

I am migrating some test plugins that use swtbot to helios. However, I noticed that parts of my tests for wizard were unexpectedly failing when calling ".click()". These tests worked consistently with older versions of eclipse. 

For example, the following click caused my radio to end up in a strange state:
bot.radio("some button").click();

I have been able to workaround this issue by calling an extra setFocus:
SWTBotRadio someRadio = bot.radio("some button.");
someRadio.setFocus();    
someRadio.click();

I don't mind the workaround, but it is not clear to me why this setFocus is now needed in some cases.

Reproducible: Sometimes
Comment 1 John Cortell CLA 2013-02-12 17:42:58 EST
I independently ran into this issue. The problem is that SWTBotRadio.click() does not give focus to the radio button. I'm attaching a project that proves this; it shows the problem with 100% reproducibility. See comments in SampleView.java.

This problem can manifest itself in very strange ways. In my case, I had two radio buttons in an editor. My test selects the second button, does a save operation, and suddenly and unexpectedly, the first radio button becomes selected. The reason this happens is that an editor save operation gets the focus control, disables toolbars and such, does the save, then restores the UI state it mucked with. Because SWTBotRadio.click() doesn't set the focus, the save operation ends up restoring focus to the wrong button.

This was painful to troubleshoot. Would be great to see this addressed.
Comment 2 John Cortell CLA 2013-02-12 17:43:56 EST
Created attachment 226969 [details]
Example project showing problem

See comments in theTest() in SampleView.java
Comment 3 Mickael Istria CLA 2013-02-13 01:17:38 EST
Hi John,

Do you think you'd be able to turn the issue you describe as a testCase and contribute it via Gerrit? That would really help.
Comment 4 John Cortell CLA 2013-03-15 16:16:18 EDT
(In reply to comment #3)
> Hi John,
> 
> Do you think you'd be able to turn the issue you describe as a testCase and
> contribute it via Gerrit? That would really help.

Mickael, sorry for the delay. I get far too many bugzilla notifications and this one unfortunately got lost in the crowd. While searching through emails, I was lucky to stumble on it.

I'm sorry to be blunt, but a test case is a bit much to ask of someone who is not an active participant/user of a codebase. A reasonable expectation is for the bug reporter to provide an easily reproducible scenario, and I spent a good amount of effort producing that. I hope that proves to be enough.
Comment 5 Mickael Istria CLA 2013-03-18 02:37:17 EDT
(In reply to comment #4)
> I'm sorry to be blunt, but a test case is a bit much to ask of someone who
> is not an active participant/user of a codebase.

My job is to encourage users to turn into contributor (forum, bugs), contributors into code contributors (Gerrit patches) and code contributors into committers.
I've asked you for providing a test case because I think the contribution you made is the most difficult part (it already contains the testCase). Just turning it into a Gerrit contribution to the org.eclipse.swtbot.eclipse.finder.test would make it way easier for me to review and merge.
I'm curious to know what you call "a bit much". I'd really like to make it easier. Do you have any suggestion on how to improve documentation to make it easier to contribute testcase.

> A reasonable expectation is
> for the bug reporter to provide an easily reproducible scenario, and I spent
> a good amount of effort producing that. I hope that proves to be enough.

I'm not criticizing your contribution in any case. It's highly welcome and I thank you for that. But I don't have much time to spend on SWTBot, and when I have some time, I spend it on more critical problems than Helios support.
So the process of getting this issue fixed would get faster if you could do some more additional steps.

SWTBot is a community project with very low resources, so you can't expect to see a bug fixed just because you report it. The best way to get things done is to do most of it by yourself.
So I keep this bug in mind for later when I have more time to spend on it, and I hope it'll make it in the future versions of SWTBot, but for the moment, I only have time to encourage you to turn the test you've written into a Gerrit contrib in order to speed up the process of getting it fixed.
Comment 6 Mickael Istria CLA 2013-05-30 03:36:22 EDT
@John: did you reproduce the issue only on Helios, or on a more recent version of Eclipse as well?
Comment 7 Wael Mashal CLA 2013-10-22 02:10:07 EDT
Please find the attached jar with the Fix for this issue
Comment 8 Wael Mashal CLA 2013-10-22 02:10:56 EDT
Created attachment 236749 [details]
SWTBotRadio Fix
Comment 9 Mickael Istria CLA 2013-10-22 04:19:41 EDT
Thanks for this contribution. SWTBot contribution process requires that you use Gerrit to submit a change. Can you please provide this change as a Gerrit patch? See http://wiki.eclipse.org/SWTBot/Contributing