mirror of https://github.com/zulip/zulip.git
puppeteer_test: Add support to run tests with Firefox.
This commit introduces the `--firefox` argument, which will allow us to run puppeteer tests with Firefox also.
This commit is contained in:
parent
812d563bd4
commit
d6307cc907
|
@ -121,8 +121,10 @@ def find_js_test_files(test_dir: str, files: Iterable[str]) -> List[str]:
|
||||||
return test_files
|
return test_files
|
||||||
|
|
||||||
|
|
||||||
def prepare_puppeteer_run() -> None:
|
def prepare_puppeteer_run(is_firefox: bool = False) -> None:
|
||||||
os.chdir(ZULIP_PATH)
|
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"])
|
subprocess.check_call(["node", "node_modules/puppeteer/install.js"])
|
||||||
os.makedirs("var/puppeteer", exist_ok=True)
|
os.makedirs("var/puppeteer", exist_ok=True)
|
||||||
for f in glob.glob("var/puppeteer/puppeteer-failure*.png"):
|
for f in glob.glob("var/puppeteer/puppeteer-failure*.png"):
|
||||||
|
|
|
@ -51,6 +51,7 @@ parser = argparse.ArgumentParser(usage)
|
||||||
|
|
||||||
parser.add_argument("--interactive", action="store_true", help="Run tests interactively")
|
parser.add_argument("--interactive", action="store_true", help="Run tests interactively")
|
||||||
add_provision_check_override_param(parser)
|
add_provision_check_override_param(parser)
|
||||||
|
parser.add_argument("--firefox", action="store_true", help="Run tests with firefox.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"tests", nargs=argparse.REMAINDER, help="Specific tests to run; by default, runs all tests"
|
"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"
|
external_host = "zulipdev.com:9981"
|
||||||
assert_provisioning_status_ok(options.skip_provision_check)
|
assert_provisioning_status_ok(options.skip_provision_check)
|
||||||
prepare_puppeteer_run()
|
prepare_puppeteer_run(is_firefox=options.firefox)
|
||||||
run_tests(options.tests, external_host)
|
run_tests(options.tests, external_host)
|
||||||
print(f"{OKGREEN}All tests passed!{ENDC}")
|
print(f"{OKGREEN}All tests passed!{ENDC}")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Reference in New Issue