Skip to content

Commit

Permalink
Added tests for the entire spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinEberhardt committed Jan 19, 2014
1 parent 9a783b8 commit 0311a0b
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 41 deletions.
77 changes: 47 additions & 30 deletions browser-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The TodoMVC project has a great many implementations of exactly the same app using different MV* frameworks. The apps should be functionally identical. The goal of these tests is to provide a fully automated browser-based test that can be used to ensure that the specification is being followed by each and every TodoMVC app.

##Todo

+ Complete the test implementation (approximately 50% complete).
+ Make it possible to run against *all* the TodoMVC implementations in one go.
+ Document how to run individual tests (I seem to recall mocha uses some nasty regex).

##Running the tests

These tests use Selenium 2 (WebDriver), via the JavaScript API (WebdriverJS). In order to run the tests you will need to install the dependencies. Run the following command from within the `browser-tests` folder:
Expand Down Expand Up @@ -32,36 +38,47 @@ To run the tests, simply run `mocha` from the `browser-tests` folder. You can ch

The above command results in the following output:

TodoMVC
No Todos
✓ should hide #main and #footer (84ms)
New Todo
✓ should allow me to add todo items (674ms)
✓ should clear text input field when an item is added (387ms)
✓ should trim text input (422ms)
✓ should show #main and #footer when items added (506ms)
Mark all as completed
✓ should allow me to mark all items as completed (1089ms)
✓ should allow me to clear the completion state of all items (1249ms)
◦ complete all checkbox should update state when items are completed
Item
✓ should allow me to mark items as complete (1117ms)
✓ should allow me to un-mark items as complete (1066ms)
2) should allow me to edit an item
3) should show the remove button on hover
Counter
✓ should display the current number of todo items (631ms)
Routing
✓ should allow me to display active items (1154ms)
✓ should allow me to display completed items (1076ms)
✓ should allow me to display all items (1557ms)
✓ should highlight the currently applied filter (1213ms)
Basic create / delete operations
✓ should display the current number of todo items (550ms)


15 passing (46s)
3 failing
TodoMVC
No Todos
✓ should hide #main and #footer (85ms)
New Todo
✓ should allow me to add todo items (671ms)
✓ should clear text input field when an item is added (428ms)
✓ should trim text input (436ms)
✓ should show #main and #footer when items added (491ms)
Mark all as completed
✓ should allow me to mark all items as completed (1331ms)
✓ should allow me to clear the completion state of all items (1259ms)
◦ complete all checkbox should update state when items are completed /
Item
✓ should allow me to mark items as complete (1116ms)
✓ should allow me to un-mark items as complete (1066ms)
2) should allow me to edit an item
3) should show the remove button on hover
Editing
4) should hide other controls when editing
5) should save edits on enter
6) should save edits on blur
7) should trim entered text
8) should remove the item if an empty text string was entered
9) should cancel edits on escape
Counter
✓ should display the current number of todo items (584ms)
Clear completed button
10) should display the number of completed items
11) should remove completed items when clicked
12) should be hidden when there are no items that are completed
Persistence
13) should persist its data
Routing
✓ should allow me to display active items (1167ms)
✓ should allow me to display completed items (1166ms)
✓ should allow me to display all items (1447ms)
✓ should highlight the currently applied filter (1239ms)


14 passing (1m)
13 failing

**NOTE:** There are currently some failures where test implementation is not complete.

Expand Down
48 changes: 37 additions & 11 deletions browser-tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,29 @@ test.describe('TodoMVC', function () {
});

test.describe('Editing', function () {
test.it('should hide other controls when editing', function () {
assert(false);
});

test.it('should save edits on enter', function () {
assert(false);
});

test.it('should save edits on blur', function () {
assert(false);
});

test.it('should trim entered text', function () {
assert(false);
});

test.it('should remove the item if an empty text string was entered', function () {
assert(false);
});

test.it('should cancel edits on escape', function () {
assert(false);
});
});

test.describe('Counter', function () {
Expand All @@ -166,9 +189,23 @@ test.describe('TodoMVC', function () {
});

test.describe('Clear completed button', function () {
test.it('should display the number of completed items', function () {
assert(false);
});

test.it('should remove completed items when clicked', function () {
assert(false);
});

test.it('should be hidden when there are no items that are completed', function () {
assert(false);
});
});

test.describe('Persistence', function () {
test.it('should persist its data', function () {
assert(false);
});
});

test.describe('Routing', function () {
Expand Down Expand Up @@ -219,15 +256,4 @@ test.describe('TodoMVC', function () {
testOps.assertFilterAtIndexIsSelected(2);
});
});

test.describe('Basic create / delete operations', function () {
test.it('should display the current number of todo items', function () {
page.enterItem(TODO_ITEM_ONE);
testOps.assertItemCountText("1 item left");
page.enterItem(TODO_ITEM_TWO);
testOps.assertItemCountText("2 items left");
});
});


});

0 comments on commit 0311a0b

Please sign in to comment.