16 Jan 2013 12:45 PM #1
PhantomJS selenium tests?
PhantomJS selenium tests?
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.
18 Jan 2013 4:29 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
How are you creating the components?
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
18 Jan 2013 8:24 AM #3
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.
18 Jan 2013 12:44 PM #4
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.
18 Jan 2013 12:56 PM #5
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.
23 Jan 2013 2:13 PM #6
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.
24 Jan 2013 11:23 AM #7
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">
<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">