1 var numberOfItemsToAdd = 100;
3 var ENTER_KEY_CODE = 13;
5 var triggerEnter = function (element, type) {
6 var event = document.createEvent('Events');
7 event.initEvent(type, true, true);
8 event.keyCode = ENTER_KEY_CODE;
9 event.which = ENTER_KEY_CODE;
11 element.dispatchEvent(event);
15 name: 'VanillaJS-TodoMVC',
16 url: 'todomvc/vanilla-examples/vanillajs/index.html',
17 prepare: function (runner, contentWindow, contentDocument) {
18 return runner.waitForElement('.new-todo').then(function (element) {
24 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
25 for (var i = 0; i < numberOfItemsToAdd; i++) {
26 newTodo.value = 'Something to do ' + i;
27 newTodo.dispatchEvent(new Event('change'));
28 triggerEnter(newTodo, 'keypress');
31 new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
32 var checkboxes = contentDocument.querySelectorAll('.toggle');
33 for (var i = 0; i < checkboxes.length; i++)
34 checkboxes[i].click();
36 new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
37 var deleteButtons = contentDocument.querySelectorAll('.destroy');
38 for (var i = 0; i < deleteButtons.length; i++)
39 deleteButtons[i].click();
45 name: 'Vanilla-ES2015-TodoMVC',
46 url: 'todomvc/vanilla-examples/es2015/index.html',
47 prepare: function (runner, contentWindow, contentDocument) {
48 return runner.waitForElement('.new-todo').then(function (element) {
54 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
55 for (var i = 0; i < numberOfItemsToAdd; i++) {
56 newTodo.value = 'Something to do ' + i;
57 newTodo.dispatchEvent(new Event('change'));
58 triggerEnter(newTodo, 'keypress');
61 new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
62 var checkboxes = contentDocument.querySelectorAll('.toggle');
63 for (var i = 0; i < checkboxes.length; i++)
64 checkboxes[i].click();
66 new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
67 var deleteButtons = contentDocument.querySelectorAll('.destroy');
68 for (var i = 0; i < deleteButtons.length; i++)
69 deleteButtons[i].click();
75 name: 'Vanilla-ES2015-Babel-Webpack-TodoMVC',
76 url: 'todomvc/vanilla-examples/es2015-babel-webpack/dist/index.html',
77 prepare: function (runner, contentWindow, contentDocument) {
78 return runner.waitForElement('.new-todo').then(function (element) {
84 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
85 for (var i = 0; i < numberOfItemsToAdd; i++) {
86 newTodo.value = 'Something to do ' + i;
87 newTodo.dispatchEvent(new Event('change'));
88 triggerEnter(newTodo, 'keypress');
91 new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
92 var checkboxes = contentDocument.querySelectorAll('.toggle');
93 for (var i = 0; i < checkboxes.length; i++)
94 checkboxes[i].click();
96 new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
97 var deleteButtons = contentDocument.querySelectorAll('.destroy');
98 for (var i = 0; i < deleteButtons.length; i++)
99 deleteButtons[i].click();
105 name: 'React-TodoMVC',
106 url: 'todomvc/architecture-examples/react/index.html',
107 prepare: function (runner, contentWindow, contentDocument) {
108 contentWindow.app.Utils.store = function () {}
109 return runner.waitForElement('.new-todo').then(function (element) {
115 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
116 for (var i = 0; i < numberOfItemsToAdd; i++) {
117 newTodo.value = 'Something to do ' + i;
118 newTodo.dispatchEvent(new Event('input', {
122 triggerEnter(newTodo, 'keydown');
125 new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
126 var checkboxes = contentDocument.querySelectorAll('.toggle');
127 for (var i = 0; i < checkboxes.length; i++)
128 checkboxes[i].click();
130 new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
131 var deleteButtons = contentDocument.querySelectorAll('.destroy');
132 for (var i = 0; i < deleteButtons.length; i++)
133 deleteButtons[i].click();
139 name: 'React-Redux-TodoMVC',
140 url: 'todomvc/architecture-examples/react-redux/dist/index.html',
141 prepare: function (runner, contentWindow, contentDocument) {
142 return runner.waitForElement('.new-todo').then(function (element) {
148 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
149 for (var i = 0; i < numberOfItemsToAdd; i++) {
150 newTodo.value = 'Something to do ' + i;
151 triggerEnter(newTodo, 'keydown');
154 new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
155 var checkboxes = contentDocument.querySelectorAll('.toggle');
156 for (var i = 0; i < checkboxes.length; i++)
157 checkboxes[i].click();
159 new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
160 var deleteButtons = contentDocument.querySelectorAll('.destroy');
161 for (var i = 0; i < deleteButtons.length; i++)
162 deleteButtons[i].click();
168 name: 'EmberJS-TodoMVC',
169 url: 'todomvc/architecture-examples/emberjs/index.html',
170 prepare: function (runner, contentWindow, contentDocument) {
171 return runner.waitForElement('#new-todo').then(function (element) {
177 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
178 for (var i = 0; i < numberOfItemsToAdd; i++) {
179 newTodo.value = 'Something to do ' + i;
180 triggerEnter(newTodo, 'keydown');
183 new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
184 var checkboxes = contentDocument.querySelectorAll('.toggle');
185 for (var i = 0; i < checkboxes.length; i++)
186 checkboxes[i].click();
188 new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
189 var deleteButtons = contentDocument.querySelectorAll('.destroy');
190 for (var i = 0; i < deleteButtons.length; i++)
191 deleteButtons[i].click();
197 name: 'BackboneJS-TodoMVC',
198 url: 'todomvc/architecture-examples/backbone/index.html',
199 prepare: function (runner, contentWindow, contentDocument) {
200 contentWindow.Backbone.sync = function () {}
201 return runner.waitForElement('.new-todo').then(function (element) {
207 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
208 for (var i = 0; i < numberOfItemsToAdd; i++) {
209 newTodo.value = 'Something to do ' + i;
210 triggerEnter(newTodo, 'keypress');
213 new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
214 var checkboxes = contentDocument.querySelectorAll('.toggle');
215 for (var i = 0; i < checkboxes.length; i++)
216 checkboxes[i].click();
218 new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
219 var deleteButtons = contentDocument.querySelectorAll('.destroy');
220 for (var i = 0; i < deleteButtons.length; i++)
221 deleteButtons[i].click();
227 name: 'AngularJS-TodoMVC',
228 url: 'todomvc/architecture-examples/angularjs/index.html',
229 prepare: function (runner, contentWindow, contentDocument) {
230 return runner.waitForElement('#new-todo').then(function (element) {
236 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
237 var submitEvent = document.createEvent('Event');
238 submitEvent.initEvent('submit', true, true);
239 var inputEvent = document.createEvent('Event');
240 inputEvent.initEvent('input', true, true);
241 for (var i = 0; i < numberOfItemsToAdd; i++) {
242 newTodo.value = 'Something to do ' + i;
243 newTodo.dispatchEvent(inputEvent);
244 newTodo.form.dispatchEvent(submitEvent);
247 new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
248 var checkboxes = contentDocument.querySelectorAll('.toggle');
249 for (var i = 0; i < checkboxes.length; i++)
250 checkboxes[i].click();
252 new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
253 var deleteButtons = contentDocument.querySelectorAll('.destroy');
254 for (var i = 0; i < deleteButtons.length; i++)
255 deleteButtons[i].click();
261 name: 'Angular2-TypeScript-TodoMVC',
262 url: 'todomvc/architecture-examples/angular/dist/index.html',
263 prepare: function (runner, contentWindow, contentDocument) {
264 return runner.waitForElement('.new-todo').then(function (element) {
270 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
271 for (var i = 0; i < numberOfItemsToAdd; i++) {
272 newTodo.value = 'Something to do ' + i;
273 newTodo.dispatchEvent(new Event('input', {
277 triggerEnter(newTodo, 'keyup');
280 new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
281 var checkboxes = contentDocument.querySelectorAll('.toggle');
282 for (var i = 0; i < checkboxes.length; i++)
283 checkboxes[i].click();
285 new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
286 var deleteButtons = contentDocument.querySelectorAll('.destroy');
287 for (var i = 0; i < deleteButtons.length; i++)
288 deleteButtons[i].click();
294 name: 'VueJS-TodoMVC',
295 url: 'todomvc/architecture-examples/vuejs-cli/dist/index.html',
296 prepare: function (runner, contentWindow, contentDocument) {
297 return runner.waitForElement('.new-todo').then(function (element) {
303 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
304 for (var i = 0; i < numberOfItemsToAdd; i++) {
305 newTodo.value = 'Something to do ' + i;
306 newTodo.dispatchEvent(new Event('input', {
310 triggerEnter(newTodo, 'keyup');
313 new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
314 var checkboxes = contentDocument.querySelectorAll('.toggle');
315 for (var i = 0; i < checkboxes.length; i++)
316 checkboxes[i].click();
318 new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
319 var deleteButtons = contentDocument.querySelectorAll('.destroy');
320 for (var i = 0; i < deleteButtons.length; i++)
321 deleteButtons[i].click();
327 name: 'jQuery-TodoMVC',
328 url: 'todomvc/architecture-examples/jquery/index.html',
329 prepare: function (runner, contentWindow, contentDocument) {
330 return runner.waitForElement('#new-todo').then(function (element) {
336 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
337 for (var i = 0; i < numberOfItemsToAdd; i++) {
338 newTodo.value = 'Something to do ' + i;
339 triggerEnter(newTodo, 'keyup');
342 new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
343 var checkboxes = contentDocument.querySelectorAll('.toggle');
344 for (var i = 0; i < checkboxes.length; i++)
345 checkboxes[i].click();
347 new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
348 var deleteButtons = contentDocument.querySelectorAll('.destroy');
349 for (var i = 0; i < deleteButtons.length; i++)
350 deleteButtons[i].click();
356 name: 'Preact-TodoMVC',
357 url: 'todomvc/architecture-examples/preact/dist/index.html',
358 prepare: function (runner, contentWindow, contentDocument) {
359 return runner.waitForElement('.new-todo').then(function (element) {
365 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
366 for (var i = 0; i < numberOfItemsToAdd; i++) {
367 newTodo.value = 'Something to do ' + i;
368 triggerEnter(newTodo, 'keydown');
371 new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
372 var checkboxes = contentDocument.querySelectorAll('.toggle');
373 for (var i = 0; i < checkboxes.length; i++)
374 checkboxes[i].click();
376 new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
377 var deleteButtons = contentDocument.querySelectorAll('.destroy');
378 for (var i = 0; i < deleteButtons.length; i++)
379 deleteButtons[i].click();
385 name: 'Inferno-TodoMVC',
386 url: 'todomvc/architecture-examples/inferno/index.html',
387 prepare: function (runner, contentWindow, contentDocument) {
388 return runner.waitForElement('.new-todo').then(function (element) {
394 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
395 for (var i = 0; i < numberOfItemsToAdd; i++) {
396 newTodo.value = 'Something to do ' + i;
397 newTodo.dispatchEvent(new Event('change', {
401 triggerEnter(newTodo, 'keydown');
404 new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
405 var checkboxes = contentDocument.querySelectorAll('.toggle');
406 for (var i = 0; i < checkboxes.length; i++)
407 checkboxes[i].click();
409 new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
410 var deleteButtons = contentDocument.querySelectorAll('.destroy');
411 for (var i = 0; i < deleteButtons.length; i++)
412 deleteButtons[i].click();
419 url: 'todomvc/functional-prog-examples/elm/index.html',
420 prepare: function (runner, contentWindow, contentDocument) {
421 return runner.waitForElement('.new-todo').then(function (element) {
427 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
428 for (var i = 0; i < numberOfItemsToAdd; i++) {
429 newTodo.value = 'Something to do ' + i;
430 newTodo.dispatchEvent(new Event('input', {
434 triggerEnter(newTodo, 'keydown');
437 new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
438 var checkboxes = contentDocument.querySelectorAll('.toggle');
439 for (var i = 0; i < checkboxes.length; i++)
440 checkboxes[i].click();
442 new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
443 var deleteButtons = contentDocument.querySelectorAll('.destroy');
444 for (var i = 0; i < deleteButtons.length; i++)
445 deleteButtons[i].click();
451 name: 'Flight-TodoMVC',
452 url: 'todomvc/dependency-examples/flight/flight/index.html',
453 prepare: function (runner, contentWindow, contentDocument) {
454 return runner.waitForElement('#new-todo').then(function (element) {
460 new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
461 for (var i = 0; i < numberOfItemsToAdd; i++) {
462 newTodo.value = 'Something to do ' + i;
463 triggerEnter(newTodo, 'keydown');
466 new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
467 var checkboxes = contentDocument.querySelectorAll('.toggle');
468 for (var i = 0; i < checkboxes.length; i++)
469 checkboxes[i].click();
471 new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
472 var deleteButtons = contentDocument.querySelectorAll('.destroy');
473 for (var i = 0; i < deleteButtons.length; i++)
474 deleteButtons[i].click();
479 var actionCount = 50;
482 name: 'FlightJS-MailClient',
483 url: 'flightjs-example-app/index.html',
484 prepare: function (runner, contentWindow, contentDocument) {
485 return runner.waitForElement('.span8').then(function (element) {
491 new BenchmarkTestStep('OpeningTabs' + actionCount + 'Times', function (newTodo, contentWindow, contentDocument) {
492 contentDocument.getElementById('inbox').click();
493 for (var i = 0; i < actionCount; i++) {
494 contentDocument.getElementById('later').click();
495 contentDocument.getElementById('sent').click();
496 contentDocument.getElementById('trash').click();
497 contentDocument.getElementById('inbox').click();
500 new BenchmarkTestStep('MovingEmails' + actionCount + 'Times', function (newTodo, contentWindow, contentDocument) {
501 contentDocument.getElementById('inbox').click();
502 for (var i = 0; i < actionCount; i++) {
503 contentDocument.getElementById('mail_2139').click();
504 contentDocument.getElementById('move_mail').click();
505 contentDocument.querySelector('#move_to_selector #later').click();
506 contentDocument.getElementById('later').click();
507 contentDocument.getElementById('mail_2139').click();
508 contentDocument.getElementById('move_mail').click();
509 contentDocument.querySelector('#move_to_selector #trash').click();
510 contentDocument.getElementById('trash').click();
511 contentDocument.getElementById('mail_2139').click();
512 contentDocument.getElementById('move_mail').click();
513 contentDocument.querySelector('#move_to_selector #inbox').click();
514 contentDocument.getElementById('inbox').click();
517 new BenchmarkTestStep('Sending' + actionCount + 'NewEmails', function (newTodo, contentWindow, contentDocument) {
518 for (var i = 0; i < actionCount; i++) {
519 contentDocument.getElementById('new_mail').click();
520 contentDocument.getElementById('recipient_select').selectedIndex = 1;
521 var subject = contentDocument.getElementById('compose_subject');
522 var message = contentDocument.getElementById('compose_message');
524 contentWindow.$(subject).trigger('keydown');
525 contentWindow.$(subject).text('Hello');
527 contentWindow.$(message).trigger('keydown');
528 contentWindow.$(message).text('Hello,\n\nThis is a test message.\n\n- WebKitten');
529 contentDocument.getElementById('send_composed').click();