[py-dev] using oejskit to test hosted html

Samuele Pedroni pedronis at openend.se
Thu Apr 8 13:47:33 CEST 2010


simongsmith at gmail.com wrote:
>
> I changed the open call:
>
>  
>
>      pg = self.open('http://mysite.net/foo.html')
>
> When I re-run the test, the foo.html is loaded into the browser that 
> is launched as a result of the test, and it is identical (via "View 
> Frame Source") as the original, but I get the following error:
>
>  
>
> self = <oejskit.browser_ctl.PageContext object at 0x156dc90>
> js = 'document.title', variant = 'eval'
>
>     def eval(self, js, variant='eval'):
>         outcome = self._execute(variant, js, self.root, self.timeout)
>         if outcome.get('error'):
> >           raise JsFailed('[%s] %s' % (self.label, js), outcome['error'])
> E           JsFailed: [http://ctier.arcode.com:8888/foo.html] 
> document.title: FAILED:
> E           message: Result of expression 'frameWin.eval' [undefined] 
> is not a function.
> E           line: 169
> E           sourceId: 457014824
> E           sourceURL: 
> http://localhost:62737/browser_testing/rt/InBrowserTesting.js
> E           expressionBeginOffset: 4985
> E           expressionCaretOffset: 4998
> E           expressionEndOffset: 5004
> E           name: TypeError
>
> ../../../arcode/python/arcode/js-infrastructure/oejskit/browser_ctl.py:263: 
> JsFailed
>
>  
>
>  
>
Hi, there are two levels of possible issues  here:

- in some browsers it seems (as foo.html does) one needs at least an 
empty script tag to have eval() available on the window object

- more importantly while it is possible to use oejskit to do functional 
testing (we have used it here that way) because of javascript security 
the tested pages/app and testing infrastructure need to come from the 
same domain, this can be arranged with proxying but there's no example 
right now how to do this and this depends on how the pages/app 
themselves are served.

Basically the second url:
http://localhost:62737/browser_testing/rt/InBrowserTesting.js

would really need to look like:

http://ctier.arcode.com:8888/ 
<http://ctier.arcode.com:8888/foo.html>browser_testing/rt/InBrowserTesting.js 
<http://localhost:62737/browser_testing/rt/InBrowserTesting.js>

regards, Samuele Pedroni







More information about the Pytest-dev mailing list