|
|
@@ -541,10 +541,22 @@ def run_ui_tests(context, app, headless=False): |
|
|
|
site_env = 'CYPRESS_baseUrl={}'.format(site_url) |
|
|
|
password_env = 'CYPRESS_adminPassword={}'.format(admin_password) if admin_password else '' |
|
|
|
|
|
|
|
os.chdir(app_base_path) |
|
|
|
|
|
|
|
node_bin = subprocess.getoutput("npm bin") |
|
|
|
cypress_path = "{0}/cypress".format(node_bin) |
|
|
|
plugin_path = "{0}/cypress-file-upload".format(node_bin) |
|
|
|
|
|
|
|
# check if cypress in path...if not, install it. |
|
|
|
if not (os.path.exists(cypress_path) or os.path.exists(plugin_path)): |
|
|
|
# install cypress |
|
|
|
click.secho("Installing Cypress...", fg="yellow") |
|
|
|
frappe.commands.popen("npm install cypress@3 cypress-file-upload@^3.1 --no-save") |
|
|
|
|
|
|
|
# run for headless mode |
|
|
|
run_or_open = 'run --browser chrome --record --key 4a48f41c-11b3-425b-aa88-c58048fa69eb' if headless else 'open' |
|
|
|
command = '{site_env} {password_env} yarn run cypress {run_or_open}' |
|
|
|
formatted_command = command.format(site_env=site_env, password_env=password_env, run_or_open=run_or_open) |
|
|
|
command = '{site_env} {password_env} {cypress} {run_or_open}' |
|
|
|
formatted_command = command.format(site_env=site_env, password_env=password_env, cypress=cypress_path, run_or_open=run_or_open) |
|
|
|
frappe.commands.popen(formatted_command, cwd=app_base_path, raise_err=True) |
|
|
|
|
|
|
|
|
|
|
|