2020-01-23 07:46:07 -06:00
|
|
|
if ENABLE_CYPRESS
|
2020-02-13 05:57:37 -06:00
|
|
|
|
|
|
|
abs_dir = $(if $(filter $(abs_builddir),$(abs_srcdir)),.,$(abs_srcdir))
|
2020-02-12 12:41:41 -06:00
|
|
|
CYPRESS_BINARY = ${abs_builddir}/node_modules/cypress/bin/cypress
|
2020-01-10 09:38:37 -06:00
|
|
|
|
2020-01-28 09:19:26 -06:00
|
|
|
DESKTOP_USER_AGENT = "cypress"
|
2020-02-12 12:41:41 -06:00
|
|
|
DESKTOP_TEST_FOLDER = ${abs_srcdir}/integration_tests/desktop
|
2020-01-15 07:55:03 -06:00
|
|
|
DESKTOP_DATA_FOLDER = ${abs_srcdir}/data/desktop/
|
|
|
|
DESKTOP_WORKDIR = ${abs_srcdir}/workdir/desktop/
|
|
|
|
|
2020-01-28 09:19:26 -06:00
|
|
|
MOBILE_USER_AGENT = "cypress mobile"
|
2020-02-12 12:41:41 -06:00
|
|
|
MOBILE_TEST_FOLDER = ${abs_srcdir}/integration_tests/mobile
|
2020-01-15 07:55:03 -06:00
|
|
|
MOBILE_DATA_FOLDER = ${abs_srcdir}/data/mobile/
|
|
|
|
MOBILE_WORKDIR = ${abs_srcdir}/workdir/mobile/
|
2020-01-10 09:38:37 -06:00
|
|
|
|
2020-01-12 06:05:04 -06:00
|
|
|
if HAVE_LO_PATH
|
2020-01-15 08:27:30 -06:00
|
|
|
check-local: @JAILS_PATH@ node_modules
|
2020-01-30 08:17:29 -06:00
|
|
|
$(call run_JS_error_check)
|
2020-01-14 12:37:17 -06:00
|
|
|
$(call start_loolwsd)
|
|
|
|
$(call run_desktop_tests)
|
|
|
|
$(call run_mobile_tests)
|
|
|
|
@pkill loolwsd || true
|
|
|
|
|
2020-01-15 08:27:30 -06:00
|
|
|
check-desktop: @JAILS_PATH@ node_modules
|
2020-01-30 08:17:29 -06:00
|
|
|
$(call run_JS_error_check)
|
2020-01-14 12:37:17 -06:00
|
|
|
$(call start_loolwsd)
|
2020-01-15 07:55:03 -06:00
|
|
|
$(call run_desktop_tests,$(spec))
|
2020-01-14 12:37:17 -06:00
|
|
|
@pkill loolwsd || true
|
|
|
|
|
2020-01-15 08:27:30 -06:00
|
|
|
check-mobile: @JAILS_PATH@ node_modules
|
2020-01-30 08:17:29 -06:00
|
|
|
$(call run_JS_error_check)
|
2020-01-14 12:37:17 -06:00
|
|
|
$(call start_loolwsd)
|
2020-01-15 07:55:03 -06:00
|
|
|
$(call run_mobile_tests,$(spec))
|
|
|
|
@pkill loolwsd || true
|
|
|
|
|
2020-01-15 08:27:30 -06:00
|
|
|
run-desktop: @JAILS_PATH@ node_modules
|
2020-01-15 07:55:03 -06:00
|
|
|
$(call start_loolwsd)
|
|
|
|
@echo
|
|
|
|
@echo "Open cypress with desktop tests..."
|
|
|
|
@echo
|
2020-01-28 09:19:26 -06:00
|
|
|
$(CYPRESS_BINARY) open --config integrationFolder=$(DESKTOP_TEST_FOLDER),userAgent=$(DESKTOP_USER_AGENT) \
|
2020-01-22 05:28:14 -06:00
|
|
|
--env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH) \
|
2020-01-15 07:55:03 -06:00
|
|
|
|| true
|
|
|
|
@pkill loolwsd || true
|
|
|
|
|
2020-01-15 08:27:30 -06:00
|
|
|
run-mobile: @JAILS_PATH@ node_modules
|
2020-01-15 07:55:03 -06:00
|
|
|
$(call start_loolwsd)
|
|
|
|
@echo
|
|
|
|
@echo "Open cypress with mobile tests..."
|
|
|
|
@echo
|
|
|
|
$(CYPRESS_BINARY) open --config integrationFolder=$(MOBILE_TEST_FOLDER),userAgent=$(MOBILE_USER_AGENT) \
|
2020-01-22 05:28:14 -06:00
|
|
|
--env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH) \
|
2020-01-15 07:55:03 -06:00
|
|
|
|| true
|
2020-01-14 12:37:17 -06:00
|
|
|
@pkill loolwsd || true
|
2020-01-14 12:14:18 -06:00
|
|
|
|
2020-01-14 12:37:17 -06:00
|
|
|
define run_JS_error_check
|
2020-01-30 08:17:29 -06:00
|
|
|
@echo "Checking for JS errors in test code..."
|
|
|
|
@echo
|
2020-02-13 05:57:37 -06:00
|
|
|
@NODE_PATH=${abs_dir}/node_modules $(NODE) node_modules/eslint/bin/eslint.js $(abs_srcdir) \
|
2020-01-14 12:37:17 -06:00
|
|
|
--ignore-path $(abs_srcdir)/.eslintignore --config $(abs_top_srcdir)/loleaflet/.eslintrc
|
2020-01-10 09:38:37 -06:00
|
|
|
@echo
|
2020-01-14 12:37:17 -06:00
|
|
|
endef
|
|
|
|
|
|
|
|
define start_loolwsd
|
2020-01-10 09:38:37 -06:00
|
|
|
@pkill loolwsd || true
|
2020-01-15 07:55:03 -06:00
|
|
|
@echo "Launching loolwsd for testing..."
|
2020-01-10 09:38:37 -06:00
|
|
|
@fc-cache "@LO_PATH@"/share/fonts/truetype
|
|
|
|
@echo
|
|
|
|
../loolwsd --o:sys_template_path="@SYSTEMPLATE_PATH@" \
|
|
|
|
--o:child_root_path="@JAILS_PATH@" --o:storage.filesystem[@allow]=true \
|
2020-01-22 05:55:00 -06:00
|
|
|
--disable-ssl \
|
2020-01-10 09:38:37 -06:00
|
|
|
--o:admin_console.username=admin --o:admin_console.password=admin \
|
2020-01-21 10:50:59 -06:00
|
|
|
--o:logging.file[@enable]=true --o:logging.level=trace > /dev/null 2>&1 &
|
|
|
|
@node_modules/wait-on/bin/wait-on http://localhost:9980
|
2020-01-10 09:38:37 -06:00
|
|
|
@echo
|
2020-01-14 12:37:17 -06:00
|
|
|
endef
|
|
|
|
|
|
|
|
define run_desktop_tests
|
|
|
|
@echo
|
2020-01-10 09:38:37 -06:00
|
|
|
@echo "Running cypress desktop tests..."
|
|
|
|
@echo
|
2020-01-22 07:57:31 -06:00
|
|
|
$(CYPRESS_BINARY) run --browser $(CHROME) \
|
2020-01-28 09:19:26 -06:00
|
|
|
--config integrationFolder=$(DESKTOP_TEST_FOLDER),userAgent=$(DESKTOP_USER_AGENT) \
|
2020-01-14 10:10:07 -06:00
|
|
|
--headless \
|
2020-01-22 05:28:14 -06:00
|
|
|
--env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH) \
|
2020-02-13 05:57:37 -06:00
|
|
|
$(if $(1), --spec=${abs_dir}/integration_tests/desktop/$(1)) \
|
2020-01-15 07:55:03 -06:00
|
|
|
|| (pkill loolwsd && false)
|
2020-01-14 12:37:17 -06:00
|
|
|
endef
|
|
|
|
|
|
|
|
define run_mobile_tests
|
2020-01-10 09:38:37 -06:00
|
|
|
@echo
|
|
|
|
@echo "Running cypress mobile tests..."
|
|
|
|
@echo
|
2020-01-22 07:57:31 -06:00
|
|
|
$(CYPRESS_BINARY) run --browser $(CHROME) \
|
2020-01-14 11:19:09 -06:00
|
|
|
--config integrationFolder=$(MOBILE_TEST_FOLDER),userAgent=$(MOBILE_USER_AGENT) \
|
2020-01-14 10:10:07 -06:00
|
|
|
--headless \
|
2020-01-22 05:28:14 -06:00
|
|
|
--env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH) \
|
2020-02-13 05:57:37 -06:00
|
|
|
$(if $(1), --spec=$(abs_dir)/integration_tests/mobile/$(1)) \
|
2020-01-15 07:55:03 -06:00
|
|
|
|| (pkill loolwsd && false)
|
2020-01-14 12:37:17 -06:00
|
|
|
endef
|
|
|
|
|
2020-01-15 08:27:30 -06:00
|
|
|
node_modules:
|
|
|
|
@npm install
|
|
|
|
@touch node_modules
|
|
|
|
|
2020-01-12 06:05:04 -06:00
|
|
|
endif
|
2020-01-10 09:38:37 -06:00
|
|
|
|
|
|
|
clean-local:
|
|
|
|
rm -rf node_modules
|
2020-01-14 11:08:51 -06:00
|
|
|
rm -rf workdir
|
2020-01-14 11:14:23 -06:00
|
|
|
rm -rf cypress
|
2020-01-14 11:19:09 -06:00
|
|
|
rm -rf package-lock.json
|
2020-01-23 07:46:07 -06:00
|
|
|
endif
|