PDA

View Full Version : PhantomJS selenium tests?



stefankendall
16 Jan 2013, 12:45 PM
Has anyone gotten phantomjs selenium tests working with Sencha Touch?

I can run my cucumber tests with chrome, but if I switch to PhantomJS, it looks like nothing ever loads. The ext components aren't written to the dom, so I don't know what's going on.

I'd love to switch my test run over to phantom, so it would be great if anyone has gotten this working.

mitchellsimoens
18 Jan 2013, 4:29 AM
How are you creating the components?

cyee
18 Jan 2013, 8:24 AM
We used phantom and selenium in Sencha 1, but we haven't had time to rewrite them for ST2. I imagine it should work though.

stefankendall
18 Jan 2013, 12:44 PM
I have an Ext.Application which uses Ext.create to instantiate a number of components, which either add components in their constructor() or in their initialize listener callbacks.

Everything works great in Safari, Mobile Safari, Chrome, and Dolphin, but the app never loads with phantom.

I'll create a minimal failing github project and post it here.

stefankendall
18 Jan 2013, 12:56 PM
A simple app with just a button looks like it works. I'm not sure why my app never loads. I rely on localstorage proxies to load data, so perhaps that is related.

brettAV
23 Jan 2013, 2:13 PM
I'm having the same problem. PhantomJS/CasperJS works when the app is built with "sencha app build production" but it doesn't work in "development" mode. For some reason in development mode it never gets past the loading indicator.

I'm not sure what's the difference between the two but it's a real PITA.

brettAV
24 Jan 2013, 11:23 AM
I got around it by looking at the development.js microloader and more or less manually doing what it does. The key was to add the sencha-touch-all-debug.js script to my index.html. Now I keep an index-debug.html for testing and an index.html for building.

This is what I added to index-debug.html:
<link rel="stylesheet" type="text/css" href="resources/css/app.css">
<script type="text/javascript" src="touch/sencha-touch-all-debug.js"></script>
<script type="text/javascript" src="app.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">