diff --git a/index.html b/index.html index 5fc218ab8..b48a43735 100644 --- a/index.html +++ b/index.html @@ -81,6 +81,14 @@

Score

Detailed Results

+
+

Non-standard Parameters

+

+ Speedometer ran with non-standard parameters.
+ The results are likely not comparable to default runs. +

+
+

Aggregate Metric

diff --git a/resources/developer-mode.mjs b/resources/developer-mode.mjs index 0d1f7fd76..31422907c 100644 --- a/resources/developer-mode.mjs +++ b/resources/developer-mode.mjs @@ -22,6 +22,7 @@ export function createDeveloperModeContainer() { settings.append(createUIForWarmupSuite()); settings.append(createUIForWarmupBeforeSync()); settings.append(createUIForSyncStepDelay()); + settings.append(createUIForComplexity()); content.append(document.createElement("hr")); content.append(settings); @@ -101,11 +102,21 @@ function createUIForSyncStepDelay() { return label; } -function createTimeRangeUI(labelText, initialValue, unit = "ms", min = 0, max = 1000) { +function createUIForComplexity() { + const { range, label } = createTimeRangeUI("Relative complexity", params.complexity, "x", 0, 10, 0.01); + range.onchange = () => { + params.complexity = Number(range.value); + updateURL(); + }; + return label; +} + +function createTimeRangeUI(labelText, initialValue, unit = "ms", min = 0, max = 1000, step = 1) { const range = document.createElement("input"); range.type = "range"; range.min = min; range.max = max; + range.step = step; range.value = initialValue; const rangeValueAndUnit = document.createElement("span"); @@ -280,7 +291,7 @@ function updateURL() { } } - const defaultParamKeys = ["measurementMethod", "iterationCount", "useWarmupSuite", "warmupBeforeSync", "waitBeforeSync"]; + const defaultParamKeys = ["measurementMethod", "iterationCount", "useWarmupSuite", "warmupBeforeSync", "waitBeforeSync", "complexity"]; for (const paramKey of defaultParamKeys) { if (params[paramKey] !== defaultParams[paramKey]) url.searchParams.set(paramKey, params[paramKey]); diff --git a/resources/main.css b/resources/main.css index 04dd9ff0c..47ff5dc3e 100644 --- a/resources/main.css +++ b/resources/main.css @@ -496,6 +496,40 @@ section#instructions .section-content > * { flex-direction: column; } +section#details h1 { + margin-bottom: 10px; +} + +section#details .non-standard-params { + display: none; + text-align: center; + margin-bottom: 2em; +} + +section#details .non-standard-params h2 { + color: var(--highlight); +} + +#non-standard-params-table { + border-collapse: collapse; + text-align: left; + display: inline-block; +} +#non-standard-params-table tr { + padding: 2px; +} + +#non-standard-params-table thead th { + border-bottom: 1px solid var(--foreground); + padding: 0.1em 0.2em; +} + +#non-standard-params-table tbody th { + font-weight: normal; + text-align: left; + padding: 0.1em 0.2em; +} + section#details .all-metric-results { flex: auto; overflow-y: auto; @@ -513,10 +547,6 @@ section#details .arithmetic-mean > label { margin-right: 10px; } -section#details h1 { - margin-bottom: 10px; -} - section#details .metric { margin: 0px 0 10px 0; display: inline-block; diff --git a/resources/main.mjs b/resources/main.mjs index 76b756449..0ef874ebb 100644 --- a/resources/main.mjs +++ b/resources/main.mjs @@ -2,7 +2,7 @@ import { BenchmarkRunner } from "./benchmark-runner.mjs"; import * as Statistics from "./statistics.mjs"; import { Suites } from "./tests.mjs"; import { renderMetricView } from "./metric-ui.mjs"; -import { params } from "./params.mjs"; +import { defaultParams, params } from "./params.mjs"; import { createDeveloperModeContainer } from "./developer-mode.mjs"; // FIXME(camillobruni): Add base class @@ -245,6 +245,7 @@ class MainBenchmarkClient { } _populateDetailedResults(metrics) { + this._populateNonStandardParams(); const trackHeight = 24; document.documentElement.style.setProperty("--metrics-line-height", `${trackHeight}px`); const plotWidth = (params.viewport.width - 120) / 2; @@ -292,6 +293,34 @@ class MainBenchmarkClient { csvLink.setAttribute("download", `${filePrefix}.csv`); } + _populateNonStandardParams() { + if (params === defaultParams) + return; + const paramsDiff = []; + const usedSearchparams = params.toSearchParams(); + const defaultSearchParams = defaultParams.toSearchParams(); + for (const [key, value] of usedSearchparams.entries()) { + const defaultValue = defaultSearchParams.get(key); + if (value !== defaultValue) + paramsDiff.push({ key, value, defaultValue }); + } + if (paramsDiff.length === 0) + return; + let body = ""; + for (const { key, value, defaultValue } of paramsDiff) + body += `${key}${value}${defaultValue}`; + const table = document.getElementById("non-standard-params-table"); + table.innerHTML = ` + + Param + Value + Default + + + ${body}`; + document.querySelector(".non-standard-params").style.display = "block"; + } + prepareUI() { window.addEventListener("hashchange", this._hashChangeHandler.bind(this)); window.addEventListener("resize", this._resizeScreeHandler.bind(this)); diff --git a/resources/params.mjs b/resources/params.mjs index d3005fed1..dc4575829 100644 --- a/resources/params.mjs +++ b/resources/params.mjs @@ -25,6 +25,10 @@ class Params { // "generate": generate a random seed // : use the provided integer as a seed shuffleSeed = "off"; + // Param to tweak the relative complexity of all suites. + // The default is 1.0, and for suites supporting this param, the duration + // roughly scales wit the complexity. + complexity = 1.0; constructor(searchParams = undefined) { if (searchParams) @@ -35,8 +39,15 @@ class Params { } } - _parseInt(value, errorMessage) { + _parseNumber(value, errorMessage) { const number = Number(value); + if (!Number.isFinite(number) && errorMessage) + throw new Error(`Invalid ${errorMessage} param: '${value}', expected Number.`); + return number; + } + + _parseInt(value, errorMessage) { + const number = this._parseNumber(value); if (!Number.isInteger(number) && errorMessage) throw new Error(`Invalid ${errorMessage} param: '${value}', expected int.`); return parseInt(number); @@ -122,6 +133,13 @@ class Params { searchParams.delete("shuffleSeed"); } + if (searchParams.has("complexity")) { + this.complexity = this._parseNumber(searchParams.get("complexity")); + if (this.complexity <= 0) + throw new Error(`Invalid complexity value: ${this.complexity}, must be > 0.0`); + searchParams.delete("complexity"); + } + const unused = Array.from(searchParams.keys()); if (unused.length > 0) console.error("Got unused search params", unused); @@ -130,18 +148,20 @@ class Params { toSearchParams() { const rawParams = { ...this }; rawParams["viewport"] = `${this.viewport.width}x${this.viewport.height}`; - return new URLSearchParams(rawParams).toString(); + return new URLSearchParams(rawParams); } } export const defaultParams = new Params(); -const searchParams = new URLSearchParams(window.location.search); -let maybeCustomParams = new Params(); -try { - maybeCustomParams = new Params(searchParams); -} catch (e) { - console.error("Invalid URL Param", e, "\nUsing defaults as fallback:", maybeCustomParams); - alert(`Invalid URL Param: ${e}`); +let maybeCustomParams = defaultParams; +if (window.location.search) { + const searchParams = new URLSearchParams(window.location.search); + try { + maybeCustomParams = new Params(searchParams); + } catch (e) { + console.error("Invalid URL Param", e, "\nUsing defaults as fallback:", maybeCustomParams); + alert(`Invalid URL Param: ${e}`); + } } export const params = maybeCustomParams; diff --git a/resources/tests.mjs b/resources/tests.mjs index 66eabae11..7053e154d 100644 --- a/resources/tests.mjs +++ b/resources/tests.mjs @@ -1,9 +1,14 @@ import { BenchmarkTestStep } from "./benchmark-runner.mjs"; import { todos } from "./translations.mjs"; +import { params } from "./params.mjs"; -const numberOfItemsToAdd = 100; +const defaultNumberOfItemsToAdd = 100; const defaultLanguage = "en"; +function getNumberOfItemsToAdd() { + return defaultNumberOfItemsToAdd * params.complexity; +} + function getTodoText(lang, index) { const todosSelection = todos[lang] ?? todos[defaultLanguage]; const currentIndex = index % todosSelection.length; @@ -66,7 +71,8 @@ Suites.push({ page.getLocalStorage().getItem("javascript-es5"); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText("ja", i)); @@ -75,11 +81,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -96,7 +104,8 @@ Suites.push({ await page.waitForElement("todo-app"); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const input = page.querySelector(".new-todo-input", ["todo-app", "todo-topbar"]); for (let i = 0; i < numberOfItemsToAdd; i++) { input.setValue(getTodoText("emoji", i)); @@ -105,6 +114,7 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const items = page.querySelectorAll("todo-item", ["todo-app", "todo-list"]); for (let i = 0; i < numberOfItemsToAdd; i++) { const item = items[i].querySelectorInShadowRoot(".toggle-todo-input"); @@ -112,6 +122,7 @@ Suites.push({ } }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const items = page.querySelectorAll("todo-item", ["todo-app", "todo-list"]); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) { const item = items[i].querySelectorInShadowRoot(".remove-todo-button"); @@ -129,7 +140,8 @@ Suites.push({ (await page.waitForElement(".new-todo")).focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText("ja", i)); @@ -138,11 +150,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -159,7 +173,8 @@ Suites.push({ (await page.waitForElement(".new-todo")).focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText("ja", i)); @@ -168,11 +183,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -190,7 +207,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText("ru", i)); @@ -199,11 +217,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -220,7 +240,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText("ru", i)); @@ -229,11 +250,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -249,7 +272,8 @@ Suites.push({ await page.waitForElement("todo-app"); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const input = page.querySelector(".new-todo-input", ["todo-app", "todo-topbar"]); for (let i = 0; i < numberOfItemsToAdd; i++) { input.setValue(getTodoText(defaultLanguage, i)); @@ -258,6 +282,7 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const items = page.querySelectorAll("todo-item", ["todo-app", "todo-list"]); for (let i = 0; i < numberOfItemsToAdd; i++) { const item = items[i].querySelectorInShadowRoot(".toggle-todo-input"); @@ -265,6 +290,7 @@ Suites.push({ } }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const items = page.querySelectorAll("todo-item", ["todo-app", "todo-list"]); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) { const item = items[i].querySelectorInShadowRoot(".remove-todo-button"); @@ -283,7 +309,8 @@ Suites.push({ await page.waitForElement("todo-app"); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const input = page.querySelector(".new-todo-input", ["todo-app", "todo-topbar"]); for (let i = 0; i < numberOfItemsToAdd; i++) { input.setValue(getTodoText(defaultLanguage, i)); @@ -292,6 +319,7 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const items = page.querySelectorAll("todo-item", ["todo-app", "todo-list"]); for (let i = 0; i < numberOfItemsToAdd; i++) { const item = items[i].querySelectorInShadowRoot(".toggle-todo-input"); @@ -299,6 +327,7 @@ Suites.push({ } }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const items = page.querySelectorAll("todo-item", ["todo-app", "todo-list"]); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) { const item = items[i].querySelectorInShadowRoot(".remove-todo-button"); @@ -318,7 +347,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -327,11 +357,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -348,7 +380,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -357,11 +390,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -378,7 +413,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -386,11 +422,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -408,7 +446,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -416,11 +455,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -438,7 +479,8 @@ Suites.push({ newTodo.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -447,11 +489,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -470,7 +514,8 @@ Suites.push({ newTodo.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -479,11 +524,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -501,7 +548,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -510,11 +558,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -531,7 +581,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -540,11 +591,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -561,7 +614,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -570,11 +624,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -592,7 +648,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -601,11 +658,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -623,7 +682,8 @@ Suites.push({ newTodo.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -631,10 +691,12 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); for (let i = 1; i <= numberOfItemsToAdd; i++) page.querySelector(`li:nth-child(${i}) .toggle`).click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) page.querySelector(".destroy").click(); }), @@ -652,7 +714,8 @@ Suites.push({ newTodo.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -660,10 +723,12 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { - for (let i = 1; i <= numberOfItemsToAdd; i++) + const numberOfItemsToAdd = getNumberOfItemsToAdd(); + for (let i = 1; i <= numberOfItemsToAdd(); i++) page.querySelector(`li:nth-child(${i}) .toggle`).click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) page.querySelector(".destroy").click(); }), @@ -680,7 +745,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -688,11 +754,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -709,7 +777,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -717,11 +786,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -739,7 +810,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -747,11 +819,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -768,7 +842,8 @@ Suites.push({ element.focus(); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo"); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -776,11 +851,13 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const checkboxes = page.querySelectorAll(".toggle"); for (let i = 0; i < numberOfItemsToAdd; i++) checkboxes[i].click(); }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const deleteButtons = page.querySelectorAll(".destroy"); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) deleteButtons[i].click(); @@ -797,7 +874,8 @@ Suites.push({ await page.waitForElement("todo-app"); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo", ["todo-app", "todo-form"]); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -805,6 +883,7 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const todoItems = page.querySelectorAll("todo-item", ["todo-app", "todo-list"]); for (let i = 0; i < numberOfItemsToAdd; i++) { const checkbox = todoItems[i].querySelectorInShadowRoot(".toggle"); @@ -812,6 +891,7 @@ Suites.push({ } }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const todoItems = page.querySelectorAll("todo-item", ["todo-app", "todo-list"]); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) { const deleteButton = todoItems[i].querySelectorInShadowRoot(".destroy"); @@ -829,7 +909,8 @@ Suites.push({ await page.waitForElement("todo-app"); }, tests: [ - new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => { + new BenchmarkTestStep("AddingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const newTodo = page.querySelector(".new-todo", ["todo-app", "todo-form"]); for (let i = 0; i < numberOfItemsToAdd; i++) { newTodo.setValue(getTodoText(defaultLanguage, i)); @@ -837,6 +918,7 @@ Suites.push({ } }), new BenchmarkTestStep("CompletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const todoItems = page.querySelectorAll("todo-item", ["todo-app", "todo-list"]); for (let i = 0; i < numberOfItemsToAdd; i++) { const checkbox = todoItems[i].querySelectorInShadowRoot(".toggle"); @@ -844,6 +926,7 @@ Suites.push({ } }), new BenchmarkTestStep("DeletingAllItems", (page) => { + const numberOfItemsToAdd = getNumberOfItemsToAdd(); const todoItems = page.querySelectorAll("todo-item", ["todo-app", "todo-list"]); for (let i = numberOfItemsToAdd - 1; i >= 0; i--) { const deleteButton = todoItems[i].querySelectorInShadowRoot(".destroy");