casperjs - how to use begin() in a subfunction? -
is right way use new begin()
feature casperjs dev-1.1-beta? have use new begin() function in thenclick function? correct how used test.done()
?
when run test returns dubious: neuen teilnehmer anlegen: 2 tests planned, 1 tests executed
.
casper.test.begin('neuen teilnehmer anlegen', 2, function(test) { test.assertexists('a[href="/rdgrc/communityservice/new"]'); casper.thenclick('a[href="/rdgrc/communityservice/new"]', function () { casper.test.begin('page found', 1, function(test) { test.asserturlmatch(/rdgrc\/communityservice\/new/, 'redirected index page after login'); test.done(); }); test.done(); }) });
i think can like:
casper.test.begin('neuen teilnehmer anlegen', 2, function suite(test) { test.assertexists('a[href="/rdgrc/communityservice/new"]'); casper.thenclick('a[href="/rdgrc/communityservice/new"]', function () { test.asserturlmatch(/rdgrc\/communityservice\/new/, 'redirected index page after login'); }); casper.run(function() { test.done(); }); });
you might want wrap tests inside capser.start(url, function() {}); if looking load page. hope helps!
Comments
Post a Comment