Skip to content

Commit 38c8ee7

Browse files
committed
fix #1222
1 parent 7cdc2c6 commit 38c8ee7

File tree

6 files changed

+34
-4
lines changed

6 files changed

+34
-4
lines changed

webdriver-ts/src/benchmarksCommon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export const cpuBenchmarkInfosArray: Array<CPUBenchmarkInfo> = [
192192
id: Benchmark._08,
193193
label: "append rows to large table",
194194
description: (throttleCPU: number | undefined) =>
195-
"appending 1,000 to a table of 10,000 rows." + slowDownNote(throttleCPU),
195+
"appending 1,000 to a table of 1,000 rows." + slowDownNote(throttleCPU),
196196
type: BenchmarkType.CPU,
197197
allowBatching: true,
198198
layoutEventRequired: true,

webdriver-ts/src/benchmarksPlaywright.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ export const benchAppendToManyRows = new (class extends CPUBenchmarkPlaywright {
184184
}
185185
async init(browser: Browser, page: Page) {
186186
await checkElementExists(page, "#run");
187+
for (let i = 0; i < config.WARMUP_COUNT; i++) {
188+
await clickElement(page, "#run");
189+
await checkElementContainsText(page, "tbody>tr:nth-of-type(1)>td:nth-of-type(1)", (i*1000+1).toFixed());
190+
await clickElement(page, "#clear");
191+
await checkElementNotExists(page, "tbody>tr:nth-of-type(1000)>td:nth-of-type(1)");
192+
}
187193
await clickElement(page, "#run");
188194
await checkElementExists(page, "tbody>tr:nth-of-type(1000)>td:nth-of-type(1)");
189195
}

webdriver-ts/src/benchmarksPuppeteer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ export const benchAppendToManyRows = new (class extends CPUBenchmarkPuppeteer {
183183
}
184184
async init(page: Page) {
185185
await checkElementExists(page, "pierce/#run");
186+
for (let i = 0; i < config.WARMUP_COUNT; i++) {
187+
await clickElement(page, "pierce/#run");
188+
await checkElementContainsText(page, "pierce/tbody>tr:nth-of-type(1)>td:nth-of-type(1)", (i*1000+1).toFixed());
189+
await clickElement(page, "pierce/#clear");
190+
await checkElementNotExists(page, "pierce/tbody>tr:nth-of-type(1000)>td:nth-of-type(1)");
191+
}
186192
await clickElement(page, "pierce/#run");
187193
await checkElementExists(page, "pierce/tbody>tr:nth-of-type(1000)>td:nth-of-type(1)");
188194
}

webdriver-ts/src/benchmarksWebdriver.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,18 @@ export const benchAppendToManyRows = new (class extends CPUBenchmarkWebdriver {
175175
}
176176
async init(driver: WebDriver) {
177177
await testElementLocatedById(driver, "run", SHORT_TIMEOUT, true);
178+
for (let i = 0; i < config.WARMUP_COUNT; i++) {
179+
await clickElementById(driver, "run", true);
180+
await testTextContains(driver, "//tbody/tr[1]/td[1]", (i * 1000 + 1).toFixed(), config.TIMEOUT, false);
181+
await clickElementById(driver, "clear", true);
182+
await testElementNotLocatedByXPath(driver, "//tbody/tr[1]", config.TIMEOUT, false);
183+
}
178184
await clickElementById(driver, "run", true);
179185
await testElementLocatedByXpath(driver, "//tbody/tr[1000]/td[2]/a", config.TIMEOUT, false);
180186
}
181187
async run(driver: WebDriver) {
182188
await clickElementById(driver, "add", true);
183-
await testElementLocatedByXpath(driver, "//tbody/tr[1100]/td[2]/a", config.TIMEOUT, false);
189+
await testElementLocatedByXpath(driver, "//tbody/tr[2000]/td[2]/a", config.TIMEOUT, false);
184190
}
185191
})();
186192

webdriver-ts/src/benchmarksWebdriverAfterframe.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,18 @@ export const benchAppendToManyRows = new (class extends CPUBenchmarkWebdriver {
273273
}
274274
async init(driver: WebDriver) {
275275
await testElementLocatedById(driver, "run", SHORT_TIMEOUT, true);
276+
for (let i = 0; i < config.WARMUP_COUNT; i++) {
277+
await clickElementById(driver, "run", true);
278+
await testTextContains(driver, "//tbody/tr[1]/td[1]", (i * 1000 + 1).toFixed(), config.TIMEOUT, false);
279+
await clickElementById(driver, "clear", true);
280+
await testElementNotLocatedByXPath(driver, "//tbody/tr[1]", config.TIMEOUT, false);
281+
}
276282
await clickElementById(driver, "run", true);
277283
await testElementLocatedByXpath(driver, "//tbody/tr[1000]/td[2]/a", config.TIMEOUT, false);
278284
}
279285
async run(driver: WebDriver) {
280286
await measureClickElementById(driver, "add", true);
281-
await testElementLocatedByXpath(driver, "//tbody/tr[1100]/td[2]/a", config.TIMEOUT, false);
287+
await testElementLocatedByXpath(driver, "//tbody/tr[2000]/td[2]/a", config.TIMEOUT, false);
282288
}
283289
})();
284290

webdriver-ts/src/benchmarksWebdriverCDP.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,18 @@ export const benchAppendToManyRows = new (class extends CPUBenchmarkWebdriverCDP
175175
}
176176
async init(driver: WebDriver) {
177177
await testElementLocatedById(driver, "run", SHORT_TIMEOUT, true);
178+
for (let i = 0; i < config.WARMUP_COUNT; i++) {
179+
await clickElementById(driver, "run", true);
180+
await testTextContains(driver, "//tbody/tr[1]/td[1]", (i * 1000 + 1).toFixed(), config.TIMEOUT, false);
181+
await clickElementById(driver, "clear", true);
182+
await testElementNotLocatedByXPath(driver, "//tbody/tr[1]", config.TIMEOUT, false);
183+
}
178184
await clickElementById(driver, "run", true);
179185
await testElementLocatedByXpath(driver, "//tbody/tr[1000]/td[2]/a", config.TIMEOUT, false);
180186
}
181187
async run(driver: WebDriver) {
182188
await clickElementById(driver, "add", true);
183-
await testElementLocatedByXpath(driver, "//tbody/tr[1100]/td[2]/a", config.TIMEOUT, false);
189+
await testElementLocatedByXpath(driver, "//tbody/tr[2000]/td[2]/a", config.TIMEOUT, false);
184190
}
185191
})();
186192

0 commit comments

Comments
 (0)