Merge the speedometer2.1-content branch with the latest main branch to get the new developer-menu.
655 lines
27 KiB
JavaScript
655 lines
27 KiB
JavaScript
import { BenchmarkTestStep } from "./benchmark-runner.mjs";
|
|
import { todos } from "./translations.mjs";
|
|
|
|
const numberOfItemsToAdd = 100;
|
|
const defaultLanguage = "en";
|
|
|
|
function getTodoText(lang, index) {
|
|
const todosSelection = todos[lang] ?? todos[defaultLanguage];
|
|
const currentIndex = index % todosSelection.length;
|
|
return todosSelection[currentIndex];
|
|
}
|
|
|
|
export const Suites = [];
|
|
const ENTER_KEY_CODE = 13;
|
|
|
|
Suites.enable = function (names, tags) {
|
|
if (names?.length) {
|
|
const lowerCaseNames = names.map((each) => each.toLowerCase());
|
|
this.forEach((suite) => {
|
|
if (lowerCaseNames.includes(suite.name.toLowerCase()))
|
|
suite.disabled = false;
|
|
else
|
|
suite.disabled = true;
|
|
});
|
|
} else if (tags?.length) {
|
|
tags.forEach((tag) => {
|
|
if (!Tags.has(tag))
|
|
console.error(`Unknown Suites tag: "${tag}"`);
|
|
});
|
|
const tagsSet = new Set(tags);
|
|
this.forEach((suite) => {
|
|
suite.disabled = !suite.tags.some((tag) => tagsSet.has(tag));
|
|
});
|
|
} else {
|
|
console.warn("Neither names nor tags provided. Enabling all default suites.");
|
|
this.forEach((suite) => {
|
|
suite.disabled = !("default" in suite.tags);
|
|
});
|
|
}
|
|
if (this.some((suite) => !suite.disabled))
|
|
return;
|
|
let message, debugInfo;
|
|
if (names?.length) {
|
|
message = `Suites "${names}" does not match any Suite. No tests to run.`;
|
|
debugInfo = {
|
|
providedNames: names,
|
|
validNames: this.map((each) => each.name),
|
|
};
|
|
} else if (tags?.length) {
|
|
message = `Tags "${tags}" does not match any Suite. No tests to run.`;
|
|
debugInfo = {
|
|
providedTags: tags,
|
|
validTags: Array.from(Tags),
|
|
};
|
|
}
|
|
alert(message);
|
|
console.error(message, debugInfo);
|
|
};
|
|
|
|
const triggerEnter = function (element, type) {
|
|
var event = document.createEvent('Events');
|
|
event.initEvent(type, true, true);
|
|
event.keyCode = ENTER_KEY_CODE;
|
|
event.which = ENTER_KEY_CODE;
|
|
event.key = 'ENTER';
|
|
element.dispatchEvent(event);
|
|
}
|
|
|
|
Suites.push({
|
|
name: 'VanillaJS-TodoMVC',
|
|
url: 'todomvc/vanilla-examples/vanillajs/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('.new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
newTodo.dispatchEvent(new Event('change'));
|
|
triggerEnter(newTodo, 'keypress');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < deleteButtons.length; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'Vanilla-ES2015-TodoMVC',
|
|
url: 'todomvc/vanilla-examples/es2015/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('.new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
newTodo.dispatchEvent(new Event('change'));
|
|
triggerEnter(newTodo, 'keypress');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < deleteButtons.length; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'Vanilla-ES2015-Babel-Webpack-TodoMVC',
|
|
url: 'todomvc/vanilla-examples/es2015-babel-webpack/dist/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('.new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
newTodo.dispatchEvent(new Event('change'));
|
|
triggerEnter(newTodo, 'keypress');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < deleteButtons.length; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'React-TodoMVC',
|
|
url: 'todomvc/architecture-examples/react/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
contentWindow.app.Utils.store = function () {}
|
|
return runner.waitForElement('.new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
newTodo.dispatchEvent(new Event('input', {
|
|
bubbles: true,
|
|
cancelable: true
|
|
}));
|
|
triggerEnter(newTodo, 'keydown');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < deleteButtons.length; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'React-Redux-TodoMVC',
|
|
url: 'todomvc/architecture-examples/react-redux/dist/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('.new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
triggerEnter(newTodo, 'keydown');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < deleteButtons.length; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'EmberJS-TodoMVC',
|
|
url: 'todomvc/architecture-examples/emberjs/dist/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('#new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
triggerEnter(newTodo, 'keydown');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < deleteButtons.length; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'EmberJS-Debug-TodoMVC',
|
|
url: 'todomvc/architecture-examples/emberjs-debug/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('#new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
triggerEnter(newTodo, 'keydown');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < deleteButtons.length; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'BackboneJS-TodoMVC',
|
|
url: 'todomvc/architecture-examples/backbone/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
contentWindow.Backbone.sync = function () {}
|
|
return runner.waitForElement('#appIsReady').then(function (element) {
|
|
var newTodo = contentDocument.querySelector('.new-todo');
|
|
newTodo.focus();
|
|
return newTodo;
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
triggerEnter(newTodo, 'keypress');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < numberOfItemsToAdd; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < numberOfItemsToAdd; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'AngularJS-TodoMVC',
|
|
url: 'todomvc/architecture-examples/angularjs/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('#new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
var submitEvent = document.createEvent('Event');
|
|
submitEvent.initEvent('submit', true, true);
|
|
var inputEvent = document.createEvent('Event');
|
|
inputEvent.initEvent('input', true, true);
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
newTodo.dispatchEvent(inputEvent);
|
|
newTodo.form.dispatchEvent(submitEvent);
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++)
|
|
contentDocument.querySelector('.destroy').click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'Angular2-TypeScript-TodoMVC',
|
|
url: 'todomvc/architecture-examples/angular/dist/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('.new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
newTodo.dispatchEvent(new Event('input', {
|
|
bubbles: true,
|
|
cancelable: true
|
|
}));
|
|
triggerEnter(newTodo, 'keyup');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < deleteButtons.length; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'VueJS-TodoMVC',
|
|
url: 'todomvc/architecture-examples/vuejs-cli/dist/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('.new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
newTodo.dispatchEvent(new Event('input', {
|
|
bubbles: true,
|
|
cancelable: true
|
|
}));
|
|
triggerEnter(newTodo, 'keyup');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < deleteButtons.length; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'jQuery-TodoMVC',
|
|
url: 'todomvc/architecture-examples/jquery/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('#appIsReady').then(function (element) {
|
|
var newTodo = contentDocument.getElementById('new-todo');
|
|
newTodo.focus();
|
|
return newTodo;
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
triggerEnter(newTodo, 'keyup');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.getElementsByClassName('toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++)
|
|
contentDocument.querySelector('.destroy').click();
|
|
}),
|
|
]
|
|
})
|
|
|
|
Suites.push({
|
|
name: 'Preact-TodoMVC',
|
|
url: 'todomvc/architecture-examples/preact/dist/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('.new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
triggerEnter(newTodo, 'keydown');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < deleteButtons.length; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'Inferno-TodoMVC',
|
|
url: 'todomvc/architecture-examples/inferno/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('.new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
newTodo.dispatchEvent(new Event('change', {
|
|
bubbles: true,
|
|
cancelable: true
|
|
}));
|
|
triggerEnter(newTodo, 'keydown');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < numberOfItemsToAdd; i++)
|
|
contentDocument.querySelector('.destroy').click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
function processElmWorkQueue(contentWindow)
|
|
{
|
|
contentWindow.elmWork();
|
|
var callbacks = contentWindow.rAFCallbackList;
|
|
var i = 0;
|
|
while (i < callbacks.length) {
|
|
callbacks[i]();
|
|
i++;
|
|
}
|
|
contentWindow.rAFCallbackList = [];
|
|
}
|
|
|
|
Suites.push({
|
|
name: 'Elm-TodoMVC',
|
|
url: 'todomvc/functional-prog-examples/elm/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('.new-todo').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
newTodo.dispatchEvent(new Event('input', {
|
|
bubbles: true,
|
|
cancelable: true
|
|
}));
|
|
processElmWorkQueue(contentWindow);
|
|
triggerEnter(newTodo, 'keydown');
|
|
processElmWorkQueue(contentWindow);
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++) {
|
|
checkboxes[i].click();
|
|
processElmWorkQueue(contentWindow);
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
contentDocument.querySelector('.destroy').click();
|
|
processElmWorkQueue(contentWindow);
|
|
}
|
|
}),
|
|
]
|
|
});
|
|
|
|
Suites.push({
|
|
name: 'Flight-TodoMVC',
|
|
url: 'todomvc/dependency-examples/flight/flight/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('#appIsReady').then(function (element) {
|
|
var newTodo = contentDocument.getElementById('new-todo');
|
|
newTodo.focus();
|
|
return newTodo;
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('Adding' + numberOfItemsToAdd + 'Items', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < numberOfItemsToAdd; i++) {
|
|
newTodo.value = 'Something to do ' + i;
|
|
triggerEnter(newTodo, 'keydown');
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
|
|
var checkboxes = contentDocument.querySelectorAll('.toggle');
|
|
for (var i = 0; i < checkboxes.length; i++)
|
|
checkboxes[i].click();
|
|
}),
|
|
new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
|
|
var deleteButtons = contentDocument.querySelectorAll('.destroy');
|
|
for (var i = 0; i < deleteButtons.length; i++)
|
|
deleteButtons[i].click();
|
|
}),
|
|
]
|
|
});
|
|
|
|
var actionCount = 50;
|
|
Suites.push({
|
|
disabled: true,
|
|
name: 'FlightJS-MailClient',
|
|
url: 'flightjs-example-app/index.html',
|
|
prepare: function (runner, contentWindow, contentDocument) {
|
|
return runner.waitForElement('.span8').then(function (element) {
|
|
element.focus();
|
|
return element.domNode();
|
|
});
|
|
},
|
|
tests: [
|
|
new BenchmarkTestStep('OpeningTabs' + actionCount + 'Times', function (newTodo, contentWindow, contentDocument) {
|
|
contentDocument.getElementById('inbox').click();
|
|
for (var i = 0; i < actionCount; i++) {
|
|
contentDocument.getElementById('later').click();
|
|
contentDocument.getElementById('sent').click();
|
|
contentDocument.getElementById('trash').click();
|
|
contentDocument.getElementById('inbox').click();
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('MovingEmails' + actionCount + 'Times', function (newTodo, contentWindow, contentDocument) {
|
|
contentDocument.getElementById('inbox').click();
|
|
for (var i = 0; i < actionCount; i++) {
|
|
contentDocument.getElementById('mail_2139').click();
|
|
contentDocument.getElementById('move_mail').click();
|
|
contentDocument.querySelector('#move_to_selector #later').click();
|
|
contentDocument.getElementById('later').click();
|
|
contentDocument.getElementById('mail_2139').click();
|
|
contentDocument.getElementById('move_mail').click();
|
|
contentDocument.querySelector('#move_to_selector #trash').click();
|
|
contentDocument.getElementById('trash').click();
|
|
contentDocument.getElementById('mail_2139').click();
|
|
contentDocument.getElementById('move_mail').click();
|
|
contentDocument.querySelector('#move_to_selector #inbox').click();
|
|
contentDocument.getElementById('inbox').click();
|
|
}
|
|
}),
|
|
new BenchmarkTestStep('Sending' + actionCount + 'NewEmails', function (newTodo, contentWindow, contentDocument) {
|
|
for (var i = 0; i < actionCount; i++) {
|
|
contentDocument.getElementById('new_mail').click();
|
|
contentDocument.getElementById('recipient_select').selectedIndex = 1;
|
|
var subject = contentDocument.getElementById('compose_subject');
|
|
var message = contentDocument.getElementById('compose_message');
|
|
subject.focus();
|
|
contentWindow.$(subject).trigger('keydown');
|
|
contentWindow.$(subject).text('Hello');
|
|
message.focus();
|
|
contentWindow.$(message).trigger('keydown');
|
|
contentWindow.$(message).text('Hello,\n\nThis is a test message.\n\n- WebKitten');
|
|
contentDocument.getElementById('send_composed').click();
|
|
}
|
|
}),
|
|
]
|
|
});
|
|
|
|
Object.freeze(Suites);
|
|
Suites.forEach((suite) => {
|
|
if (!suite.tags)
|
|
suite.tags = [];
|
|
if (suite.url.startsWith("tentative/"))
|
|
suite.tags.unshift("all", "tentative");
|
|
else if (suite.disabled)
|
|
suite.tags.unshift("all");
|
|
else
|
|
suite.tags.unshift("all", "default");
|
|
Object.freeze(suite.tags);
|
|
Object.freeze(suite.steps);
|
|
});
|
|
|
|
export const Tags = new Set(["all", "default", "tentative", ...Suites.flatMap((suite) => suite.tags)]);
|
|
Object.freeze(Tags);
|
|
|
|
globalThis.Suites = Suites;
|
|
globalThis.Tags = Tags;
|