2021-12-28 10:39:15 +00:00
|
|
|
const path = require("path");
|
2022-01-04 08:28:47 +00:00
|
|
|
const Perf = require("../src/perf.js");
|
2021-12-28 10:39:15 +00:00
|
|
|
const dsl = require("./dsl/simple-typing").dsl;
|
|
|
|
|
|
|
|
|
|
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
|
|
|
|
|
|
2022-07-15 09:10:45 +00:00
|
|
|
async function sampleTest(iteration) {
|
|
|
|
|
const perf = new Perf({ iteration });
|
|
|
|
|
try {
|
|
|
|
|
await perf.launch();
|
|
|
|
|
|
|
|
|
|
const page = perf.getPage();
|
|
|
|
|
await perf.loadDSL(dsl);
|
|
|
|
|
|
|
|
|
|
const selector = "input.bp3-input"; // Input selector
|
|
|
|
|
await page.waitForSelector(selector);
|
|
|
|
|
const input = await page.$(selector);
|
|
|
|
|
|
|
|
|
|
await perf.startTrace("Edit input");
|
|
|
|
|
await page.type(selector, "Hello Appsmith");
|
|
|
|
|
await perf.stopTrace();
|
|
|
|
|
|
|
|
|
|
await perf.startTrace("Clear input");
|
|
|
|
|
await input.click({ clickCount: 3 });
|
|
|
|
|
await input.press("Backspace");
|
|
|
|
|
await perf.stopTrace();
|
|
|
|
|
|
|
|
|
|
await perf.startTrace("Edit input again");
|
|
|
|
|
await page.type(selector, "Howdy satish");
|
|
|
|
|
await perf.stopTrace();
|
|
|
|
|
|
|
|
|
|
await perf.generateReport();
|
|
|
|
|
await perf.close();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
await perf.handleRejections(e);
|
|
|
|
|
await perf.close();
|
|
|
|
|
}
|
2021-12-28 10:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function runTests() {
|
2022-07-15 09:10:45 +00:00
|
|
|
for (let i = 0; i < 5; i++) {
|
|
|
|
|
await sampleTest(i + 1);
|
|
|
|
|
}
|
2021-12-28 10:39:15 +00:00
|
|
|
}
|
2022-07-15 09:10:45 +00:00
|
|
|
|
2021-12-28 10:39:15 +00:00
|
|
|
runTests();
|