Commit ca90e8cc authored by Colin Eberhardt's avatar Colin Eberhardt Committed by Sindre Sorhus

Close GH-951:

Browser tests no longer mandate hidden items are removed from the DOM

Fixes #908 - tests no longer mandate hidden items are removed from the DOM
Closes #790 - these were implementations that implemented routing via hiding items, rather than removing from the DOM

Regressions:
#949 - discovered that exoskeleton is badly broken
#858 - added typescript-backbone (might not be a regression, more likely missed earlier)

Updated knownIssues based on recent updates to puremvc, react, soma etc ...
parent e2380422
...@@ -28,6 +28,8 @@ or its Ruby equivalent: ...@@ -28,6 +28,8 @@ or its Ruby equivalent:
ruby -run -e httpd . -p 8000 ruby -run -e httpd . -p 8000
And for Windows, the node [http-server](https://github.com/nodeapps/http-server) is a simple, zero-configuration alternative.
To run the tests for all TodoMVC implementations, run the following: To run the tests for all TodoMVC implementations, run the following:
mocha allTests.js --reporter spec mocha allTests.js --reporter spec
...@@ -63,7 +65,7 @@ Valid browser names can be found within webdriver via the `webdriver.Browser` en ...@@ -63,7 +65,7 @@ Valid browser names can be found within webdriver via the `webdriver.Browser` en
##Reporting against known issues ##Reporting against known issues
The `knownIssues.js` file details the currently known issues with the TodoMVC implementations. You can run the tests and compare against these issues using the `mocha-known-issues-reporter`. This reporter is a separate npm module, as a result the easier way to run it using the supplied gruntfile: The `knownIssues.js` file details the currently known issues with the TodoMVC implementations. You can run the tests and compare against these issues using the `mocha-known-issues-reporter`. This reporter is a separate npm module, as a result the easiest way to run it using the supplied gruntfile:
grunt test --framework=angularjs grunt test --framework=angularjs
......
...@@ -50,6 +50,9 @@ var exceptions = [ ...@@ -50,6 +50,9 @@ var exceptions = [
{ name: 'chaplin-brunch', path: 'labs/dependency-examples/chaplin-brunch/public' }, { name: 'chaplin-brunch', path: 'labs/dependency-examples/chaplin-brunch/public' },
{ name: 'angular-dart', path: 'labs/architecture-examples/angular-dart/web' }, { name: 'angular-dart', path: 'labs/architecture-examples/angular-dart/web' },
{ name: 'duel', path: 'labs/architecture-examples/duel/www' }, { name: 'duel', path: 'labs/architecture-examples/duel/www' },
{ name: 'dart', path: 'vanilla-examples/vanilladart/build/' },
{ name: 'canjs_require', path: 'labs/dependency-examples/canjs_require/' },
{ name: 'troopjs', path: 'labs/dependency-examples/troopjs_require/' },
{ name: 'thorax_lumbar', path: 'labs/dependency-examples/thorax_lumbar/public' }, { name: 'thorax_lumbar', path: 'labs/dependency-examples/thorax_lumbar/public' },
]; ];
list = list.map(function (framework) { list = list.map(function (framework) {
......
...@@ -49,10 +49,6 @@ module.exports = [ ...@@ -49,10 +49,6 @@ module.exports = [
'TodoMVC - typescript-backbone, Editing, should remove the item if an empty text string was entered', 'TodoMVC - typescript-backbone, Editing, should remove the item if an empty text string was entered',
'TodoMVC - typescript-backbone, Editing, should cancel edits on escape', 'TodoMVC - typescript-backbone, Editing, should cancel edits on escape',
// https://github.com/tastejs/todomvc/issues/823
// prepends new items rather than appends
'TodoMVC - puremvc, New Todo, should append new items to the bottom of the list',
// https://github.com/tastejs/todomvc/issues/815 // https://github.com/tastejs/todomvc/issues/815
// does not hide other controls while editing // does not hide other controls while editing
'TodoMVC - dojo, Editing, should hide other controls when editing', 'TodoMVC - dojo, Editing, should hide other controls when editing',
...@@ -90,7 +86,6 @@ module.exports = [ ...@@ -90,7 +86,6 @@ module.exports = [
'TodoMVC - kendo, Editing, should cancel edits on escape', 'TodoMVC - kendo, Editing, should cancel edits on escape',
'TodoMVC - olives, Editing, should cancel edits on escape', 'TodoMVC - olives, Editing, should cancel edits on escape',
'TodoMVC - plastronjs, Editing, should cancel edits on escape', 'TodoMVC - plastronjs, Editing, should cancel edits on escape',
'TodoMVC - puremvc, Editing, should cancel edits on escape',
'TodoMVC - rappidjs, Editing, should cancel edits on escape', 'TodoMVC - rappidjs, Editing, should cancel edits on escape',
'TodoMVC - serenadejs, Editing, should cancel edits on escape', 'TodoMVC - serenadejs, Editing, should cancel edits on escape',
'TodoMVC - somajs, Editing, should cancel edits on escape', 'TodoMVC - somajs, Editing, should cancel edits on escape',
...@@ -110,57 +105,12 @@ module.exports = [ ...@@ -110,57 +105,12 @@ module.exports = [
'TodoMVC - knockoutjs, Routing, should respect the back button', 'TodoMVC - knockoutjs, Routing, should respect the back button',
'TodoMVC - spine, Routing, should respect the back button', 'TodoMVC - spine, Routing, should respect the back button',
'TodoMVC - componentjs, Routing, should respect the back button', 'TodoMVC - componentjs, Routing, should respect the back button',
'TodoMVC - react, Routing, should respect the back button',
'TodoMVC - serenadejs, Routing, should respect the back button', 'TodoMVC - serenadejs, Routing, should respect the back button',
'TodoMVC - somajs, Routing, should respect the back button',
'TodoMVC - flight, Routing, should respect the back button', 'TodoMVC - flight, Routing, should respect the back button',
'TodoMVC - lavaca_require, Routing, should respect the back button', 'TodoMVC - lavaca_require, Routing, should respect the back button',
'TodoMVC - somajs_require, Routing, should respect the back button', 'TodoMVC - somajs_require, Routing, should respect the back button',
// all the following are covered by this issue:
// https://github.com/tastejs/todomvc/issues/790
// these implementations filter the view rather than the model when routing
'TodoMVC - agilityjs, Routing, should allow me to display active items',
'TodoMVC - agilityjs, Routing, should allow me to display completed items',
'TodoMVC - agilityjs, Routing, should respect the back button', 'TodoMVC - agilityjs, Routing, should respect the back button',
'TodoMVC - backbone, Routing, should allow me to display active items',
'TodoMVC - backbone, Routing, should allow me to display completed items',
'TodoMVC - backbone, Routing, should respect the back button',
'TodoMVC - maria, Routing, should allow me to display active items',
'TodoMVC - maria, Routing, should allow me to display completed items',
'TodoMVC - maria, Routing, should respect the back button', 'TodoMVC - maria, Routing, should respect the back button',
'TodoMVC - dojo, Routing, should allow me to display active items',
'TodoMVC - dojo, Routing, should allow me to display completed items',
'TodoMVC - dojo, Routing, should respect the back button',
'TodoMVC - atmajs, Routing, should allow me to display active items',
'TodoMVC - atmajs, Routing, should allow me to display completed items',
'TodoMVC - atmajs, Routing, should respect the back button',
'TodoMVC - backbone_marionette, Routing, should allow me to display active items',
'TodoMVC - backbone_marionette, Routing, should allow me to display completed items',
'TodoMVC - backbone_marionette, Routing, should respect the back button',
'TodoMVC - exoskeleton, Routing, should allow me to display active items',
'TodoMVC - exoskeleton, Routing, should allow me to display completed items',
'TodoMVC - exoskeleton, Routing, should respect the back button',
'TodoMVC - thorax, Routing, should allow me to display active items',
'TodoMVC - thorax, Routing, should allow me to display completed items',
'TodoMVC - thorax, Routing, should respect the back button',
'TodoMVC - thorax_lumbar, Routing, should allow me to display active items',
'TodoMVC - thorax_lumbar, Routing, should allow me to display completed items',
'TodoMVC - thorax_lumbar, Routing, should respect the back button',
'TodoMVC - troopjs_require, Routing, should allow me to display active items',
'TodoMVC - troopjs_require, Routing, should allow me to display completed items',
'TodoMVC - troopjs_require, Routing, should respect the back button',
'TodoMVC - backbone_require, Routing, should allow me to display active items',
'TodoMVC - backbone_require, Routing, should allow me to display completed items',
'TodoMVC - backbone_require, Routing, should respect the back button',
'TodoMVC - ariatemplates, Routing, should allow me to display active items',
'TodoMVC - ariatemplates, Routing, should allow me to display completed items',
'TodoMVC - ariatemplates, Routing, should respect the back button',
'TodoMVC - backbone_marionette_require, Routing, should allow me to display active items',
'TodoMVC - backbone_marionette_require, Routing, should allow me to display completed items',
'TodoMVC - chaplin-brunch, Routing, should allow me to display active items',
'TodoMVC - chaplin-brunch, Routing, should allow me to display completed items',
// the following are covered by this issue: // the following are covered by this issue:
// https://github.com/tastejs/todomvc/issues/795 // https://github.com/tastejs/todomvc/issues/795
...@@ -169,10 +119,6 @@ module.exports = [ ...@@ -169,10 +119,6 @@ module.exports = [
'TodoMVC - kendo, Mark all as completed, complete all checkbox should update state when items are completed / cleared', 'TodoMVC - kendo, Mark all as completed, complete all checkbox should update state when items are completed / cleared',
// the following implementations do not support routing // the following implementations do not support routing
'TodoMVC - jquery, Routing, should allow me to display active items',
'TodoMVC - jquery, Routing, should allow me to display completed items',
'TodoMVC - jquery, Routing, should allow me to display all items',
'TodoMVC - jquery, Routing, should highlight the currently applied filter',
'TodoMVC - extjs_deftjs, Routing, should allow me to display active items', 'TodoMVC - extjs_deftjs, Routing, should allow me to display active items',
'TodoMVC - extjs_deftjs, Routing, should allow me to display completed items', 'TodoMVC - extjs_deftjs, Routing, should allow me to display completed items',
'TodoMVC - extjs_deftjs, Routing, should allow me to display all items', 'TodoMVC - extjs_deftjs, Routing, should allow me to display all items',
...@@ -207,6 +153,7 @@ module.exports = [ ...@@ -207,6 +153,7 @@ module.exports = [
'TodoMVC - typescript-backbone, Routing, should allow me to display completed items', 'TodoMVC - typescript-backbone, Routing, should allow me to display completed items',
'TodoMVC - typescript-backbone, Routing, should allow me to display all items', 'TodoMVC - typescript-backbone, Routing, should allow me to display all items',
'TodoMVC - typescript-backbone, Routing, should highlight the currently applied filter', 'TodoMVC - typescript-backbone, Routing, should highlight the currently applied filter',
'TodoMVC - typescript-backbone, Routing, should respect the back button',
// EXTJS is not spec compliant (by a long way!) // EXTJS is not spec compliant (by a long way!)
'TodoMVC - extjs, New Todo, should show #main and #footer when items added', 'TodoMVC - extjs, New Todo, should show #main and #footer when items added',
......
'use strict'; 'use strict';
var assert = require('assert'); var assert = require('assert');
var Q = require('q'); var Q = require('q');
function TestOperations(page) { function TestOperations(page) {
// unfortunately webdriver does not have a decent API for determining if an // unfortunately webdriver does not have a decent API for determining if an
// element exists. The standard approach is to obtain an array of elements // element exists. The standard approach is to obtain an array of elements
// and test that the length is zero. In this case the item is hidden if // and test that the length is zero. In this case the item is hidden if
...@@ -106,23 +104,44 @@ function TestOperations(page) { ...@@ -106,23 +104,44 @@ function TestOperations(page) {
// tests that the list contains the following items, independant of order // tests that the list contains the following items, independant of order
this.assertItems = function (textArray) { this.assertItems = function (textArray) {
page.getItemLabels().then(function (labels) { page.getItemLabels().then(function (labels) {
assert.equal(textArray.length, labels.length,
textArray.length + ' items expected in the todo list, ' + labels.length + ' items observed'); // obtain all the visible items
// create an array of promises which check the presence of the var visibleLabels = [];
// label text within the 'textArray'
var tests = []; var tests = [];
for (var i = 0; i < labels.length; i++) { for (var i = 0; i < labels.length; i++) {
(function (index) {
// suppressing JSHint - the loop variable is not being used in the function. // suppressing JSHint - the loop variable is not being used in the function.
/* jshint -W083 */ /* jshint -W083 */
tests.push(labels[i].getText().then(function (text) { tests.push(labels[index].isDisplayed().then(function (isDisplayed) {
if (isDisplayed) {
visibleLabels.push(labels[index]);
}
}));
})(i);
}
// check that they match the supplied text
return Q.all(tests).then(function () {
assert.equal(textArray.length, visibleLabels.length,
textArray.length + ' items expected in the todo list, ' + visibleLabels.length + ' items observed');
// create an array of promises which check the presence of the
// label text within the 'textArray'
tests = [];
for (var i = 0; i < visibleLabels.length; i++) {
// suppressing JSHint - the loop variable is not being used in the function.
/* jshint -W083 */
tests.push(visibleLabels[i].getText().then(function (text) {
var index = textArray.indexOf(text); var index = textArray.indexOf(text);
assert(index !== -1, 'A todo item with text \'' + text + '\' was not found'); assert(index !== -1, 'A todo item with text \'' + text + '\' was not expected');
// remove this item when found // remove this item when found
textArray.splice(index, 1); textArray.splice(index, 1);
})); }));
} }
// execute all the tests // execute all the tests
return Q.all(tests); return Q.all(tests);
})
}); });
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment