Skip to content

Commit

Permalink
Make bigger splash slightly smaller.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Battersby committed Sep 5, 2014
1 parent 6c1f29b commit c57306f
Showing 1 changed file with 54 additions and 72 deletions.
126 changes: 54 additions & 72 deletions README.md
Expand Up @@ -20,81 +20,63 @@
Pioneer provides an abstraction layer between your integration tests and your DOM markup, DRYing up your step definitions and consolidating how people interact with the DOM in tests.

# Installing
```bash
$ npm install pioneer --save-dev
```
``` bash
$ npm install pioneer --save-dev
```

# Get Started

Write your features in Cucumber/Gherkin
```gherkin
Scenario: Completing a Todo
When I enter "Learn Pioneer"
And complete the first todo
Then I should see that the first todo is completed
```

Write your step definitions in javascript with promises
```js
this.When(/^complete the first todo$/, function(){
return new this.Widgets.TodoList().complete(0)
});

this.Then(/^I should see that the first todo is completed$/, function() {
return new this.Widgets.TodoList()
.isCompleted(0).should.eventually.eql(true)
});
```

Abstract your application's components and interactions into reusable widgets
```js
module.exports = function() {
this.Widgets = this.Widgets || {};

Widgets.TodoList = new this.Widget.extend({
root: "#todo-list",

complete: function (index) {
return this.clickAt({
selector: "input",
index: index
})
},

isCompleted: function(index) {
this.at(index).then(function(el){
el.getAttribute("class").then(function(className){
return className.indexOf("completed") > -1
})
})
}

})
}
```

Load your dependencies and config into `pioneer.js`
```json
{
"feature": "features/",
"require": [
"step_definitions",
"widgets/"
],
"format": "pioneerformat.js",
"driver": "chrome",
"error_formatter": "errorformat.js",
"preventReload": false,
"coffee": false
}
```

And run your tests
```bash
$ ./node_modules/.bin/pioneer
```

### [(Read the full getting started guide)](docs/getting_started.md)
### Make your first test
``` bash
$ ./node_modules/.bin/pioneer --scaffold
```

This will give you

* A Gherkin feature file

``` gherkin
Feature: Simple Feature
Background:
Given I visit TODOMVC
Scenario: Entering Information
When I enter "dogecoins"
Then I should see "dogecoins"
```

* Step definitions with promises and widgets

``` js
this.Given(/^I visit TODOMVC$/,function(){
this.driver.get('http://todomvc.com/architecture-examples/backbone/')
});

this.When(/^I enter \"([^\"]*)\"$/, function(value){
new this.Widget({
root: "#new-todo"
}).sendKeys(value,'\uE007');
});

this.Then(/^I should see \"([^\"]*)\"$/, function(expected){
var List = this.Widget.List.extend({
root: "#todo-list",
childSelector: "li"
})

return new List().readAt(0).should.eventually.eql(expected);
})
```

* Plus some basic directory structure and configuration

### Run it!
``` bash
$ ./node_modules/.bin/pioneer
```

### [Now, write your second test!](docs/getting_started.md)

# Docs

Expand Down

0 comments on commit c57306f

Please sign in to comment.