Skip to content

How To Install Viff Command Line

Wang Qiu edited this page Jan 19, 2014 · 7 revisions

Please use npm install to install the latest version of viff.

npm install viff -g

Because viff is based on node-canvas, you need to install cairo library before installing viff command.

Installation OSX

Install pkgconfig.

$ curl http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz -o pkgconfig.tgz
$ tar -zxf pkgconfig.tgz && cd pkg-config-0.23
$ ./configure && make install

Install pixman.

$ curl http://www.cairographics.org/releases/pixman-0.22.0.tar.gz -o pixman.tar.gz
$ tar -zxf pixman.tar.gz && cd pixman-0.22.0/
$ ./configure --prefix=/usr/local --disable-dependency-tracking
$ make install

Install cairo.

$ curl http://cairographics.org/releases/cairo-1.12.8.tar.xz -o cairo.tar.xz
$ tar -xJf cairo.tar.xz && cd cairo-1.12.8
$ ./configure --prefix=/usr/local --disable-dependency-tracking
$ make install

Note; if libpng fails try installing this binary

if you got error "error: mandatory image surface backend feature could not be enabled", or "Package cairo was not found in the pkg-config search path.", following command can resolve it.

$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

If you see "Package 'xcb-shm', required by 'cairo', not found", you probably installed Cairo with homebrew and need to do this:

$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/X11/lib/pkgconfig

Installation Ubuntu

Install dependencies

$ sudo apt-get update 
$ sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++

Important: libjpeg8-dev is required rather than just libjpeg-dev

Install CentOS

Install dependencies

$ yum -y install automake autoconf libtool ncurses-devel libxslt groff pcre-devel pkgconfig libpng-devel

Install pixman.

$ curl http://www.cairographics.org/releases/pixman-0.22.0.tar.gz -o pixman.tar.gz  
$ tar -zxf pixman.tar.gz && cd pixman-0.22.0/  
$ ./configure --prefix=/usr/local   
$ make install 

Install libjpeg8-dev.

$ wget http://www.ijg.org/files/jpegsrc.v8c.tar.gz
$ ./configure --prefix=/usr/local   
$ make 
$ make install  

Install cairo.

$ wget http://cairographics.org/releases/cairo-1.10.2.tar.gz
$ ./configure --prefix=/usr/local   
$ make 
$ make install 

Once you get cairo, viff could be well installed. more issue, please submit issue in Github Issue Page.

Try viff in command line. You could see

Version: 0.7.0

Usage: viff [options] [config file path]

Options:

  -browsers <borwser1/*, browser2 ...*/>     config the browsers using browser name, by default firefox 
  -envs <env1=url1, env2=url2>               config two environments, env1 and env2 could be updated
  -grep <grep>                               config description or path matched testcases
  -paths <path1/*, path2 ...*/>              config the paths to compare
  --report-format <format>                   config the output format in file/json/html, by default file
  --selenium-host <host>                     config selenium host, such as "http://localhost:4444/wd/hub"

Config File Path:
  
  /path/to/config_file.config.js             a config file with a tail of '.config.js'

Demo:

  viff --selenium-host http://localhost:4444/wd/hub 
       -browsers "firefox,chrome" 
       -envs build=http://localhost:4000,prod=http://ishouldbeageek.me 
       -paths "/404.html,/page2" 
       -grep "path1"
       --report-format file
       /Users/xx/test.config.js

Read More: https://github.com/winsonwq/viff

Clone this wiki locally