-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e82125
commit f0f5dab
Showing
16 changed files
with
160 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function listOf(delimitedValues) { | ||
return delimitedValues.split(',').map(function (value) { return value.trim(); }); | ||
} | ||
|
||
exports = module.exports = { listOf }; |
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,7 +1,7 @@ | ||
const { shallSeeTodosOf, } = require('./shallSeeTodosOf.ask'); | ||
const { shallSeeTodosCountOf, } = require('./shallSeeTodosCountOf.ask'); | ||
const { shallSeeTodosOf } = require('./shallSeeTodosOf.ask'); | ||
const { shallSeeTodosCountOf } = require('./shallSeeTodosCountOf.ask'); | ||
|
||
exports = module.exports = { | ||
shallSeeTodosOf, | ||
shallSeeTodosCountOf, | ||
shallSeeTodosCountOf | ||
}; |
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,12 +1,12 @@ | ||
const { expect, } = require('chai'); | ||
const { expect } = require('chai'); | ||
const { element, By } = require('protractor'); | ||
|
||
const nrofTodosElement = element(By.css('.todo-count')); | ||
|
||
async function shallSeeTodosCountOf(nrOfTodos) { | ||
const actualNrOfTodos = await nrofTodosElement.getText(); | ||
|
||
return expect(nrOfTodos).to.be.equal(parseInt(actualNrOfTodos, 10)); | ||
return expect(parseInt(actualNrOfTodos, 10)).to.be.at.least(nrOfTodos); | ||
} | ||
|
||
exports = module.exports = { shallSeeTodosCountOf, }; | ||
exports = module.exports = { shallSeeTodosCountOf }; |
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,13 +1,12 @@ | ||
const { expect, } = require('chai'); | ||
const { expect } = require('chai'); | ||
const { element, By } = require('protractor'); | ||
|
||
const todoElements = element.all(By.css('.view')); | ||
|
||
async function shallSeeTodosOf(todos) { | ||
const expectedTodos = todos.split(', '); | ||
const actualTodos = await todoElements.getText(); | ||
|
||
return expect(expectedTodos).to.have.all.members(actualTodos); | ||
return expect(actualTodos).to.have.all.members(todos); | ||
} | ||
|
||
exports = module.exports = { shallSeeTodosOf, }; | ||
exports = module.exports = { shallSeeTodosOf }; |
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,14 +1,17 @@ | ||
const { element, By, Key, promise, } = require('protractor'); | ||
const { element, By, promise } = require('protractor'); | ||
|
||
const newtodoInput = element(By.css('.new-todo')); | ||
|
||
async function addNewTodos(todos) { | ||
const todoFns = todos.split(', ').map(addNewTodo); | ||
const todoFns = todos.map(addNewTodo); | ||
return promise.all(todoFns); | ||
} | ||
|
||
async function addNewTodo(todo) { | ||
return await newtodoInput.sendKeys(todo.trim() + '\n'); | ||
return newtodoInput.sendKeys(todo + '\n'); | ||
} | ||
|
||
exports = module.exports = { addNewTodos, addNewTodo, }; | ||
exports = module.exports = { | ||
addNewTodos, | ||
addNewTodo | ||
}; |
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,8 +1,12 @@ | ||
const { addNewTodo, addNewTodos, } = require('./addNewTodos.task'); | ||
const { visitHomepage, } = require('./visitPage.task'); | ||
const { addNewTodo, addNewTodos } = require('./addNewTodos.task'); | ||
const { trashTodoList } = require('./trashTodoList.task'); | ||
const { visitHomepage, visitHashActive, visitHashCompleted } = require('./visitPage.task'); | ||
|
||
exports = module.exports = { | ||
addNewTodo, | ||
addNewTodos, | ||
trashTodoList, | ||
visitHomepage, | ||
visitHashActive, | ||
visitHashCompleted | ||
}; |
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,11 @@ | ||
const { element, By } = require('protractor'); | ||
|
||
async function trashTodoList() { | ||
const nrOfTodos = await element.all(By.css('input[type=checkbox]')).count(); | ||
if (nrOfTodos > 0) { | ||
await element(By.id('toggle-all')).click(); | ||
} | ||
return element(By.css('.clear-completed')).click(); | ||
} | ||
|
||
exports = module.exports = { trashTodoList } |
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,11 +1,24 @@ | ||
const { browser, } = require('protractor'); | ||
const { browser } = require('protractor'); | ||
|
||
function visitHomepage() { | ||
return visitPage(); | ||
return visitPage('#'); | ||
} | ||
|
||
function visitPage(path = browser.baseUrl) { | ||
function visitHashActive() { | ||
return visitPage('#/active'); | ||
} | ||
|
||
function visitHashCompleted() { | ||
return visitPage('#/completed'); | ||
} | ||
|
||
function visitPage(hash) { | ||
const path = browser.baseUrl + '/' + hash + '/'; | ||
return browser.driver.get(path); | ||
} | ||
|
||
exports = module.exports = { visitHomepage, visitPage, }; | ||
exports = module.exports = { | ||
visitHomepage, | ||
visitHashActive, | ||
visitHashCompleted | ||
}; |
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,27 @@ | ||
# language: en | ||
@search @functional @gui @uat | ||
Feature: Adding more things to do to the list | ||
In order to avoid having to remember things that needs to do | ||
KP wants to records all the things needs to get done. | ||
|
||
@regression @integration @ci | ||
Scenario Outline: Add more new items to the todo list | ||
|
||
Given that KP has a list of things to do such as "<todo-list>" | ||
When he adds "<more-todos>" to the list | ||
Then he shall see both "<todo-list>" and "<more-todos>" in the list | ||
And he shall see the number of todos should at least be <nr-of-todos> | ||
When he looks at all things to do | ||
Then he shall see the number of todos should at least be <total-nr-of-todos> | ||
|
||
@smoke | ||
Examples: | ||
| todo-list | more-todos | nr-of-todos | total-nr-of-todos | | ||
| Smile more often, Drink more water, Eat a banana | Quit the job, Sleep early, Eat a banana | 3 | 6 | | ||
| Join the 5AM Club, Join the Audible Inner-circle | Go to Yoga, Meet the shrink | 2 | 4 | | ||
| Sprint retrospective starts 2pm, Tech talk starts 6pm | Write some code, Do some demos, Smile more often, Drink more water | 4 | 6 | | ||
|
||
@sanity @security | ||
Examples: | ||
| todo-list | more-todos | nr-of-todos | total-nr-of-todos | | ||
| Join the 5AM Club, Join the Audible Inner-circle | Go to Yoga, Meet the shrink | 2 | 4 | |
This file was deleted.
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# language: en | ||
@search @functional @gui @uat | ||
Feature: Start using a fresh todo list | ||
In order to avoid having to remember things that needs to do | ||
KP wants to records all the things needs to get done. | ||
|
||
Background: | ||
|
||
Given that KP has a list of things to do such as "Write some code, Do some demos, Smile more often, Drink more water" | ||
|
||
@regression @integration @ci | ||
Scenario Outline: Create a fresh todo list | ||
|
||
Given that KP starts a fresh todo list | ||
When he adds "<new-todo-list>" to the list | ||
Then he shall see the number of todos should at least be <nr-of-todos> | ||
When he looks at pending things to do | ||
Then he shall see "<new-todo-list>" in the list | ||
|
||
@smoke | ||
Examples: | ||
| some-todo-list | new-todo-list | nr-of-todos | | ||
| Quit the job, Sleep early, Eat a banana | Smile more often, Drink more water, Eat a banana | 3 | | ||
| Go to Yoga, Meet the shrink | Join the 5AM Club, Join the Audible Inner-circle | 2 | | ||
| Write some code, Do some demos, Smile more often, Drink more water | Sprint retrospective starts 2pm, Tech talk starts 6pm | 2 | | ||
|
||
@sanity @security | ||
Examples: | ||
| some-todo-list | new-todo-list | nr-of-todos | | ||
| Go to Yoga, Meet the shrink | Join the 5AM Club, Join the Audible Inner-circle | 2 | |
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,16 @@ | ||
const { Given } = require('cucumber'); | ||
const { listOf } = require('../../actions/helpers/strings'); | ||
const { visitHomepage, visitHashActive, addNewTodos, trashTodoList } = require('../../actions/tasks'); | ||
const overrideOptions = { timeout: 60 * 1000 }; | ||
|
||
Given('that KP has a list of things to do such as {string}', overrideOptions, async function (todos) { | ||
await visitHashActive(); | ||
await addNewTodos(listOf(todos)); | ||
return visitHomepage(); | ||
}); | ||
|
||
Given('that KP starts a fresh todo list', overrideOptions, async function () { | ||
await visitHashActive(); | ||
await trashTodoList(); | ||
return visitHomepage(); | ||
}); |
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,15 @@ | ||
const { Then } = require('cucumber'); | ||
const { listOf } = require('../../actions/helpers/strings'); | ||
const { shallSeeTodosOf, shallSeeTodosCountOf } = require('../../actions/questions'); | ||
|
||
Then('he shall see the number of todos should at least be {int}', async function (nrOfTodos) { | ||
return shallSeeTodosCountOf(nrOfTodos); | ||
}); | ||
|
||
Then('he shall see {string} in the list', async function (todos) { | ||
return shallSeeTodosOf(listOf(todos)); | ||
}); | ||
|
||
Then('he shall see both {string} and {string} in the list', async function (oldTodos, newTodos) { | ||
return shallSeeTodosOf(listOf(oldTodos + ', ' + newTodos)); | ||
}); |
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,7 @@ | ||
const { When } = require('cucumber'); | ||
const { listOf } = require('../../actions/helpers/strings'); | ||
const { addNewTodos } = require('../../actions/tasks'); | ||
|
||
When('he adds {string} to the list', async function (todos) { | ||
return addNewTodos(listOf(todos)); | ||
}); |
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,10 @@ | ||
const { When } = require('cucumber'); | ||
const { visitHomepage, visitHashActive } = require('../../actions/tasks'); | ||
|
||
When('he looks at pending things to do', async function () { | ||
return visitHashActive(); | ||
}); | ||
|
||
When('he looks at all things to do', async function () { | ||
return visitHomepage(); | ||
}); |
This file was deleted.
Oops, something went wrong.