PromucFlow_constructor/app/client/perf/tests/select-widget.perf.js
Preet Sidhu 5726ed0919
chore: add perf test for select widget (#12409)
* wip

* add select widget perf test

* fudge cred

* Revert "fudge cred"

This reverts commit e2e78ed4c126c385b31ca03d9ea5834114849637.

* pr updates

* pr updates

* remove single test script

* remove coverage summary changes
2022-04-29 14:12:03 +05:30

49 lines
1.4 KiB
JavaScript

const path = require("path");
const Perf = require("../src/perf");
const { delay } = require("../src/utils/utils");
const { actions } = require("./actions");
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
const SEL = {
select_button: ".select-button",
options_list: ".menu-virtual-list",
first_option_item: ".menu-item-text:nth-child(1)",
};
async function testSelectOptionsRender() {
try {
const perf = new Perf();
await perf.launch();
const page = perf.getPage();
perf.importApplication(`${APP_ROOT}/tests/dsl/stress-select-widget.json`);
await delay(5000, "for newly created page to settle down");
await page.waitForSelector(SEL.select_button);
await perf.startTrace(actions.SELECT_WIDGET_MENU_OPEN);
await page.click(SEL.select_button);
await page.waitForSelector(SEL.options_list);
await delay(2000, "wait after opening options list");
await perf.stopTrace();
await perf.startTrace(actions.SELECT_WIDGET_SELECT_OPTION);
await page.click(SEL.first_option_item);
await delay(2000, "wait after selecting option item");
await perf.stopTrace();
await perf.generateReport();
await perf.close();
} catch (e) {
console.log(e);
}
}
async function runTests() {
await testSelectOptionsRender();
await testSelectOptionsRender();
await testSelectOptionsRender();
await testSelectOptionsRender();
await testSelectOptionsRender();
}
runTests();