Quantcast

Gocept.selenium and fanstatic resources.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Gocept.selenium and fanstatic resources.

Noe Nieto
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 ?


--
---
Noe Nieto
NNieto Consulting Services
M: [hidden email]
W: http://noenieto.com
T:  @tzicatl
Li: Perfil en LinkedIn


_______________________________________________
Grok-dev mailing list
[hidden email]
https://mail.zope.org/mailman/listinfo/grok-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fwd: Gocept.selenium and fanstatic resources.

Jan-Jaap Driessen
On 15 December 2011 06:13, Noe Nieto <[hidden email]> 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
_______________________________________________
Grok-dev mailing list
[hidden email]
https://mail.zope.org/mailman/listinfo/grok-dev
Loading...