diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2020-09-14 15:53:51 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2020-09-15 15:40:22 +0200 |
commit | f6d5cf9c3fdd6def25f2c2d3911ba580b00709df (patch) | |
tree | 7dd7ad1cbdf0e3151cddc3cff5e6aaa3d88ce3d4 | |
parent | Mobile: Set icon for combobox rotation (diff) | |
download | online-f6d5cf9c3fdd6def25f2c2d3911ba580b00709df.tar.gz online-f6d5cf9c3fdd6def25f2c2d3911ba580b00709df.zip |
cypress: support running tests with php-proxy.
Change-Id: I9fe4a974582e0475026f6798a338bae033e6d7e6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102733
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r-- | cypress_test/Makefile.am | 5 | ||||
-rw-r--r-- | cypress_test/integration_tests/common/helper.js | 34 | ||||
-rw-r--r-- | cypress_test/support/index.js | 10 |
3 files changed, 36 insertions, 13 deletions
diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am index 8218861374..429473e305 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 4ef9cd9376..9c1823b812 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 8f683db34b..26bed2b2b5 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; + } + }); +} |