[Libreoffice-commits] online.git: cypress_test/integration_tests cypress_test/Makefile.am cypress_test/package.json
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Thu Feb 20 03:49:56 UTC 2020
cypress_test/Makefile.am | 21 ++++++++++++++-------
cypress_test/integration_tests/common/helper.js | 12 +++++++++---
cypress_test/package.json | 1 +
3 files changed, 24 insertions(+), 10 deletions(-)
New commits:
commit eb53dd5a8cec05cdf48941a5248b55f3b27d372c
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Feb 20 02:25:01 2020 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Feb 20 04:49:38 2020 +0100
cypress: Always search for an available port number.
Change-Id: Ibfb80d43cd7f7d4c8cab8e3621bebfc2201d4b2d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89066
Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 58fa873f4..d77710989 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -13,6 +13,10 @@ MOBILE_TEST_FOLDER = ${abs_srcdir}/integration_tests/mobile
MOBILE_DATA_FOLDER = ${abs_srcdir}/data/mobile/
MOBILE_WORKDIR = ${abs_builddir}/workdir/mobile/
+ALLOWED_PORTS = 9980 9979 9978 9977 9976 9975 9974 9973 9972 9971 9970
+
+FREE_PORT=$(shell node_modules/get-port-cli/cli.js --host=127.0.0.1 $(ALLOWED_PORTS))
+
if HAVE_LO_PATH
check-local: @JAILS_PATH@ node_modules
$(call run_JS_error_check)
@@ -39,7 +43,7 @@ run-desktop: @JAILS_PATH@ node_modules
@echo "Open cypress with desktop tests..."
@echo
$(CYPRESS_BINARY) open --config integrationFolder=$(DESKTOP_TEST_FOLDER),userAgent=$(DESKTOP_USER_AGENT) \
- --env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH) \
+ --env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) \
|| true
@pkill loolwsd || true
@@ -49,7 +53,7 @@ run-mobile: @JAILS_PATH@ node_modules
@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),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH) \
+ --env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) \
|| true
@pkill loolwsd || true
@@ -63,15 +67,18 @@ endef
define start_loolwsd
@pkill loolwsd || true
- @echo "Launching loolwsd for testing..."
+ @echo "Found available port for testing: $(FREE_PORT)"
+ @echo
+ @echo "Launching loolwsd..."
@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 \
--disable-ssl \
--o:admin_console.username=admin --o:admin_console.password=admin \
- --o:logging.file[@enable]=true --o:logging.level=trace > /dev/null 2>&1 &
- @node_modules/wait-on/bin/wait-on http://localhost:9980
+ --o:logging.file[@enable]=true --o:logging.level=trace > /dev/null 2>&1 \
+ --port=$(FREE_PORT) &
+ @node_modules/wait-on/bin/wait-on http://localhost:$(FREE_PORT)
@echo
endef
@@ -82,7 +89,7 @@ define run_desktop_tests
$(CYPRESS_BINARY) run --browser $(CHROME) \
--config integrationFolder=$(DESKTOP_TEST_FOLDER),userAgent=$(DESKTOP_USER_AGENT) \
--headless \
- --env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH) \
+ --env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) \
$(if $(1), --spec=${abs_dir}/integration_tests/desktop/$(1)) \
|| (pkill loolwsd && false)
endef
@@ -94,7 +101,7 @@ define run_mobile_tests
$(CYPRESS_BINARY) run --browser $(CHROME) \
--config integrationFolder=$(MOBILE_TEST_FOLDER),userAgent=$(MOBILE_USER_AGENT) \
--headless \
- --env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH) \
+ --env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) \
$(if $(1), --spec=$(abs_dir)/integration_tests/mobile/$(1)) \
|| (pkill loolwsd && false)
endef
diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js
index 388423ac2..6c7147097 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -23,12 +23,16 @@ function loadTestDoc(fileName, subFolder, mobile) {
// Open test document
var URI;
if (subFolder === undefined) {
- URI = 'http://localhost:9980/loleaflet/' +
+ URI = 'http://localhost:'+
+ Cypress.env('SERVER_PORT') +
+ '/loleaflet/' +
Cypress.env('WSD_VERSION_HASH') +
'/loleaflet.html?lang=en-US&file_path=file://' +
Cypress.env('WORKDIR') + fileName;
} else {
- URI = 'http://localhost:9980/loleaflet/' +
+ URI = 'http://localhost:'+
+ Cypress.env('SERVER_PORT') +
+ '/loleaflet/' +
Cypress.env('WSD_VERSION_HASH') +
'/loleaflet.html?lang=en-US&file_path=file://' +
Cypress.env('WORKDIR') + subFolder + '/' + fileName;
@@ -147,7 +151,9 @@ function beforeAllMobile(fileName, subFolder) {
function afterAll() {
// Make sure that the document is closed
- cy.visit('http://admin:admin@localhost:9980/loleaflet/dist/admin/admin.html');
+ cy.visit('http://admin:admin@localhost:' +
+ Cypress.env('SERVER_PORT') +
+ '/loleaflet/dist/admin/admin.html');
cy.get('#doclist')
.should('exist');
cy.get('#doclist tr')
diff --git a/cypress_test/package.json b/cypress_test/package.json
index 0d80d1173..07e378814 100644
--- a/cypress_test/package.json
+++ b/cypress_test/package.json
@@ -6,6 +6,7 @@
"dependencies": {
"cypress": "3.8.3",
"eslint": "6.8.0",
+ "get-port-cli": "2.0.0",
"wait-on": "4.0.0"
},
"repository": {
More information about the Libreoffice-commits
mailing list