Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
puppeteer: Fix flake with compose box input.
Priyank Pateldda7e938f48d
diff --git a/frontend_tests/puppeteer_lib/common.js b/frontend_tests/puppeteer_lib/common.jsindex effc36d9eba..c09ecae3ad2 100644--- a/frontend_tests/puppeteer_lib/common.js+++ b/frontend_tests/puppeteer_lib/common.js@@ -12,8 +12,24 @@ class CommonUtils {this.realm_url = "http://zulip.zulipdev.com:9981/";this.pm_recipient = {async set(page, recipient) {- await page.type("#private_message_recipient", recipient);- await page.keyboard.press("Enter");+ // Without using the delay option here there seems to be+ // a flake where the typeahead doesn't show up.+ await page.type("#private_message_recipient", recipient, {delay: 100});++ // We use jQuery here because we need to use it's :visible+ // pseudo selector to actually wait for typeahead item that+ // is visible; there can be typeahead item with this selector+ // that is invisible because it is meant for something else+ // e.g. private message input typeahead is diffrent from topic+ // input typeahead but both can be present in the dom.+ await page.waitForFunction(() => {+ const selector = ".typeahead-menu .active a:visible";+ return $(selector).length !== 0;+ });++ await page.evaluate(() => {+ $(".typeahead-menu .active a:visible").click();+ });},async expect(page, expected) {diff --git a/tools/ci/frontend b/tools/ci/frontendindex 2496e9d886e..76f5c298f6b 100755--- a/tools/ci/frontend+++ b/tools/ci/frontend@@ -30,8 +30,7 @@ PYTHONWARNINGS=ignore ./tools/check-frontend-i18n --no-generate## ./tools/test-js-with-casper --xunit-export-# Temporarily disabled pending further work-# ./tools/test-js-with-puppeteer+./tools/test-js-with-puppeteer# NB: Everything here should be in `tools/test-all`. If there's a# reason not to run it there, it should be there as a comment