Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppeteer: Extend fill_form function to support dropdown menus.

Dinesh1feb2f4d0858
diff --git a/frontend_tests/puppeteer_lib/common.js b/frontend_tests/puppeteer_lib/common.js
index c09ecae3ad2..b992cdcd097 100644
--- a/frontend_tests/puppeteer_lib/common.js
+++ b/frontend_tests/puppeteer_lib/common.js
@@ -98,6 +98,9 @@ class CommonUtils {
* });
*/
async fill_form(page, form_selector, params) {
+ async function is_dropdown(page, name) {
+ return (await page.$(`select[name="${name}"]`)) !== null;
+ }
for (const name of Object.keys(params)) {
const name_selector = `${form_selector} [name="${name}"]`;
const value = params[name];
@@ -107,6 +110,8 @@ class CommonUtils {
el.click();
}
});
+ } else if (await is_dropdown(page, name)) {
+ await page.select(name_selector, params[name]);
} else {
// clear any existing text in the input field before filling.
await page.$eval(name_selector, (el) => {