[Grok-dev] Fwd: Gocept.selenium and fanstatic resources.
Jan-Jaap Driessen
jdriessen at thehealthagency.com
Fri Dec 16 13:25:01 UTC 2011
On 15 December 2011 06:13, Noe Nieto <nnieto at noenieto.com> wrote:
> So, I have a very basic grok app (grok v 1.4.1)
> here: http://dev.noenieto.com/grok_selenium/ And I want to test that very
> basic application with selenium by using gocept.selenium package.
>
> But I'm having trouble with fanstatic resources not being processed. When I
> run my grok app and load it with the browser, the resources are injected
> (e.g. by using style.need()) and also correctly traversed or generated when
> using inline resources (For example: <link rel="stylesheet" type="text/css"
> tal:attributes="href static/dummy.css"/>).
>
> But when I run a very basic test with selenium, I have found that the
> fanstatic resources are neither injected nor resolved and I get no CSS on my
> page.
>
> How do I enable fanstatic with gocept.selenium.grok.Layer ?
You need to setup the fanstatic wsgi component in the test layer like this:
'''
import gocept.selenium.grok
import fanstatic
class SeleniumLayer(gocept.selenium.grok.Layer):
def setup_wsgi_stack(self, app):
return fanstatic.Fanstatic(app)
'''
For a speed-up, you may want to run Fanstatic in production mode and
include the paste.gzip wsgi component:
'''
import paste.gzipper
class SeleniumLayer(gocept.selenium.grok.Layer):
def setup_wsgi_stack(self, app):
return paste.gzipper.middleware(
fanstatic.Fanstatic(
app,
bundle=True,
versioning=True,
recompute_hashes=False,
minified=True))
'''
HTH,
--
Jan-Jaap Driessen
More information about the Grok-dev
mailing list