Book Image

WEB APP TESTING USING KNOCKOUT.JS

By : Roberto Messora
Book Image

WEB APP TESTING USING KNOCKOUT.JS

By: Roberto Messora

Overview of this book

Table of Contents (11 chapters)

User interface testing with PhantomJS


Introducing Karma, we talked about PhantomJS and its usage as a virtual browser during unit testing execution. More precisely, PhantomJS (http://phantomjs.org/) is a headless WebKit scriptable browser, which means that:

  • It's based on the well-known WebKit web engine

  • It downloads a web page from a URL, renders the content into the DOM, executes JavaScript if present, and the executed result will be reflected on the browser's DOM

  • It doesn't render the page into a visualized content

  • The term scriptable means that we can instrument a PhantomJS instance to do actions using a JavaScript API

PhantomJS is not related in any way to NodeJS and its plugin ecosystem: it's a simple cross-platform executable (can be installed on Windows, Mac, and Linux) that runs independently from other runtime engines.

Most common PhantomJS uses are (from PhantomJS website):

  • Headless web testing: Run functional tests with frameworks such as Jasmine

  • Screen capture: Programmatically capture...