-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support for generating files in CoffeeScript format * Fixed the steps file to raise an error properly * Fixed the dependency loading so that you don't have to install dependencies at the application level. * The url is now set to localhost:3000 by default (same as SocketStream default app url).
- Loading branch information
1 parent
d5a9705
commit 550fb84
Showing
11 changed files
with
131 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
wrap = (funk, cb) -> | ||
funk.end (err) -> | ||
if !err? | ||
cb() | ||
else | ||
cb.fail err | ||
|
||
module.exports = -> | ||
|
||
@World = require("../support/world").World | ||
|
||
@Given /^I am on the homepage$/, (callback) -> | ||
wrap @browser.chain.session().open('/'), callback | ||
|
||
@Given /^I follow "([^"]*)"$/, (link, callback) -> | ||
wrap @browser.chain.click("link=#{link}"), callback | ||
|
||
@When /^I fill in "([^"]*)" with "([^"]*)"$/, (field, value, callback) -> | ||
wrap @browser.chain | ||
.fireEvent("//input[@name=\"#{field}\"]",'focus') | ||
.type("//input[@name=\"#{field}\"]", value) | ||
.fireEvent("//input[@name=\"#{field}\"]",'keyup') | ||
.fireEvent("//input[@name=\"#{field}\"]",'blur') | ||
, callback | ||
|
||
@When /^I press "([^"]*)"$/, (name, callback) -> | ||
wrap @browser.chain | ||
.fireEvent("//button[text()=\"#{name}\"]",'focus') | ||
.click("//button[text()=\"#{name}\"]") | ||
, callback | ||
|
||
@Then /^I should see "([^"]*)"$/, (content, callback) -> | ||
wrap @browser.chain.assertTextPresent(content), callback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
process.env["SS_ENV"] = "cucumber" | ||
selenium = require '../../node_modules/ss-cucumber/node_modules/selenium-launcher' | ||
soda = require '../../node_modules/ss-cucumber/node_modules/soda' | ||
app = require '../../app' | ||
|
||
World = (callback) -> | ||
|
||
selenium (err,selenium) -> | ||
@browser = soda.createClient | ||
host: selenium.host | ||
port: selenium.port | ||
url: "http://localhost:3000" | ||
browser: "firefox" | ||
|
||
callback {@browser} | ||
process.on 'exit', -> selenium.kill() | ||
|
||
exports.World = World |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
<!DOCTYPE html> <html> <head> <title>ss-cucumber.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> ss-cucumber.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">¶</a> </div> <p>This sets up a SocketStream application to contain | ||
the necessary folders and files for using Cucumber.</p> </td> <td class="code"> <div class="highlight"><pre>undefined</pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">¶</a> </div> <p>This runs Cucumber against the set of features inside | ||
of the features folder.</p> </td> <td class="code"> <div class="highlight"><pre>undefined</pre></div> </td> </tr> </tbody> </table> </div> </body> </html> | ||
the necessary folders and files for using Cucumber.</p> </td> <td class="code"> <div class="highlight"><pre>undefined</pre></div> </td> </tr> </tbody> </table> </div> </body> </html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"author": "Paul Jensen <[email protected]> (http://paulbjensen.co.uk)", | ||
"name": "ss-cucumber", | ||
"description": "Cucumber.js integration for SocketStream", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"homepage": "https://github.com/paulbjensen/ss-cucumber", | ||
"repository": { | ||
"type": "git", | ||
|
@@ -11,7 +11,7 @@ | |
"dependencies": { | ||
"cucumber" : "latest", | ||
"soda" : "latest", | ||
"selenium-launcher" : "git://github.com/paulbjensen/nodejs-selenium-launcher.git", | ||
"selenium-launcher" : "latest", | ||
"commander" : "latest" | ||
}, | ||
"devDependencies": { | ||
|
@@ -21,7 +21,6 @@ | |
"socketstream" : "= 0.3.0RC2", | ||
"rimraf" : "latest" | ||
}, | ||
"optionalDependencies": {}, | ||
"main": "./lib/ss-cucumber", | ||
"engines": { | ||
"node": ">=0.6.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,24 @@ | ||
fs = require "fs" | ||
world_js = fs.readFileSync "#{__dirname}/../copy/world.js", 'utf8' | ||
step_file = fs.readFileSync "#{__dirname}/../copy/socketstream_steps.js", 'utf8' | ||
fs = require "fs" | ||
|
||
module.exports = | ||
|
||
# This sets up a SocketStream application to contain | ||
# the necessary folders and files for using Cucumber. | ||
# | ||
init: (path, callback) -> | ||
init: (path, coffee, callback) -> | ||
|
||
file_extension = if coffee then "coffee" else "js" | ||
world = fs.readFileSync "#{__dirname}/../copy/world.#{file_extension}", 'utf8' | ||
step_file = fs.readFileSync "#{__dirname}/../copy/socketstream_steps.#{file_extension}", 'utf8' | ||
|
||
fs.mkdir "#{path}/features", (err) -> | ||
throw err if err? | ||
fs.mkdir "#{path}/features/support", (err) -> | ||
throw err if err? | ||
fs.mkdir "#{path}/features/step_definitions", (err) -> | ||
throw err if err? | ||
fs.writeFile "#{path}/features/support/world.js", world_js, (err) -> | ||
fs.writeFile "#{path}/features/support/world.#{file_extension}", world, (err) -> | ||
throw err if err? | ||
fs.writeFile "#{path}/features/step_definitions/socketstream_steps.js", step_file, (err) -> | ||
fs.writeFile "#{path}/features/step_definitions/socketstream_steps.#{file_extension}", step_file, (err) -> | ||
throw err if err? | ||
callback() if callback? | ||
|
||
# This runs Cucumber against the set of features inside | ||
# of the features folder. | ||
# | ||
run: (callback) -> | ||
callback() if callback? | ||
callback() if callback? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters