Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 19 commits
  • 21 files changed
  • 0 commit comments
  • 1 contributor
View
8 .gitignore
@@ -1,7 +1,13 @@
+# OS stuff
.DS_Store
+
+# logs
+log/*
chromedriver.log
npm-debug.log
-log/*
+
+# generated stuff
+node_modules
build
test/coverage.html
doc/api
View
3 .gitmodules
@@ -0,0 +1,3 @@
+[submodule "doc"]
+ path = doc
+ url = git@github.com:MattiSG/Watai.wiki.git
View
61 README.md
@@ -1,30 +1,59 @@
Watai
=====
-Watai is a **declarative, bottom-up BDD, full-stack web testing** framework.
+Watai (temporary name) is a **declarative, bottom-up BDD, full-stack web testing** framework.
-It is both a test runner engine (i.e. it executes tests) and a set of patterns to make you write **maintainable**, **solid** tests. It is aimed at websites and web applications.
+It is both a test runner engine (i.e. it executes tests) and a set of architectural patterns to make you write **maintainable**, **solid** end-to-end (GUI) tests for browsers.
-Declarative
------------
+➥ Read more about [what is Watai](https://github.com/MattiSG/Watai/wiki/Definition).
-Most tests are written in an _imperative_ fashion: execute some _commands_, then _assert_ some values.
+Benefits
+--------
-Watai shifts the testing procedure to be much more _declarative_, that is describing _states_ and associated _transitions_ from one state to the other.
+1. Creating a safety net to catch regressions.
+2. Defining expected behavior and automatically checking its cross-browser consistency.
-Bottom-up BDD
--------------
+➥ Read more about [when and how you should use Watai](https://github.com/MattiSG/Watai/wiki/Rationale).
-Watai offers a [Behavior-Driven Development](http://en.wikipedia.org/wiki/Behavior_Driven_Development) frontend, in order to make your test suite a good [boundary object](https://en.wikipedia.org/wiki/Boundary_object) across all your project’s stakeholders, and to make the purpose of testing clearer to everyone, including developers.
+Installing
+----------
-However, instead of presenting the usual scenario instrumentation pattern (describe expected feature, write scenario, instrument scenario, write actual testing code), Watai leverages its declarative concepts and generates [business-readable scenarios](http://martinfowler.com/bliki/BusinessReadableDSL.html) from the tests description information.
-Hence the “_bottom-up_” phrasing: instead of starting at the human-readable top-level, you finish your testing experience with it.
+### Dependencies ###
-Full-stack
-----------
+#### Node & NPM ####
+
+Watai runs as a [Node.js](http://nodejs.org) module, and has dependencies on other modules.
+
+You will therefore need the Node runtime, and NPM to manage dependencies, which [comes with Node](http://npmjs.org/doc/README.html#Super-Easy-Install).
+
+_Watai has been tested only with Node 0.6, not yet with 0.8. If you already have Node, you should stick with 0.6 for the moment._
+
+**Download the Node package for your environment:**
+
+- [Precompiled for OS X](http://nodejs.org/dist/v0.6.18/node-v0.6.18.pkg).
+- [Precompiled for Windows](http://nodejs.org/dist/v0.6.18/node-v0.6.18.msi).
+- Or use a [package manager](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager) to get Node v0.6.
+
+#### Selenium Server ####
+
+Watai uses Selenium-WebDriver to automate browsers. You will therefore need a Selenium _standalone server_ to send commands to the browsers.
+
+If you’re under OSX and have [Homebrew](http://mxcl.github.com/homebrew/), simply `brew install selenium-server-standalone` and start it with the command given at the end of the “Caveats” section.
+
+Otherwise, [download the JAR](https://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.24.1.jar) (_server-standalone_, ok?) and start it in the background:
+
+ java -jar path/to/downloaded/selenium-server-standalone.jar &
+
+### Package ###
+
+Once you have both Node 0.6 and a Selenium standalone server, you can consider installing Watai itself. If you’re under Windows, you will have to log out from your session to have your PATH updated (or replace `npm` beneath with the full `Program Files\…\nodejs\npm` path).
+
+As long as we’re in early alpha, the package won’t be published on the NPM public registry. You will therefore have to install Watai with the following command:
+
+ npm install -g https://github.com/MattiSG/Watai/tarball/master
-In web development, testing is often limited to unit level on server-side code, sometimes on client-side code, and rarely on full-stack (or _end-to-end_) functional testing, i.e. in the actual production environment: the browser.
-There are many reasons for this, too many for this README.
+Since we’re installing globally (`-g`), you may have to `sudo` that command. If you’d rather not do this to simply have a quick look at that piece of software, then remove the `-g`, but you won’t benefit from the `watai` shortcut.
-What is important is that Watai uses Selenium to execute your tests in all browsers, so you can be confident in their results. You don't have to know a thing about Selenium though, as the whole point of Watai is abstracting away those implementation details.
+Hence, if you install locally (without `-g`), replace all instances of the `watai` command by `<path/to/install/folder>/node_modules/go` for all instructions.
+### Then, [get started with Watai](https://github.com/MattiSG/Watai/wiki)! ###
1 doc
@@ -0,0 +1 @@
+Subproject commit cf9f1f5ada368709f6ba7f65f6bd86ded0d29251
View
34 doc/Troubleshooting.md
@@ -1,34 +0,0 @@
-I get `getaddrinfo ENOENT` exceptions whenever I try to execute a test
-======================================================================
-
-Symptom
--------
-
-When running the program or executing its tests, you get the following error:
-
- Error: Unable to send request: getaddrinfo ENOENT
-
-Reason
-------
-
-This means the Selenium server could not be reached. That server is responsible for forwarding automation instructions to managed browsers. If it is not available, WebDriverJS will exit brutally with the above error.
-
-As the stack trace tells you, there is no easy way to catch this exception as the responsible code is called back from a timeout.
-
-Steps
------
-
-### Is the Selenium server running? ###
-
-You can check whether the server is available by accessing `127.0.0.1:4444/wd/hub` in a browser. If no page is displayed, then the server is not started (or you configured it differently, see step 2).
-
-If you did not start the Selenium _standalone server_, [download it](https://code.google.com/p/selenium/downloads/list) (_server-standalone_, ok?) and start it in the background:
-
- java -jar path/to/downloaded/selenium-standalone.jar &
-
-
-### Is the Selenium server properly accessed? ###
-
-If you're sure the server JAR has been started up, but it can't be reached, then it could be that its URL is improperly set up.
-
-The default connection URL is the default one provided by the server, i.e. `127.0.0.1:4444/wd/hub`. If you configured Selenium otherwise, or have an IPv6-only network, or whatever else, you have to override this value in the `config.js` file, at the `connectURL` key.
View
2 example/DuckDuckGo/ZeroClickFeature.js
@@ -1,5 +1,5 @@
{
- description: 'Looking up an ambiguous term should make the Zero-Click toolbox appear.',
+ description: 'Looking up an ambiguous term should make a Zero Click Info box appear.',
scenario: [
SearchBarWidget.searchFor, lookupTerm,
View
4 go
@@ -12,8 +12,8 @@ case "$1" in
coverage ) # based on http://tjholowaychuk.com/post/18175682663
rm -rf $BUILD_DIR
jscoverage $SRC_DIR $BUILD_DIR # install from https://github.com/visionmedia/node-jscoverage
- export COVERAGE=true
- mocha $TEST_DIR --reporter html-cov > $TEST_DIR/coverage.html
+ export npm_config_coverage=true
+ mocha $TEST_DIR --reporter html-cov > $TEST_DIR/coverage.html &&
open $TEST_DIR/coverage.html ;;
doc )
java -Djsdoc.dir=$JSDOC_DIR -jar $JSDOC_DIR/jsrun.jar $JSDOC_DIR/app/run.js -t=$JSDOC_DIR/templates/jsdoc -d=$DOC_DIR/api $SRC_DIR/*
View
1 node_modules/.bin/_mocha
View
1 node_modules/.bin/mocha
View
1 node_modules/growl
View
1 node_modules/mocha
View
1 node_modules/mootools
View
1 node_modules/q
View
1 node_modules/should
View
1 node_modules/winston
View
49 package.json
@@ -0,0 +1,49 @@
+{
+ "name": "watai",
+ "version": "0.1.0",
+
+ "description": "A declarative, bottom-up BDD, full-stack web testing framework. Maintainable integration tests for all browsers.",
+ "keywords": "test, testing, validation, behavior, behaviour, BDD, TDD, integration, browser, cross-browser",
+
+ "homepage": "https://github.com/MattiSG/Watai/",
+ "bugs": "https://github.com/MattiSG/Watai/issues",
+ "author": "Matti Schneider <hi@mattischneider.fr> (http://mattischneider.fr)",
+
+ "files": [ "src", "doc", "example", "go" ],
+ "main": "src/TestRight.js",
+ "bin": "go",
+ "directories": {
+ "lib": "./src",
+ "doc": "./doc",
+ "example": "./example"
+ },
+ "repository" : {
+ "type" : "git",
+ "url" : "https://github.com/MattiSG/Watai.git"
+ },
+
+ "scripts": {
+ "test": "./go test"
+ },
+
+ "engines": {
+ "node" : "0.6"
+ },
+ "engineStrict": true,
+ "dependencies": {
+ "q": "0.8",
+ "mootools": "1.4",
+ "winston": "0.6",
+ "selenium-webdriverjs": "0.0.1-r17314"
+ },
+ "optionalDependencies": {
+ "growl": "1.5"
+ },
+ "devDependencies": {
+ "should": "0.6",
+ "mocha": "1.2"
+ },
+
+ "preferGlobal": true,
+ "private": true
+}
View
28 src/controller/Runner.js
@@ -1,5 +1,10 @@
-var webdriver = require('/Users/eurogiciel/Documents/Ghost/selenium/build/javascript/webdriver/webdriver'),
+var webdriver = require('selenium-webdriverjs');
+var growl;
+try {
growl = require('growl');
+} catch (e) {
+ growl = false;
+}
var logger = require('winston').loggers.get('suites');
@@ -94,7 +99,8 @@ var Runner = new Class({
feature.test().then(this.handleFeatureResult.bind(this, feature, true),
this.handleFeatureResult.bind(this, feature)); // leave last arg to pass failure description
} catch (error) {
- growl('Error!\n' + error, { priority: 4 }); //TODO: do not *depend on* growl
+ if (growl)
+ growl('Error!\n' + error, { priority: 4 });
driver.quit();
throw error;
}
@@ -129,7 +135,23 @@ var Runner = new Class({
if (this.currentFeature < this.features.length)
this.evaluateFeature(this.features[this.currentFeature]);
else
- this.driver.quit();
+ this.finish();
+ },
+
+ /** Informs the user of the end result and cleans up everything after tests runs.
+ *
+ *@param {Boolean} success Whether all features succeeded or not.
+ *@private
+ */
+ finish: function finish(success) {
+ if (growl) {
+ if (this.failed)
+ growl('Test failed :(', { priority: 4 });
+ else
+ growl('Test succeeded! :)', { priority: 3 });
+ }
+
+ this.driver.quit();
}
});
View
2 src/model/Hook.js
@@ -1,4 +1,4 @@
-var webdriver = require('/Users/eurogiciel/Documents/Ghost/selenium/build/javascript/webdriver/webdriver');
+var webdriver = require('selenium-webdriverjs');
var logger = require('winston').loggers.get('steps');
View
4 test/config.js
@@ -1,9 +1,7 @@
module.exports = {
connectURL: 'http://127.0.0.1:4444/wd/hub',
- supportPageURL: 'file:///Users/eurogiciel/Documents/Watai/test/resources/page.html',
-
- webdriverjsPath: '/Users/eurogiciel/Documents/Ghost/selenium/build/javascript/webdriver/webdriver',
+ supportPageURL: 'file://' + __dirname + '/resources/page.html',
driverCapabilities: {
browserName: 'chrome',
View
8 test/helpers/index.js
@@ -1,18 +1,18 @@
-var pathsUtils = require('path');
require('mocha');
require('should');
+var pathsUtils = require('path'),
+ webdriver = require('selenium-webdriverjs');
exports.config = config = require('../config');
-var webdriver = require(config.webdriverjsPath);
-
GLOBAL.driver = new webdriver.Builder()
.usingServer(config.connectURL)
.withCapabilities(config.driverCapabilities)
.build();
-GLOBAL.TestRight = require(process.env.COVERAGE // the trigger is an env variable. See build automation script.
+GLOBAL.TestRight = require(process.env.npm_config_coverage // the trigger is an env variable. See build automation script.
+ // we copy NPM’s coverage trigger, even though we might not use NPM to run the coverage report
? '../../build/TestRight' // Mocha test coverage generation needs instrumented source, see http://tjholowaychuk.com/post/18175682663
: '../../src/TestRight'); // default to non-instrumented source
View
2 test/model/WidgetTest.js
@@ -90,6 +90,8 @@ describe('Widget', function() {
});
it('should say that a missing element is not present', function(done) {
+ this.timeout = 8 * 1000; // since this raises an error, the Selenium server lags the first time
+
subject.has('missing').then(function(presence) {
presence.should.not.be.ok;
done();

No commit comments for this range

Something went wrong with that request. Please try again.