From 4e00ea020a3865a670120970c05f8d83def86318 Mon Sep 17 00:00:00 2001 From: Jacek Wysocki Date: Thu, 8 Aug 2013 09:09:09 +0200 Subject: [PATCH 1/2] Warning about max event listeners --- scripts/web-server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/web-server.js b/scripts/web-server.js index 3f74441e31..9497ef2796 100755 --- a/scripts/web-server.js +++ b/scripts/web-server.js @@ -36,6 +36,7 @@ function createServlet(Class) { function HttpServer(handlers) { this.handlers = handlers; this.server = http.createServer(this.handleRequest_.bind(this)); + this.server.setMaxListeners(100); } HttpServer.prototype.start = function(port) { From 5c1b5ecbc50d3225c3c861fd4875e7b47fd0a05a Mon Sep 17 00:00:00 2001 From: Jacek Wysocki Date: Thu, 8 Aug 2013 09:09:31 +0200 Subject: [PATCH 2/2] cucumberjs integration with zombie js as headless browser --- features/basic.feature | 9 +++++++++ features/step_definitions/basic.js | 22 ++++++++++++++++++++++ features/support/world.js | 10 ++++++++++ package.json | 8 ++++++++ 4 files changed, 49 insertions(+) create mode 100644 features/basic.feature create mode 100644 features/step_definitions/basic.js create mode 100644 features/support/world.js create mode 100644 package.json diff --git a/features/basic.feature b/features/basic.feature new file mode 100644 index 0000000000..42852a6011 --- /dev/null +++ b/features/basic.feature @@ -0,0 +1,9 @@ +Feature: Homepage + As a user of super angular-seed project + I want to see some information on home page + So that I can concentrate on building awesome applications + + Scenario: Reading documentation + Given I am no homepage + When I click "view2" + Then I should see "This is the partial for view 2." diff --git a/features/step_definitions/basic.js b/features/step_definitions/basic.js new file mode 100644 index 0000000000..ae8325416c --- /dev/null +++ b/features/step_definitions/basic.js @@ -0,0 +1,22 @@ +var assert = require("assert"); + +handler = function () { + + this.World = require("../support/world.js").World; // overwrite default World constructor + var b = this.browser; + + this.Given(/^I am no homepage$/, function(callback) { + this.visit('http://localhost:8000/app/index.html', callback); + }); + + this.When(/^I click "([^"]*)"$/, function(linkText, callback) { + this.browser.clickLink(linkText, callback); + }); + + this.Then(/^I should see "([^"]*)"$/, function(text, callback) { + assert.equal(this.browser.text("p:first"), text); + callback(); + }); + +}; +module.exports = handler; diff --git a/features/support/world.js b/features/support/world.js new file mode 100644 index 0000000000..c25ecf5dd3 --- /dev/null +++ b/features/support/world.js @@ -0,0 +1,10 @@ +var zombie = require('zombie'); +var World = function World(callback) { + this.browser = new zombie(); // this.browser will be available in step definitions + this.visit = function(url, callback) { + this.browser.visit(url, callback); + }; + + callback(); // tell Cucumber we're finished and to use 'this' as the world instance +}; +exports.World = World; diff --git a/package.json b/package.json new file mode 100644 index 0000000000..2a848a2325 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "devDependencies" : + { + "cucumber": "latest", + "zombie": "1.4.1", + "assert": "latest" + } +}