19

Are there any automated web testing libraries for Node.js, preferably headless?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Chris
  • 4,594
  • 4
  • 29
  • 39

4 Answers4

17

Zombie is a headless full-stack testing framework for Node.js.

There's a full list of testing modules on the Node.js GitHub wiki.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
benui
  • 6,440
  • 5
  • 34
  • 49
5

You should also check out PhantomJS and CasperJS. Together, it's a testing framework in pure JavaScript with a headless WebKit browser. It works in Linux, OS X and Windows.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alp
  • 29,274
  • 27
  • 120
  • 198
4

Selenium now has JavaScript bindings for Node.js. You can use a headless driver along with the Selenium bindings. (Check out ghostdriver.)

Basically all you have to do is install Node.js, set up your driver and then get your Selenium module with npm selenium-webdriver.

I have some more detailed instructions and screenshots in my tutorial, here.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
John Sonmez
  • 7,128
  • 5
  • 37
  • 56
0

Selenium WebDriver can use headless mode with a configuration for Chrome:

let { Builder} = require('selenium-webdriver')
let {Options} =require('selenium-webdriver/chrome')

let options = new Options()
let driver = new Builder().forBrowser('chrome').setChromeOptions(options.headless()).build()

By the way, you can also use CukeTest for writing your UI automation script.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
赵增阳
  • 11
  • 2