Skip to content

Commit 0c6ce4b

Browse files
committed
Refactor benchmark test steps to use for...of loops
1 parent db40151 commit 0c6ce4b

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

resources/tests.mjs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,19 +1122,19 @@ Suites.push({
11221122

11231123
// Expand recipes
11241124
const showMoreBtn = iframeElement.querySelectorAllInShadowRoot(".show-more-btn", ["cooking-app", "main-content", "recipe-grid"]);
1125-
showMoreBtn.forEach((btn) => {
1125+
for (const btn of showMoreBtn) {
11261126
btn.click();
11271127
page.layout();
1128-
});
1128+
}
11291129
}),
11301130
new BenchmarkTestStep("ReduceWidthIn5Steps", async (page) => {
11311131
const iframeElement = page.querySelector("#content-iframe");
11321132
const widths = [768, 704, 640, 560, 480];
11331133

1134-
widths.forEach((width) => {
1134+
for (const width of widths) {
11351135
iframeElement.setWidth(`${width}px`);
11361136
page.layout();
1137-
});
1137+
}
11381138
}),
11391139
new BenchmarkTestStep("ScrollToChatAndSendMessages", async (page) => {
11401140
const iframeElement = page.querySelector("#content-iframe", [], true);
@@ -1150,10 +1150,10 @@ Suites.push({
11501150

11511151
// Collapse recipes
11521152
const showMoreBtn = iframeElement.querySelectorAllInShadowRoot(".show-more-btn", ["cooking-app", "main-content", "recipe-grid"]);
1153-
showMoreBtn.forEach((btn) => {
1153+
for (const btn of showMoreBtn) {
11541154
btn.click();
11551155
page.layout();
1156-
});
1156+
}
11571157

11581158
const element = iframeElement.querySelectorInShadowRoot("#chat-window", ["cooking-app", "chat-window"]);
11591159
element.scrollIntoView({ behavior: "instant" });
@@ -1162,21 +1162,21 @@ Suites.push({
11621162
const messagesToBeSent = ["Please generate an image of Tomato Soup.", "Try again, but make the soup look thicker.", "Try again, but make the soup served in a rustic bowl and include a sprinkle of fresh herbs on top."];
11631163

11641164
const chatInput = iframeElement.querySelectorInShadowRoot("#chat-input", ["cooking-app", "chat-window"]);
1165-
messagesToBeSent.forEach((message) => {
1165+
for (const message of messagesToBeSent) {
11661166
chatInput.setValue(message);
11671167
chatInput.dispatchEvent("input");
11681168
chatInput.enter("keydown");
11691169
page.layout();
1170-
});
1170+
}
11711171
}),
11721172
new BenchmarkTestStep("IncreaseWidthIn5Steps", async (page) => {
11731173
const iframeElement = page.querySelector("#content-iframe");
11741174
const widths = [560, 640, 704, 768, 800];
11751175

1176-
widths.forEach((width) => {
1176+
for (const width of widths) {
11771177
iframeElement.setWidth(`${width}px`);
11781178
page.layout();
1179-
});
1179+
}
11801180
}),
11811181
],
11821182
});

0 commit comments

Comments
 (0)