Tag Archives: CasperJS

Choosing Automated Testing Frameworks – PhantomJS / CasperJS vs Selenium

via Choosing Automated Testing Frameworks – PhantomJS / CasperJS vs Selenium.

What is the best way to test in headless browsers? JavaScript testing frameworks such as PhantomJS, Selenium and many others are fighting a colossal war. Who is the winner if the battle is already finished? And if not, who is the underdog?

“When developing our test strategy, we must minimize the impact caused by changes in the applications we are testing, and changes in the tools we use to test them.”
–Carl J. Nagle

Now what are headless browsers? Executed using command line interfaces or network communications, headless browsers provide automated control of a web page in an environment similar to popular web browsers. Now let’s cut to the chase:

Testing your frontend JavaScript code using mocha, chai, and sinon

via Testing your frontend JavaScript code using mocha, chai, and sinon | Code | Nicolas Perriault.

As rich Web application complexity grows, if you want to keep your sanity, you need to unit test your frontend JavaScript code.

For the 4 past months, I’ve been working for Mozilla on some big project where such testing strategy was involved. While I wish we could use CasperJS in this perspective, Firefox wasn’t supported at the time and we needed to ensure proper compatibility with its JavaScript engine. So we went with using Mocha, Chai and Sinon and they have proven to be a great workflow for us so far.

Video Part 1: Learning to Scrape with Python and CasperJS

In this video we install casperjs. You need to have PhantomJS installed as well. We will add these to our system path.

CSS Testing with PhantomCSS, PhantomJS, CasperJS and Grunt

via CSS Testing with PhantomCSS, PhantomJS, CasperJS and Grunt | Phase2.

A new and exciting area of Front-end Development is regression testing. I know, I know… Testing is exciting? Well in a field that has had no formal testing practices, and is constantly plagued by unexpected regressions, the opportunity to write effective tests is incredibly welcome!

Magento functional testing with CasperJS

via Functional testing for Magento.

Testing can be boring and time consuming task. So why don’t we use some tools and make our lives easier? In Magento there are numerous “boring” tasks that need to be done after the first install and then again when you test a new functionality. For example, create a test account, add product to cart, go trough checkout process, add product to wishlist, compare etc.Casper.js seems like the right tool for these “repeated” tasks. So, what is casper.js!?

CasperJS is an open source navigation scripting & testing utility written in Javascript for the PhantomJS WebKit headless browser and SlimerJS (Gecko). It eases the process of defining a full navigation scenario and provides useful high-level functions, methods & syntactic sugar for doing common tasks

We will skip the installation process as it is very straightforward. So let’s jump into testing right away.

We will create two scenarios for demo purpose

Ghosts & Ghouls / CasperJS & PhantomJS

via Ghosts & Ghouls / CasperJS & PhantomJS — The JavaScript Collection — Medium.

PhantomJS is a headless WebKit browser which is scriptable with the JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

So what is headless I hear you say? Well basically headless means it doesn’t draw on your screen (It should really be called GUIless). It can do all the same things as your favourite browsers, but faster; which makes it perfect for automating and testing applications programmatically.

Video Webcast: PhantomJS, CasperJS, Screenshot Comparison, and Ghost Inspector

Last night I had the privilege of presenting a webcast to the NYC Metro Selenium Users Meetup. I’m happy to report that over 80 people tuned in for the presentation on PhantomJS, CasperJS, screenshot comparison tools — and of course — Ghost Inspector. You can find the video and slides for the presentation below.