Skip to content

Commit b31416b

Browse files
committed
Merge pull request tastejs#859 from ColinEberhardt/routing-test
Added a test to verify that routing works with the back button
2 parents a82f3ee + ba0bf8b commit b31416b

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

browser-tests/knownIssues.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,33 +111,57 @@ module.exports = [
111111
'TodoMVC - dijon, Editing, should cancel edits on escape',
112112
'TodoMVC - knockoutjs_require, Editing, should cancel edits on escape',
113113

114+
// all the following are covered by this issue:
115+
// https://github.com/tastejs/todomvc/issues/856
116+
'TodoMVC - knockoutjs, Routing, should respect the back button',
117+
'TodoMVC - spine, Routing, should respect the back button',
118+
'TodoMVC - componentjs, Routing, should respect the back button',
119+
'TodoMVC - react, Routing, should respect the back button',
120+
'TodoMVC - serenadejs, Routing, should respect the back button',
121+
'TodoMVC - somajs, Routing, should respect the back button',
122+
'TodoMVC - flight, Routing, should respect the back button',
123+
'TodoMVC - lavaca_require, Routing, should respect the back button',
124+
'TodoMVC - somajs_require, Routing, should respect the back button',
125+
114126
// all the following are covered by this issue:
115127
// https://github.com/tastejs/todomvc/issues/790
116128
// these implementations filter the view rather than the model when routing
117129
'TodoMVC - agilityjs, Routing, should allow me to display active items',
118130
'TodoMVC - agilityjs, Routing, should allow me to display completed items',
131+
'TodoMVC - agilityjs, Routing, should respect the back button',
119132
'TodoMVC - backbone, Routing, should allow me to display active items',
120133
'TodoMVC - backbone, Routing, should allow me to display completed items',
134+
'TodoMVC - backbone, Routing, should respect the back button',
121135
'TodoMVC - maria, Routing, should allow me to display active items',
122136
'TodoMVC - maria, Routing, should allow me to display completed items',
137+
'TodoMVC - maria, Routing, should respect the back button',
123138
'TodoMVC - dojo, Routing, should allow me to display active items',
124139
'TodoMVC - dojo, Routing, should allow me to display completed items',
140+
'TodoMVC - dojo, Routing, should respect the back button',
125141
'TodoMVC - atmajs, Routing, should allow me to display active items',
126142
'TodoMVC - atmajs, Routing, should allow me to display completed items',
143+
'TodoMVC - atmajs, Routing, should respect the back button',
127144
'TodoMVC - backbone_marionette, Routing, should allow me to display active items',
128145
'TodoMVC - backbone_marionette, Routing, should allow me to display completed items',
146+
'TodoMVC - backbone_marionette, Routing, should respect the back button',
129147
'TodoMVC - exoskeleton, Routing, should allow me to display active items',
130148
'TodoMVC - exoskeleton, Routing, should allow me to display completed items',
149+
'TodoMVC - exoskeleton, Routing, should respect the back button',
131150
'TodoMVC - thorax, Routing, should allow me to display active items',
132151
'TodoMVC - thorax, Routing, should allow me to display completed items',
152+
'TodoMVC - thorax, Routing, should respect the back button',
133153
'TodoMVC - thorax_lumbar, Routing, should allow me to display active items',
134154
'TodoMVC - thorax_lumbar, Routing, should allow me to display completed items',
155+
'TodoMVC - thorax_lumbar, Routing, should respect the back button',
135156
'TodoMVC - troopjs_require, Routing, should allow me to display active items',
136157
'TodoMVC - troopjs_require, Routing, should allow me to display completed items',
158+
'TodoMVC - troopjs_require, Routing, should respect the back button',
137159
'TodoMVC - backbone_require, Routing, should allow me to display active items',
138160
'TodoMVC - backbone_require, Routing, should allow me to display completed items',
161+
'TodoMVC - backbone_require, Routing, should respect the back button',
139162
'TodoMVC - ariatemplates, Routing, should allow me to display active items',
140163
'TodoMVC - ariatemplates, Routing, should allow me to display completed items',
164+
'TodoMVC - ariatemplates, Routing, should respect the back button',
141165
'TodoMVC - backbone_marionette_require, Routing, should allow me to display active items',
142166
'TodoMVC - backbone_marionette_require, Routing, should allow me to display completed items',
143167
'TodoMVC - chaplin-brunch, Routing, should allow me to display active items',
@@ -159,26 +183,32 @@ module.exports = [
159183
'TodoMVC - extjs_deftjs, Routing, should allow me to display completed items',
160184
'TodoMVC - extjs_deftjs, Routing, should allow me to display all items',
161185
'TodoMVC - extjs_deftjs, Routing, should highlight the currently applied filter',
186+
'TodoMVC - extjs_deftjs, Routing, should respect the back button',
162187
'TodoMVC - olives, Routing, should allow me to display active items',
163188
'TodoMVC - olives, Routing, should allow me to display completed items',
164189
'TodoMVC - olives, Routing, should allow me to display all items',
165190
'TodoMVC - olives, Routing, should highlight the currently applied filter',
191+
'TodoMVC - olives, Routing, should respect the back button',
166192
'TodoMVC - dijon, Routing, should allow me to display active items',
167193
'TodoMVC - dijon, Routing, should allow me to display completed items',
168194
'TodoMVC - dijon, Routing, should allow me to display all items',
169195
'TodoMVC - dijon, Routing, should highlight the currently applied filter',
196+
'TodoMVC - dijon, Routing, should respect the back button',
170197
'TodoMVC - duel, Routing, should allow me to display active items',
171198
'TodoMVC - duel, Routing, should allow me to display completed items',
172199
'TodoMVC - duel, Routing, should allow me to display all items',
173200
'TodoMVC - duel, Routing, should highlight the currently applied filter',
201+
'TodoMVC - duel, Routing, should respect the back button',
174202
'TodoMVC - knockoutjs_require, Routing, should allow me to display active items',
175203
'TodoMVC - knockoutjs_require, Routing, should allow me to display completed items',
176204
'TodoMVC - knockoutjs_require, Routing, should allow me to display all items',
177205
'TodoMVC - knockoutjs_require, Routing, should highlight the currently applied filter',
206+
'TodoMVC - knockoutjs_require, Routing, should respect the back button',
178207
'TodoMVC - angular-dart, Routing, should allow me to display active items',
179208
'TodoMVC - angular-dart, Routing, should allow me to display completed items',
180209
'TodoMVC - angular-dart, Routing, should allow me to display all items',
181210
'TodoMVC - angular-dart, Routing, should highlight the currently applied filter',
211+
'TodoMVC - angular-dart, Routing, should respect the back button',
182212
'TodoMVC - typescript-backbone, Routing, should allow me to display active items',
183213
'TodoMVC - typescript-backbone, Routing, should allow me to display completed items',
184214
'TodoMVC - typescript-backbone, Routing, should allow me to display all items',
@@ -201,6 +231,7 @@ module.exports = [
201231
'TodoMVC - extjs, Routing, should allow me to display completed items',
202232
'TodoMVC - extjs, Routing, should allow me to display all items',
203233
'TodoMVC - extjs, Routing, should highlight the currently applied filter',
234+
'TodoMVC - extjs, Routing, should respect the back button',
204235

205236
// stapes is completely broken!
206237
// see: https://github.com/tastejs/todomvc/issues/808
@@ -224,6 +255,7 @@ module.exports = [
224255
'TodoMVC - stapes, Routing, should allow me to display active items',
225256
'TodoMVC - stapes, Routing, should allow me to display completed items',
226257
'TodoMVC - stapes, Routing, should allow me to display all items',
258+
'TodoMVC - stapes, Routing, should respect the back button',
227259
'TodoMVC - stapes_require, No Todos, should hide #main and #footer',
228260
'TodoMVC - stapes_require, New Todo, should allow me to add todo items',
229261
'TodoMVC - stapes_require, New Todo, should append new items to the bottom of the list',
@@ -247,6 +279,7 @@ module.exports = [
247279
'TodoMVC - stapes_require, Routing, should allow me to display active items',
248280
'TodoMVC - stapes_require, Routing, should allow me to display completed items',
249281
'TodoMVC - stapes_require, Routing, should allow me to display all items',
282+
'TodoMVC - stapes_require, Routing, should respect the back button',
250283

251284
// mozart is not on the public website
252285
'TodoMVC - mozart, New Todo, should allow me to add todo items',

browser-tests/page.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ module.exports = function Page(browser) {
2323
return this.getTodoListXpath() + '/li[' + (index + 1) + ']';
2424
};
2525

26+
// ----------------- navigation methods
27+
28+
this.back = function() {
29+
return browser.navigate().back();
30+
}
31+
2632
// ----------------- try / get methods
2733

2834
// unfortunately webdriver does not have a decent API for determining if an

browser-tests/test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,25 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
315315
testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_THREE]);
316316
});
317317

318+
test.it('should respect the back button', function () {
319+
createStandardItems();
320+
page.toggleItemAtIndex(1);
321+
322+
page.filterByActiveItems();
323+
page.filterByCompletedItems();
324+
325+
// should show completed items
326+
testOps.assertItems([TODO_ITEM_TWO]);
327+
328+
// then active items
329+
page.back();
330+
testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_THREE]);
331+
332+
// then all items
333+
page.back();
334+
testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_TWO, TODO_ITEM_THREE]);
335+
});
336+
318337
test.it('should allow me to display completed items', function () {
319338
createStandardItems();
320339
page.toggleItemAtIndex(1);

0 commit comments

Comments
 (0)