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-21 12:53:52 -06:00
|
|
|
CYPRESS_BINARY = $(abs_builddir)/node_modules/cypress/bin/cypress
|
|
|
|
ESLINT_BINARY = $(abs_builddir)/node_modules/eslint/bin/eslint.js
|
|
|
|
WAIT_ON_BINARY = $(abs_builddir)/node_modules/wait-on/bin/wait-on
|
|
|
|
GET_PORT_BINARY = $(abs_builddir)/node_modules/get-port-cli/cli.js
|
2020-02-23 04:46:17 -06:00
|
|
|
NPM_INSTALLED = $(abs_builddir)/workdir/npm_installed
|
2020-02-21 11:27:15 -06:00
|
|
|
|
2020-02-23 05:08:36 -06:00
|
|
|
PID_FILE=$(abs_builddir)/workdir/loolwsd.pid
|
2020-01-10 09:38:37 -06:00
|
|
|
|
2020-01-28 09:19:26 -06:00
|
|
|
DESKTOP_USER_AGENT = "cypress"
|
2020-02-21 12:53:52 -06:00
|
|
|
DESKTOP_TEST_FOLDER = $(abs_srcdir)/integration_tests/desktop
|
|
|
|
DESKTOP_DATA_FOLDER = $(abs_srcdir)/data/desktop/
|
|
|
|
DESKTOP_WORKDIR = $(abs_builddir)/workdir/desktop/
|
2020-02-20 15:01:27 -06:00
|
|
|
DESKTOP_TRACK_FOLDER=$(abs_builddir)/workdir/track/desktop
|
2020-01-15 07:55:03 -06:00
|
|
|
|
2020-01-28 09:19:26 -06:00
|
|
|
MOBILE_USER_AGENT = "cypress mobile"
|
2020-02-21 12:53:52 -06:00
|
|
|
MOBILE_TEST_FOLDER = $(abs_srcdir)/integration_tests/mobile
|
|
|
|
MOBILE_DATA_FOLDER = $(abs_srcdir)/data/mobile/
|
|
|
|
MOBILE_WORKDIR = $(abs_builddir)/workdir/mobile/
|
2020-02-20 15:01:27 -06:00
|
|
|
MOBILE_TRACK_FOLDER=$(abs_builddir)/workdir/track/mobile
|
2020-01-10 09:38:37 -06:00
|
|
|
|
2020-02-19 21:15:58 -06:00
|
|
|
ALLOWED_PORTS = $(shell seq 9900 1 9980)
|
2020-02-20 03:03:42 -06:00
|
|
|
KILL_COMMAND=pkill -F $(PID_FILE) || pkill --signal SIGKILL -F $(PID_FILE)
|
|
|
|
|
2020-01-12 06:05:04 -06:00
|
|
|
if HAVE_LO_PATH
|
2020-02-20 15:01:27 -06:00
|
|
|
MOBILE_TEST_FILES= \
|
|
|
|
calc/calc_focus_spec.js \
|
|
|
|
impress/impress_focus_spec.js \
|
|
|
|
writer/apply_font_spec.js \
|
|
|
|
writer/apply_paragraph_properties_spec.js \
|
|
|
|
writer/bottom_toolbar_spec.js \
|
|
|
|
writer/focus_spec.js \
|
|
|
|
writer/insert_field_spec.js \
|
|
|
|
writer/insert_formatting_mark_spec.js \
|
|
|
|
writer/insert_object_spec.js \
|
|
|
|
writer/mobile_wizard_state_spec.js \
|
|
|
|
writer/shape_properties_spec.js \
|
|
|
|
writer/spellchecking_spec.js \
|
|
|
|
writer/styles_spec.js \
|
|
|
|
writer/table_properties_spec.js \
|
|
|
|
writer/toolbar_spec.js
|
|
|
|
|
|
|
|
DEKSTOP_TEST_FILES= \
|
|
|
|
copy_paste_spec.js \
|
|
|
|
example_desktop_test_spec.js \
|
|
|
|
shape_operations_spec.js
|
|
|
|
|
|
|
|
MOBILE_TEST_FILES_DONE= \
|
|
|
|
$(foreach test_file,$(MOBILE_TEST_FILES),$(MOBILE_TRACK_FOLDER)/$(test_file).done)
|
|
|
|
|
|
|
|
DESKTOP_TEST_FILES_DONE= \
|
|
|
|
$(foreach test_file,$(DEKSTOP_TEST_FILES),$(DESKTOP_TRACK_FOLDER)/$(test_file).done)
|
|
|
|
|
|
|
|
check-local: $(MOBILE_TEST_FILES_DONE) $(DESKTOP_TEST_FILES_DONE)
|
|
|
|
@$(KILL_COMMAND) || true
|
|
|
|
|
|
|
|
$(PID_FILE): @JAILS_PATH@ $(NODE_BINS)
|
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-02-20 15:01:27 -06:00
|
|
|
|
|
|
|
$(MOBILE_TEST_FILES_DONE): $(PID_FILE)
|
|
|
|
$(call run_mobile_tests,$(subst $(MOBILE_TRACK_FOLDER),,$(basename $@)))
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
$(DESKTOP_TEST_FILES_DONE): $(PID_FILE)
|
|
|
|
$(call run_desktop_tests,$(subst $(DESKTOP_TRACK_FOLDER),,$(basename $@)))
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@touch $@
|
2020-01-14 12:37:17 -06:00
|
|
|
|
2020-02-21 11:27:15 -06:00
|
|
|
check-desktop: @JAILS_PATH@ $(NODE_BINS)
|
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-02-20 03:03:42 -06:00
|
|
|
@$(KILL_COMMAND) || true
|
2020-01-14 12:37:17 -06:00
|
|
|
|
2020-02-21 11:27:15 -06:00
|
|
|
check-mobile: @JAILS_PATH@ $(NODE_BINS)
|
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))
|
2020-02-20 03:03:42 -06:00
|
|
|
@$(KILL_COMMAND) || true
|
2020-01-15 07:55:03 -06:00
|
|
|
|
2020-02-21 11:27:15 -06:00
|
|
|
run-desktop: @JAILS_PATH@ $(NODE_BINS)
|
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-02-19 19:25:01 -06:00
|
|
|
--env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) \
|
2020-01-15 07:55:03 -06:00
|
|
|
|| true
|
2020-02-20 03:03:42 -06:00
|
|
|
@$(KILL_COMMAND) || true
|
2020-01-15 07:55:03 -06:00
|
|
|
|
2020-02-21 11:27:15 -06:00
|
|
|
run-mobile: @JAILS_PATH@ $(NODE_BINS)
|
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-02-19 19:25:01 -06:00
|
|
|
--env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) \
|
2020-01-15 07:55:03 -06:00
|
|
|
|| true
|
2020-02-20 03:03:42 -06:00
|
|
|
@$(KILL_COMMAND) || 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-21 12:53:52 -06:00
|
|
|
@NODE_PATH=$(abs_dir)/node_modules $(NODE) $(ESLINT_BINARY) $(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-02-20 15:01:27 -06:00
|
|
|
$(eval FREE_PORT:=$(shell $(GET_PORT_BINARY) --host=127.0.0.1 $(ALLOWED_PORTS)))
|
2020-02-19 19:25:01 -06:00
|
|
|
@echo "Found available port for testing: $(FREE_PORT)"
|
|
|
|
@echo
|
|
|
|
@echo "Launching loolwsd..."
|
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-02-20 15:01:27 -06:00
|
|
|
--o:logging.file[@enable]=true --o:logging.level=trace \
|
2020-02-19 21:35:08 -06:00
|
|
|
--port=$(FREE_PORT) \
|
2020-02-20 15:01:27 -06:00
|
|
|
--pidfile=$(PID_FILE) \
|
|
|
|
> /dev/null 2>&1 &
|
2020-02-21 11:27:15 -06:00
|
|
|
@$(WAIT_ON_BINARY) http://localhost:$(FREE_PORT) --timeout 60000
|
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-02-19 19:25:01 -06:00
|
|
|
--env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) \
|
2020-02-21 12:53:52 -06:00
|
|
|
$(if $(1), --spec=$(abs_dir)/integration_tests/desktop/$(1)) \
|
2020-02-20 03:03:42 -06:00
|
|
|
|| ($(KILL_COMMAND) && 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-02-19 19:25:01 -06:00
|
|
|
--env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) \
|
2020-02-13 05:57:37 -06:00
|
|
|
$(if $(1), --spec=$(abs_dir)/integration_tests/mobile/$(1)) \
|
2020-02-20 03:03:42 -06:00
|
|
|
|| ($(KILL_COMMAND) && false)
|
2020-01-14 12:37:17 -06:00
|
|
|
endef
|
|
|
|
|
2020-02-21 11:27:15 -06:00
|
|
|
NODE_BINS = \
|
|
|
|
$(CYPRESS_BINARY) \
|
|
|
|
$(ESLINT_BINARY) \
|
|
|
|
$(WAIT_ON_BINARY) \
|
|
|
|
$(GET_PORT_BINARY)
|
|
|
|
|
2020-02-23 04:46:17 -06:00
|
|
|
$(NODE_BINS): $(NPM_INSTALLED);
|
|
|
|
|
|
|
|
$(NPM_INSTALLED):
|
2020-01-15 08:27:30 -06:00
|
|
|
@npm install
|
2020-02-23 04:46:17 -06:00
|
|
|
@mkdir -p $(dir $(NPM_INSTALLED))
|
|
|
|
@touch $(NPM_INSTALLED)
|
2020-01-15 08:27:30 -06:00
|
|
|
|
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
|