angularjs - CasperJS Waiting for live DOM to populate -
i'm evaluating using casper.js functional/acceptance testing app. biggest problem i've seen far app spa uses handlebars templates (which compiled js) pages of app nil more shell empty div markup injected via js.
i've messed around casper little , tried using waitfor functions. can seem main empty page before of markup injected. i've tried waitforselector times out after 5 seconds. should seek increasing timeout? page typically loads in browser quickly, seems there may issue.
i'm using yadda along casper step definitions:
module.exports.init = function() { var dictionary = new dictionary() .define('locale', /(fr|es|ie)/) .define('num', /(\d+)/); var tiles; function gettiles() { homecoming document.queryselectorall('.m-product-tile'); } function getfirsttile(collection) { homecoming array.prototype.slice.call(collection)[0]; } var library = english.library(dictionary) .given('product tiles', function() { casper.open('http://www.example.com/#/search?keywords=ipods&resultindex=1&resultsperpage=24'); casper.then(function() { // casper.capture('test.png'); casper.echo(casper.gethtml()); casper.waitforselector('.m-product-tile', function() { tiles = gettiles(); }); }); }) .when('i tap tile', function() { casper.then(function() { casper.echo(tiles); //nodelist var tile = array.prototype.slice.call(tiles)[0]; casper.echo(tile); //undefined! var pid = tile.getattribute('data-pid'); }) }) .then('i taken product page', function() { }); homecoming library; }; any angular, backbone, ember folks running issues this?
angularjs backbone.js casperjs
No comments:
Post a Comment