Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Radio select doesn't seem to register any more
Radio select doesn't seem to register any more [message #730203] Tue, 27 September 2011 21:32 Go to next message
Jeff Johnston is currently offline Jeff Johnston
Messages: 173
Registered: July 2009
Senior Member
I have an SWTBot test that used to work fine. In the setup for the test it goes to the Windows->Preferences view and sets up "always open" a perspective. This is so the tests can just create a new C/C++ project and not have to respond to the "do you wish to open the C/C++ perspective dialog".

The following code:


		// Turn off automatic building by default
		bot.menu("Window").menu("Preferences").click();
		SWTBotShell shell = bot.shell("Preferences");
		shell.activate();
		bot.tree().expandNode("General").select("Workspace");
		SWTBotCheckBox buildAuto = bot.checkBox("Build automatically");
		if (buildAuto != null && buildAuto.isChecked())
			buildAuto.click();
		bot.button("Apply").click();
		// Ensure that the C/C++ perspective is chosen automatically
		// and doesn't require user intervention
		bot.tree().expandNode("General").select("Perspectives");
		SWTBotRadio radio = bot.radio("Always open");
		if (radio != null && !radio.isSelected()) {
			radio.click();
		}
		bot.sleep(3000);
		bot.button("OK").click();
		bot.sleep(3000);
		bot.menu("Window").menu("Preferences").click();
		shell = bot.shell("Preferences");
		shell.activate();
		bot.tree().expandNode("General").select("Perspectives");
		bot.sleep(6000);
		bot.button("OK").click();


is totally frustrating me. I added sleeps so I could watch and the radio button for "Always open" gets set as expected, but when the Preferences dialog is brought up again, it is not set. This of course breaks my tests later on when they aren't expecting the perspectives prompt to come up. Instead, the default "prompt" radio button remains set. Manually, everything works fine. If I set it myself and come back, it is still set.

Any ideas on why the radio click does not appear to be registered/saved by the Preferences dialog on closing? I am using SWTBot 2.0.4 with Eclipse 3.7 on a Linux x86_64 box.
Re: Radio select doesn't seem to register any more [message #759417 is a reply to message #730203] Mon, 28 November 2011 15:46 Go to previous message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
On 9/27/11 2:32 PM, Jeff Johnston wrote:
> is totally frustrating me. I added sleeps so I could watch and the
> radio button for "Always open" gets set as expected, but when the
> Preferences dialog is brought up again, it is not set. This of course
> breaks my tests later on when they aren't expecting the perspectives
> prompt to come up. Instead, the default "prompt" radio button remains
> set. Manually, everything works fine. If I set it myself and come
> back, it is still set.

It is quite possible that the radio button is hooking a listener
different from the ones that SWTBot is sending (http://goo.gl/8nbEh)

Can you turn on trace logging in SWTBot to get some detailed swtbot
output and investigate if there's any other listener that is hooked into
that radio box?

-- Ketan
Previous Topic:clicking context menu steals selection
Next Topic:Need consolidated test output (logger message+screenshots+exceptions)
Goto Forum:
  


Current Time: Thu Oct 23 13:20:16 GMT 2014

Powered by FUDForum. Page generated in 0.02295 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software