Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
puppeteer_test: Add support to run tests with Firefox.
Riken Shahd6307cc9077c
diff --git a/tools/lib/test_script.py b/tools/lib/test_script.pyindex d3d6fcdbf34..048f7b29580 100644--- a/tools/lib/test_script.py+++ b/tools/lib/test_script.py@@ -121,8 +121,10 @@ def find_js_test_files(test_dir: str, files: Iterable[str]) -> List[str]:return test_files-def prepare_puppeteer_run() -> None:+def prepare_puppeteer_run(is_firefox: bool = False) -> None:os.chdir(ZULIP_PATH)+ # This will determine if the browser will be firefox or chrome.+ os.environ["PUPPETEER_PRODUCT"] = "firefox" if is_firefox else "chrome"subprocess.check_call(["node", "node_modules/puppeteer/install.js"])os.makedirs("var/puppeteer", exist_ok=True)for f in glob.glob("var/puppeteer/puppeteer-failure*.png"):diff --git a/tools/test-js-with-puppeteer b/tools/test-js-with-puppeteerindex 41e4ce7b8d1..2692fcfdeee 100755--- a/tools/test-js-with-puppeteer+++ b/tools/test-js-with-puppeteer@@ -51,6 +51,7 @@ parser = argparse.ArgumentParser(usage)parser.add_argument("--interactive", action="store_true", help="Run tests interactively")add_provision_check_override_param(parser)+parser.add_argument("--firefox", action="store_true", help="Run tests with firefox.")parser.add_argument("tests", nargs=argparse.REMAINDER, help="Specific tests to run; by default, runs all tests")@@ -127,7 +128,7 @@ or report and ask for help in chat.zulip.org""",external_host = "zulipdev.com:9981"assert_provisioning_status_ok(options.skip_provision_check)-prepare_puppeteer_run()+prepare_puppeteer_run(is_firefox=options.firefox)run_tests(options.tests, external_host)print(f"{OKGREEN}All tests passed!{ENDC}")sys.exit(0)