[Libreoffice-commits] online.git: 2 commits - cypress_test/Makefile.am cypress_test/README

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Fri May 22 21:41:38 UTC 2020


 cypress_test/Makefile.am |   49 +++++++++++++++++++++++++++--------------------
 cypress_test/README      |   30 ++++++++++++++++++----------
 2 files changed, 48 insertions(+), 31 deletions(-)

New commits:
commit c3c9f25954ff0102139358a4b4f17894446310a3
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri May 22 22:55:18 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri May 22 23:41:26 2020 +0200

    cypress: deduplicate config related code in make file.
    
    And break commands to multiple lines for better readability.
    
    Change-Id: I5ee25bb34e69f80346a0dbfd3cf5b81329cc8438
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94711
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 529ccae7c..0baa0a5f5 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -155,27 +155,36 @@ define start_Xvfb
 	@echo
 endef
 
-DESKTOP_CONFIG = --config integrationFolder=$(DESKTOP_TEST_FOLDER),supportFile=$(SUPPORT_FILE),userAgent=$(DESKTOP_USER_AGENT) --env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(WSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT)
+DESKTOP_CONFIG = \
+	--config integrationFolder=$(DESKTOP_TEST_FOLDER),supportFile=$(SUPPORT_FILE),userAgent=$(DESKTOP_USER_AGENT) \
+	--env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(WSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT)
 
-MOBILE_CONFIG = --config integrationFolder=$(MOBILE_TEST_FOLDER),supportFile=$(SUPPORT_FILE),userAgent=$(MOBILE_USER_AGENT) --env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(WSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT)
+MOBILE_CONFIG = \
+	--config integrationFolder=$(MOBILE_TEST_FOLDER),supportFile=$(SUPPORT_FILE),userAgent=$(MOBILE_USER_AGENT) \
+	--env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(WSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT)
 
 define run_interactive_test
 	$(if $(2),\
-		$(CYPRESS_BINARY) run --browser $(CHROME) --headed --no-exit \
+		$(CYPRESS_BINARY) run \
+			--browser $(CHROME) \
+			--headed --no-exit \
 			$(if $(findstring DESKTOP,$(1)),\
-				$(DESKTOP_CONFIG) --spec=$(abs_dir)/integration_tests/desktop/$(2),\
-				$(MOBILE_CONFIG) --spec=$(abs_dir)/integration_tests/mobile/$(2)),\
-		$(CYPRESS_BINARY) open $(if $(findstring DESKTOP,$(1)),$(DESKTOP_CONFIG),$(MOBILE_CONFIG)))
+				$(DESKTOP_CONFIG) \
+				--spec=$(abs_dir)/integration_tests/desktop/$(2),\
+				$(MOBILE_CONFIG) \
+				--spec=$(abs_dir)/integration_tests/mobile/$(2)),\
+		$(CYPRESS_BINARY) open \
+			$(if $(findstring DESKTOP,$(1)),$(DESKTOP_CONFIG),$(MOBILE_CONFIG)))
 endef
 
 define run_desktop_tests
 	@echo $(if $(1),"Running cypress desktop test: $(1)","Running cypress desktop tests...")
 	@echo
 	$(eval RUN_COMMAND = \
-		$(CYPRESS_BINARY) run --browser $(CHROME) \
-			--config integrationFolder=$(DESKTOP_TEST_FOLDER),supportFile=$(SUPPORT_FILE),userAgent=$(DESKTOP_USER_AGENT) \
+		$(CYPRESS_BINARY) run \
+			--browser $(CHROME) \
 			--headless \
-			--env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(WSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) \
+			$(DESKTOP_CONFIG) \
 			$(if $(1), --spec=$(abs_dir)/integration_tests/desktop/$(1)) \
 			$(if $(PARALLEL_BUILD),,|| ($(KILL_COMMAND) && false)))
 	$(if $(PARALLEL_BUILD),\
@@ -189,10 +198,10 @@ define run_mobile_tests
 	@echo $(if $(1),"Running cypress mobile test: $(1)","Running cypress mobile tests...")
 	@echo
 	$(eval RUN_COMMAND = \
-		$(CYPRESS_BINARY) run --browser $(CHROME) \
-			--config integrationFolder=$(MOBILE_TEST_FOLDER),supportFile=$(SUPPORT_FILE),userAgent=$(MOBILE_USER_AGENT) \
+		$(CYPRESS_BINARY) run \
+			--browser $(CHROME) \
 			--headless \
-			--env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(WSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) \
+			$(MOBILE_CONFIG) \
 			$(if $(1), --spec=$(abs_dir)/integration_tests/mobile/$(1)) \
 			$(if $(PARALLEL_BUILD),,|| ($(KILL_COMMAND) && false)))
 	$(if $(PARALLEL_BUILD),\
commit 015beba2074f5ee78dc799b91a922a35931ccc40
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri May 22 22:47:10 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri May 22 23:41:20 2020 +0200

    cypress: document the new spec option of make run-* commands.
    
    Mention it also in the log in case of error.
    
    Change-Id: Ib99dc2d2122a0658c86b223d94fec24de106fbd4
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94710
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 15c09a916..529ccae7c 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -179,7 +179,7 @@ define run_desktop_tests
 			$(if $(1), --spec=$(abs_dir)/integration_tests/desktop/$(1)) \
 			$(if $(PARALLEL_BUILD),,|| ($(KILL_COMMAND) && false)))
 	$(if $(PARALLEL_BUILD),\
-		$(call execute_run_parallel,$(RUN_COMMAND),$(2),"make check-desktop spec=$(1)")\
+		$(call execute_run_parallel,$(RUN_COMMAND),$(2),desktop,$(1))\
 	,\
 		$(RUN_COMMAND)\
 	)
@@ -196,7 +196,7 @@ define run_mobile_tests
 			$(if $(1), --spec=$(abs_dir)/integration_tests/mobile/$(1)) \
 			$(if $(PARALLEL_BUILD),,|| ($(KILL_COMMAND) && false)))
 	$(if $(PARALLEL_BUILD),\
-		$(call execute_run_parallel,$(RUN_COMMAND),$(2),"make check-mobile spec=$(1)")\
+		$(call execute_run_parallel,$(RUN_COMMAND),$(2),mobile,$(1))\
 	,\
 		$(RUN_COMMAND)\
 	)
