-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmark.js
More file actions
31 lines (25 loc) · 1000 Bytes
/
benchmark.js
File metadata and controls
31 lines (25 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const puppeteer = require("puppeteer");
const SECONDES = 1000;
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await page.goto("http://localhost:5000");
await page.evaluate(index => {
let cells = Array.from(document.querySelectorAll(".cell"));
function getRand(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
cells = [...cells].filter(node => node.className === "cell");
cells[getRand(0, 9)].click();
cells = [...cells].filter(node => node.className === "cell");
cells[getRand(0, 7)].click();
cells = [...cells].filter(node => node.className === "cell");
cells[getRand(0, 5)].click();
cells = [...cells].filter(node => node.className === "cell");
cells[getRand(0, 3)].click();
cells = [...cells].filter(node => node.className === "cell");
cells[getRand(0, 1)].click();
});
})();