This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
today's build, today's jemmy, test4u ExplorerOperator explorerOperator = new ExplorerOperator(); explorerOperator.selectPageFilesystems(); throws NPE.
Created attachment 8604 [details] NPE
It is cause by UI change in IDE. Docked internal frames don't have drag texture on title bar #27033. I will investigate it later but probably it will has to be fixed in jemmy.
Fixed in jellytools version 2.0.42. Added class NbInternalFrameDriver which extends DefaultInternalFrameDriver because NetBeans IDE defines its own title pane for JInternalFrames (org.netbeans.core.windows.frames.NbInternalFrameUI.NbTitlePane). It is not descendant of BasicInternalFrameTitlePane that's why jemmy's JInternalFrameOperator doesn't find it. We have to find that component ourselves and override method activate. This driver has to be registered as the one of first things in a test. Registration was added to JellyTestCase, NbFrameOperator and TopComponentOperator.
I think the fix is acceptable. Let's think, though. JInternalFrame does not have a functionality to get a title pane, so, from Jemmy point of view, this is, obviously, related to "custom components" area. Having that in mind we need to create an inheritor of JInternalFrameOperator and override findTitlePane() method - that's would be the most appropriate fix. If we use your approach, it is necessary to do next thing: create a DefaultInternalFrameDriver.getTitleOperator() method which would return an instance of BasicInternalFrameTitlePane. NbInternalFrameDriver.getTitleOperator() would just return NbTitlePane. But still, JInternalFrameOperator.findTitlePane() does not work, and thus, JInternalFrameOperator.getTitleOperator() does not work either. So, I think, first approach (inheriting of JInternaFrameOperator) is better. Do you agree?
I don't want to make users to change their tests. That would be true if we create org.netbeans.jellytools.JInternalFrameOperator extends org.netbeans.jemmy.operators.JInternalFrameOperator. Only chance is to copy class JInternalFrameOperator to jellytools repository under jemmy package. I asked integrator of IDE change, if it is possible to extend BasicInternalFrameTitlePane instead of JComponent. I that case we have to do nothing. I also thought about change in Jemmy. Instead of line return(comp instanceof BasicInternalFrameTitlePane); there would be return comp.getClass().getName(). endsWith("TitlePane"));
Verified
All right, I now the solution. There is the whole set of classes which hide real implementation of user action reprodusing: drivers. Why don't we extend them to hide the discussed kind of logic? Speeking technically, here we might use one more driver type: public interface InternalFrameDriver { public Component getTitlePane(Operator internalFrameOperator); } Having that, we can simply register new operator: NbInternalFrameDriver with one method. This driver type will, of course, be used by JInternalFrameOperator to get a title pane. Please, let me know if you do not see anything wrong with this.
Closing this issue. In jemmy was added InternalFrameDriver to be able to override getTitlePane() method. In IDE title pane was extended from BasicInternalFrameTitle, so we don't need any workaround in jellytools no more.