@@ -213,20 +213,20 @@ define execute_run_parallel
 		     if [ -z `grep -o -m 1 "Error:\|Command failed:" $(2)` ];\
 			then cat $(2);\
 			else cat $(2) >> $(ERROR_LOG) && \
-			     echo -e $(call error_output_string,$(3)) >> $(ERROR_LOG); \
+			     echo -e $(call error_output_string,$(3),$(4)) >> $(ERROR_LOG); \
 		     fi;\
 		else cat $(2) >> $(ERROR_LOG) && \
-		     echo -e $(call error_output_string,$(3)) >> $(ERROR_LOG); \
+		     echo -e $(call error_output_string,$(3),$(4)) >> $(ERROR_LOG); \
 	fi;
 endef
 
 define error_output_string
 "\n\
 CypressError: a test failed, please do one of the following:\n\n\
-Run the failing test:\n\
-\t$(1)\n\n\
-Open the interactive test runner:\n\
-\t$(if $(findstring mobile,$(1)),make run-mobile,make run-desktop)\n"
+Run the failing test in headless mode:\n\
+\tmake check-$(1) spec=$(2)\n\n\
+Open the failing test in the interactive test runner:\n\
+\tmake run-$(1) spec=$(2)\n"
 endef
 
 NODE_BINS = \
diff --git a/cypress_test/README b/cypress_test/README
index 7f0fe321a..1b8b88b27 100644
--- a/cypress_test/README
+++ b/cypress_test/README
@@ -43,13 +43,13 @@ To run all mobile tests:
 
     make check-mobile
 
-To run one specific test suit of desktop tests,
+To run one specific test suite of desktop tests,
 use spec argument with a relative path to
 cypress_test/integration_tests/desktop/:
 
-    make check-desktop spec=example_desktop_test_spec.js
+    make check-desktop spec=writer/form_field_spec.js
 
-To run one specific test suit of mobile tests,
+To run one specific test suite of mobile tests,
 use spec argument with a relative path to
 cypress_test/integration_tests/mobile/:
 
@@ -59,10 +59,10 @@ cypress_test/integration_tests/mobile/:
 Running one specific test
 ------------------
 
-To run one test case of a test suit you can use Mocha's
+To run one test case of a test suite you can use Mocha's
 'only' feature. Just replace the it(...) function with
 it.only(...) in the spec file for the selected test case
-and run the test suit using the spec parameter.
+and run the test suite using the spec parameter.
 
 For example, to run the test with title 'Apply font name.'
 inside apply_font_spec.js file, you need to add it.only():
@@ -70,15 +70,11 @@ inside apply_font_spec.js file, you need to add it.only():
 -    it('Apply font name.', function() {
 +    it.only('Apply font name.', function() {
 
-Then run the test suit with:
+Then run the test suite with:
 
     make check-mobile spec=writer/apply_font_spec.js
 
-Or open the file in the interactive test runner.
-
-    make run-mobile
-
-Or run specific unit test:
+Or open the test suite in the interactive test runner:
 
     make run-mobile spec=writer/apply_font_spec.js
 
@@ -100,6 +96,18 @@ To open mobile tests in the test runner:
 
     make run-mobile
 
+To open one specific test suite of desktop tests,
+use spec argument with a relative path to
+cypress_test/integration_tests/desktop/:
+
+    make run-desktop spec=writer/form_field_spec.js
+
+To open one specific test suite of mobile tests,
+use spec argument with a relative path to
+cypress_test/integration_tests/mobile/:
+
+    make run-mobile spec=writer/toolbar_spec.js
+
 During the build we run the tests with Chrome browser, so make sure
 you select Chrome browser on the GUI while checking tests.
 We are using different configuration and environment variables for


More information about the Libreoffice-commits mailing list