Skip to content

Commit 00651bc

Browse files
committed
Add benchmark steps
1 parent 7848e76 commit 00651bc

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

resources/tests.mjs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,50 @@ Suites.push({
304304
],
305305
});
306306

307+
Suites.push({
308+
name: "TodoMVC-React-18",
309+
url: "tentative/todomvc-react-18/dist",
310+
tags: ["todomvc", "tentative"],
311+
async prepare(page) {
312+
const element = await page.waitForElement("input[name=todoText]");
313+
element.focus();
314+
},
315+
316+
tests: [
317+
new BenchmarkTestStep("AddingLotsOfItems", (page) => {
318+
const button = page.querySelector(".add-lots-of-items-button");
319+
button.click();
320+
}),
321+
new BenchmarkTestStep("CompletingSomeItems", (page) => {
322+
const checkboxes = page.querySelectorAll("input[type='checkbox']");
323+
324+
// We'll be checking 5 checkboxes, in different parts of the list.
325+
const nbCheckboxesToCheck = 20;
326+
const steps = checkboxes.length / nbCheckboxesToCheck;
327+
328+
for (let i = 0; i < nbCheckboxesToCheck; i++)
329+
checkboxes.at(i * steps).click();
330+
}),
331+
new BenchmarkTestStep("Switching to seeing only pending items", (page) => {
332+
const link = page.querySelector("a[href$=active]");
333+
link.click();
334+
}),
335+
new BenchmarkTestStep("Switching to seeing all items again", (page) => {
336+
const link = page.querySelector("a[href$='/']");
337+
link.click();
338+
}),
339+
new BenchmarkTestStep("Removing completed items", (page) => {
340+
const button = page.querySelector("form[action$=removeCompleted] > button[type=submit]");
341+
button.click();
342+
}),
343+
new BenchmarkTestStep("DeletingAllItems", (page) => {
344+
const deleteButtons = page.querySelectorAll("button[aria-label=remove]");
345+
for (let i = deleteButtons.length - 1; i >= 0; i--)
346+
deleteButtons[i].click();
347+
}),
348+
],
349+
});
350+
307351
Suites.push({
308352
name: "TodoMVC-React-Redux",
309353
url: "todomvc/architecture-examples/react-redux/dist/index.html",

0 commit comments

Comments
 (0)