geoext2 icon indicating copy to clipboard operation
geoext2 copied to clipboard

Support `--engine=slimerjs` when headless testing (Gecko)

Open marcjansen opened this issue 10 years ago • 5 comments

It'd be great if we could test gecko headlessly. SlimerJS integrates well with CasperJS, so we should see whether we can use it.

marcjansen avatar Sep 09 '14 06:09 marcjansen

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.

bentrm avatar Sep 14 '14 16:09 bentrm

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.

marcjansen avatar Sep 15 '14 05:09 marcjansen

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?

bentrm avatar Sep 15 '14 07:09 bentrm

I think that may be the issue. A simple timeout beforer actually conuing after the page opened may help. This all feels ugly, though.

marcjansen avatar Sep 15 '14 09:09 marcjansen

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.

bentrm avatar Nov 06 '14 13:11 bentrm