geoext2
geoext2 copied to clipboard
Support `--engine=slimerjs` when headless testing (Gecko)
It'd be great if we could test gecko headlessly. SlimerJS integrates well with CasperJS, so we should see whether we can use it.
As running the tests via SlimerJS is easy, there seems to be a problem with Ext.Loader.syncRequire
classes ultimately failing when calling Ext.create
. Seems it is loaded asynchronously anyway.
The following throws an error run with SlimerJS:
Ext.Loader.syncRequire([
'GeoExt.data.LayerModel',
'GeoExt.data.LayerStore',
'GeoExt.panel.Map',
'GeoExt.Action'
], function() {
console.log(GeoExt.Action);
}
);
GeoExt.Action
should be available in the callback as it is when run via PhantomJS.
Good findings. Any chance we can work around this by monkey patching syncRequire
in the testsuite? Alternatively we could include all GeoExt sourcefiles in plain <script>
tags.
I didn't come up with a quick and simple solution. It kind of feels like a problem with ExtJS or SlimerJS, too. Not sure which one though. As the tests work manually in the Firefox browser, I assume this to be a problem with the latter. In the docs they discribe the different handling of openURL() calls to PhantomJS, maybe thats a hint?
I think that may be the issue. A simple timeout beforer actually conuing after the page opened may help. This all feels ugly, though.
The problem seems to be that the headless tests are run via file:// protocol. This works with PhantomJS but not SlimerJS. I made some changes in #294.