Today I took care of basic support for windows.
They are not very interesting when it comes to interacting with. The only way to do something with them beside moving them around is to close them using icon in the right upper corner.
This is not as trivial as it might seem because using window.close() method is not a thing we really want. This would bypass few mechanisms, so we resort to programmatically clicking close button which is of xtype tool.
Another thing to take into account is whether our window has closeAction set to destroy or hide. Destroy stands for removing component and all its descendants from DOM, whereas hide just makes it invisible. Difference in results is quite easy to tell – we are not able to find a window component after destroying it, but we can if we have only hidden it.
someWindow = pathfinderObj.find('window[title="Example window"]');
casper.test.assert(someWindow.length === 1, 'Exactly one window should be found');
var closeAction = pathfinderObj.getProperty(someWindow, 'closeAction');
casper.test.assert(closeAction === 'destroy');
var windows = pathfinderObj.find('window[title="Example window"]');
casper.test.assert(windows.length === 0, 'No windows should be present');