[Libreoffice-commits] online.git: cypress_test/integration_tests cypress_test/Makefile.am cypress_test/support

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 15 13:40:41 UTC 2020


 cypress_test/Makefile.am                        |    5 ++-
 cypress_test/integration_tests/common/helper.js |   34 ++++++++++++++++--------
 cypress_test/support/index.js                   |   10 ++++++-
 3 files changed, 36 insertions(+), 13 deletions(-)

New commits:
commit f6d5cf9c3fdd6def25f2c2d3911ba580b00709df
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Sep 14 15:53:51 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Sep 15 15:40:22 2020 +0200

    cypress: support running tests with php-proxy.
    
    Change-Id: I9fe4a974582e0475026f6798a338bae033e6d7e6
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102733
    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 821886137..429473e30 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -235,7 +235,9 @@ endef
 define start_loolwsd
 	$(if $(findstring nextcloud, $(CYPRESS_INTEGRATION)),\
 		$(eval FREE_PORT:=9980),\
-		$(eval FREE_PORT:=$(shell $(GET_PORT_BINARY) --host=127.0.0.1 $(ALLOWED_PORTS))))
+		$(if $(findstring php-proxy, $(CYPRESS_INTEGRATION)),
+			$(eval FREE_PORT:=9982),\
+			$(eval FREE_PORT:=$(shell $(GET_PORT_BINARY) --host=127.0.0.1 $(ALLOWED_PORTS)))))
 	@echo "Found available port for testing: $(FREE_PORT)"
 	@echo
 	@echo "Launching loolwsd..."
@@ -248,6 +250,7 @@ define start_loolwsd
 			--o:logging.file[@enable]=true --o:logging.level=trace \
 			--port=$(FREE_PORT) \
 			--pidfile=$(PID_FILE) \
+			$(if $(findstring php-proxy, $(CYPRESS_INTEGRATION)),--o:net.proxy_prefix=true) \
 			 > /dev/null 2>&1 &
 	@$(WAIT_ON_BINARY) http://localhost:$(FREE_PORT) --timeout 60000
 	@echo
diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js
index 4ef9cd937..9c1823b81 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -31,18 +31,20 @@ function loadTestDocLocal(fileName, subFolder, noFileCopy) {
 	});
 
 	// Open test document
-	var URI;
+	var URI = 'http://localhost';
+	if (Cypress.env('INTEGRATION') === 'php-proxy') {
+		URI += '/richproxy/proxy.php?req=';
+	} else {
+		URI += ':' + Cypress.env('SERVER_PORT');
+	}
+
 	if (subFolder === undefined) {
-		URI = 'http://localhost:'+
-			Cypress.env('SERVER_PORT') +
-			'/loleaflet/' +
+		URI += '/loleaflet/' +
 			Cypress.env('WSD_VERSION_HASH') +
 			'/loleaflet.html?lang=en-US&file_path=file://' +
 			Cypress.env('WORKDIR') + fileName;
 	} else {
-		URI = 'http://localhost:'+
-			Cypress.env('SERVER_PORT') +
-			'/loleaflet/' +
+		URI += '/loleaflet/' +
 			Cypress.env('WSD_VERSION_HASH') +
 			'/loleaflet.html?lang=en-US&file_path=file://' +
 			Cypress.env('WORKDIR') + subFolder + '/' + fileName;
@@ -192,6 +194,11 @@ function loadTestDoc(fileName, subFolder, noFileCopy) {
 	// Wait for the document to fully load
 	cy.get('.leaflet-tile-loaded', {timeout : Cypress.config('defaultCommandTimeout') * 2.0});
 
+	// The client is irresponsive for some seconds after load, because of the incoming messages.
+	if (Cypress.env('INTEGRATION') === 'php-proxy') {
+		cy.wait(10000);
+	}
+
 	// Wait for the sidebar to open.
 	doIfOnDesktop(function() {
 		// sometimes sidebar fails to open
@@ -360,11 +367,16 @@ function afterAll(fileName) {
 				.should('not.exist');
 
 		}
-	} else if (Cypress.env('SERVER_PORT') === 9979) {
+	} else if (Cypress.env('SERVER_PORT') === 9979 || Cypress.env('INTEGRATION') === 'php-proxy') {
 		// Make sure that the document is closed
-		cy.visit('http://admin:admin@localhost:' +
-			Cypress.env('SERVER_PORT') +
-			'/loleaflet/dist/admin/admin.html');
+		if (Cypress.env('INTEGRATION') === 'php-proxy') {
+			cy.visit('http://admin:admin@localhost/richproxy/proxy.php?req=' +
+				'/loleaflet/dist/admin/admin.html');
+		} else {
+			cy.visit('http://admin:admin@localhost:' +
+				Cypress.env('SERVER_PORT') +
+				'/loleaflet/dist/admin/admin.html');
+		}
 
 		cy.wait(5000);
 	} else {
diff --git a/cypress_test/support/index.js b/cypress_test/support/index.js
index 8f683db34..26bed2b2b 100644
--- a/cypress_test/support/index.js
+++ b/cypress_test/support/index.js
@@ -1,3 +1,11 @@
-/* global require */
+/* global require Cypress */
 
 require('cypress-failed-log');
+
+if (Cypress.env('INTEGRATION') === 'php-proxy') {
+	Cypress.Server.defaults({
+		whitelist: function() {
+			return true;
+		}
+	});
+}


More information about the Libreoffice-commits mailing list