test-js-with-puppeteer: Extract code to prepare for puppeteer run.

This commit is contained in:
Puneeth Chaganti
2020-04-17 12:49:39 +05:30
committed by Tim Abbott
parent 572e188b36
commit dd6966b9af
2 changed files with 13 additions and 13 deletions

View File

@@ -1,12 +1,15 @@
from typing import Optional, Tuple, Iterable, List
import os
import subprocess
import sys
from distutils.version import LooseVersion
from version import PROVISION_VERSION
from scripts.lib.zulip_tools import get_dev_uuid_var_path
import glob
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def get_major_version(v: str) -> int:
return int(v.split('.')[0])
@@ -95,3 +98,10 @@ def find_js_test_files(test_dir: str, files: Iterable[str]) -> List[str]:
test_files = sorted(glob.glob(os.path.join(test_dir, '*.js')))
return test_files
def prepare_puppeteer_run() -> None:
os.chdir(ZULIP_PATH)
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'):
os.remove(f)