How to decrease warning message such as Widget is not enabled [message #1800950] |
Thu, 10 January 2019 09:50  |
Didier Vojtisek Messages: 31 Registered: July 2009 |
Member |
|
|
Hi,
in my test suites I have actions such as *
bot.menu("File").menu("New").menu("GEMOC Melange Project for Sequential xDSML").click();
bot.text().setText(PROJECT_NAME);
bot.button("Next >").click();
which was actually generated from the recorder. (in the above code this a kind of "New project" wizard)
However, when running the test I get warning messages such as:
361587 [main] WARN org.eclipse.swtbot.swt.finder.widgets.SWTBotButton - Widget is not enabled: (of type 'Button' and with mnemonic 'Next >' and with style 'SWT.PUSH')
What does it really mean? (the test passes correctly ...)
(My guess is that the button takes some time to be enabled and swtbot report it and at some point, the button is enabled and the action is done ?)
How can I decrease the number of such warnings? (My build + test log is quite long and I wish to reduce warnings to significant ones)
[Updated on: Thu, 10 January 2019 09:51] Report message to a moderator
|
|
|
Re: How to decrease warning message such as Widget is not enabled [message #1800986 is a reply to message #1800950] |
Thu, 10 January 2019 16:46   |
Patrick Tasse Messages: 82 Registered: July 2009 |
Member |
|
|
Hi Didier,
The warnings are created by the calls to notify(). In the implementation of SWTBotButton.click():
waitForEnabled();
notify(SWT.MouseEnter);
notify(SWT.MouseMove);
notify(SWT.Activate);
notify(SWT.FocusIn);
notify(SWT.MouseDown);
notify(SWT.MouseUp);
notify(SWT.Selection);
notify(SWT.MouseHover);
notify(SWT.MouseMove);
notify(SWT.MouseExit);
notify(SWT.Deactivate);
notify(SWT.FocusOut);
As soon as the SWT.Selection event is sent, the application receives this and acts on it, which disables the button or even perhaps disposes it. Then the remaining 5 events are not sent and the warning is logged instead.
The difference is that if the widget was disposed (for example the dialog that contains an "OK" button is closed), SWTBot uses log.trace(), while if the widget is not disposed but not enabled SWTBot uses log.warn(). By default log.trace() does not appear in the logs, but log.warn() does.
Perhaps the easiest solution would be to change SWTBot to use log.trace() for that specific message. Then it won't show up by default in the logs.
But I'd like to also verify first if the real SWT sends the events or not when the button becomes not enabled due to it being clicked.
Patrick
[Updated on: Thu, 10 January 2019 18:22] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02457 seconds