[Libreoffice-commits] online.git: Branch 'feature/cypress_integration' - 2 commits - cypress_test/Makefile.am cypress_test/README
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 15 14:29:47 UTC 2020
cypress_test/Makefile.am | 67 +++++++++++++++++++++++++++++++++--------------
cypress_test/README | 18 ++++--------
2 files changed, 55 insertions(+), 30 deletions(-)
New commits:
commit d5c660e91345c4a4ee98c407b5a9909a65a6d622
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jan 15 15:27:30 2020 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jan 15 15:27:30 2020 +0100
cypress: Don't run npm install unconditionally.
Change-Id: I51ff6e7706075d15c213617fede89088499226ed
diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 1e6b8ad46..fcb9b5201 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -10,30 +10,26 @@ MOBILE_DATA_FOLDER = ${abs_srcdir}/data/mobile/
MOBILE_WORKDIR = ${abs_srcdir}/workdir/mobile/
if HAVE_LO_PATH
-check-local: @JAILS_PATH@
- @npm install
+check-local: @JAILS_PATH@ node_modules
$(call run_JS_error_check,$(abs_srcdir))
$(call start_loolwsd)
$(call run_desktop_tests)
$(call run_mobile_tests)
@pkill loolwsd || true
-check-desktop: @JAILS_PATH@
- @npm install
+check-desktop: @JAILS_PATH@ node_modules
$(call run_JS_error_check,$(abs_srcdir)/integration_tests/desktop)
$(call start_loolwsd)
$(call run_desktop_tests,$(spec))
@pkill loolwsd || true
-check-mobile: @JAILS_PATH@
- @npm install
+check-mobile: @JAILS_PATH@ node_modules
$(call run_JS_error_check,$(abs_srcdir)/integration_tests/mobile)
$(call start_loolwsd)
$(call run_mobile_tests,$(spec))
@pkill loolwsd || true
-run-desktop: @JAILS_PATH@
- @npm install
+run-desktop: @JAILS_PATH@ node_modules
$(call start_loolwsd)
@echo
@echo "Open cypress with desktop tests..."
@@ -43,8 +39,7 @@ run-desktop: @JAILS_PATH@
|| true
@pkill loolwsd || true
-run-mobile: @JAILS_PATH@
- @npm install
+run-mobile: @JAILS_PATH@ node_modules
$(call start_loolwsd)
@echo
@echo "Open cypress with mobile tests..."
@@ -102,6 +97,10 @@ define run_mobile_tests
|| (pkill loolwsd && false)
endef
+node_modules:
+ @npm install
+ @touch node_modules
+
endif
clean-local:
commit 5908216f14e3de8ef1ad259c141454b0b981d57b
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jan 15 14:55:03 2020 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jan 15 15:24:37 2020 +0100
cypress: Introduce more make rules to make easier to run tests.
Change-Id: Ic8ae881864ae931fe6abed73a6a6086d6e0e591d
diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 529939da9..1e6b8ad46 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -1,13 +1,18 @@
CYPRESS_BINARY = ${abs_srcdir}/node_modules/cypress/bin/cypress
DESKTOP_TEST_FOLDER = integration_tests/desktop
-MOBILE_TEST_FOLDER = integration_tests/mobile
+DESKTOP_DATA_FOLDER = ${abs_srcdir}/data/desktop/
+DESKTOP_WORKDIR = ${abs_srcdir}/workdir/desktop/
+
MOBILE_USER_AGENT = "cypress mobile test"
+MOBILE_TEST_FOLDER = integration_tests/mobile
+MOBILE_DATA_FOLDER = ${abs_srcdir}/data/mobile/
+MOBILE_WORKDIR = ${abs_srcdir}/workdir/mobile/
if HAVE_LO_PATH
check-local: @JAILS_PATH@
@npm install
- $(call run_JS_error_check)
+ $(call run_JS_error_check,$(abs_srcdir))
$(call start_loolwsd)
$(call run_desktop_tests)
$(call run_mobile_tests)
@@ -15,28 +20,51 @@ check-local: @JAILS_PATH@
check-desktop: @JAILS_PATH@
@npm install
- $(call run_JS_error_check)
+ $(call run_JS_error_check,$(abs_srcdir)/integration_tests/desktop)
$(call start_loolwsd)
- $(call run_desktop_tests)
+ $(call run_desktop_tests,$(spec))
@pkill loolwsd || true
check-mobile: @JAILS_PATH@
@npm install
- $(call run_JS_error_check)
+ $(call run_JS_error_check,$(abs_srcdir)/integration_tests/mobile)
$(call start_loolwsd)
- $(call run_mobile_tests)
+ $(call run_mobile_tests,$(spec))
+ @pkill loolwsd || true
+
+run-desktop: @JAILS_PATH@
+ @npm install
+ $(call start_loolwsd)
+ @echo
+ @echo "Open cypress with desktop tests..."
+ @echo
+ $(CYPRESS_BINARY) open --config integrationFolder=$(DESKTOP_TEST_FOLDER) \
+ --env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR) \
+ || true
+ @pkill loolwsd || true
+
+run-mobile: @JAILS_PATH@
+ @npm install
+ $(call start_loolwsd)
+ @echo
+ @echo "Open cypress with mobile tests..."
+ @echo
+ $(CYPRESS_BINARY) open --config integrationFolder=$(MOBILE_TEST_FOLDER),userAgent=$(MOBILE_USER_AGENT) \
+ --env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR) \
+ || true
@pkill loolwsd || true
define run_JS_error_check
- @echo "Checking for cypress JS errors..."
- @NODE_PATH=$(abs_srcdir)/node_modules $(NODE) node_modules/eslint/bin/eslint.js $(abs_srcdir) \
+ @echo "Checking for JS errors in the next folder..."
+ @echo $(1)
+ @NODE_PATH=$(abs_srcdir)/node_modules $(NODE) node_modules/eslint/bin/eslint.js $(1) \
--ignore-path $(abs_srcdir)/.eslintignore --config $(abs_top_srcdir)/loleaflet/.eslintrc
@echo
endef
define start_loolwsd
@pkill loolwsd || true
- @echo "Launching loolwsd for testing.."
+ @echo "Launching loolwsd for testing..."
@fc-cache "@LO_PATH@"/share/fonts/truetype
@echo
../loolwsd --o:sys_template_path="@SYSTEMPLATE_PATH@" \
@@ -57,8 +85,9 @@ define run_desktop_tests
$(CYPRESS_BINARY) run --browser chrome \
--config integrationFolder=$(DESKTOP_TEST_FOLDER) \
--headless \
- --env DATA_FOLDER=$(abs_srcdir)/data/desktop/,WORKDIR=$(abs_srcdir)/workdir/desktop/ || \
- (pkill loolwsd && false)
+ --env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR) \
+ $(if $(1), --spec=integration_tests/desktop/$(1)) \
+ || (pkill loolwsd && false)
endef
define run_mobile_tests
@@ -68,8 +97,9 @@ define run_mobile_tests
$(CYPRESS_BINARY) run --browser chrome \
--config integrationFolder=$(MOBILE_TEST_FOLDER),userAgent=$(MOBILE_USER_AGENT) \
--headless \
- --env DATA_FOLDER=$(abs_srcdir)/data/mobile/,WORKDIR=$(abs_srcdir)/workdir/mobile/ || \
- (pkill loolwsd && false)
+ --env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR) \
+ $(if $(1), --spec=integration_tests/mobile/$(1)) \
+ || (pkill loolwsd && false)
endef
endif
diff --git a/cypress_test/README b/cypress_test/README
index c5841b9dc..0bc100241 100644
--- a/cypress_test/README
+++ b/cypress_test/README
@@ -10,13 +10,9 @@ cypress_test folder to run cypress tests only.
make check
-To run cypress test cases selectively, you need to start loolwsd
-server first. To do that you can call make run on a separate
-command line window, so LibreOffice online is started.
-
-After the server is running you can execute the tests,
-calling the given run command. You need to run the
-command under cypress_test\ folder.
+To run cypress test cases selectively, you need to
+go in to the cypress_test folder first and run one of
+the following commands.
To run all desktop tests:
@@ -28,11 +24,11 @@ To run all mobile tests:
To run one specific test suit of desktop tests:
- npm run cyrun_desktop --spec example_desktop_test_spec.js
+ make check-desktop spec=example_desktop_test_spec.js
To run one specific test suit of mobile tests:
- npm run cyrun_mobile --spec toolbar_spec.js
+ make check-mobile spec=toolbar_spec.js
You can also open cypress tests in the browser, so you can
check what happens during test run. It's useful for writing
@@ -40,11 +36,11 @@ new tests or checking why an existing test fails.
To open desktop tests in browser:
- npm run cyopen_desktop
+ make run-desktop
To open mobile tests in browser:
- npm run cyopen_mobile
+ make run-mobile
During the build we run the tests with Chrome browser, so make sure
you select Chrome browser on the GUI while checking tests.
More information about the Libreoffice-commits
mailing list