From 0d7a58aa5765a9c997a6ad3e4b77863ed5a29176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20Zolnai?= Date: Tue, 1 Sep 2020 14:57:36 +0200 Subject: [PATCH] cypress: add 'make check-proxy-mobile' command. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To run mobile test with php-proxy simulation. It's an initial command, should be improved later, after php proxy simulation nicely works with the tests. Change-Id: Id9d2bacfbf09ca34a2c84e0d32808749df4c1909 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102321 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tamás Zolnai --- cypress_test/Makefile.am | 16 +++++++++++++ .../integration_tests/common/helper.js | 24 +++++++++++-------- test/Makefile.am | 1 - test/UnitPHPProxy.cpp | 2 +- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am index 16bbc28c4..78ab24784 100644 --- a/cypress_test/Makefile.am +++ b/cypress_test/Makefile.am @@ -205,6 +205,22 @@ do-run-cov: @JAILS_PATH@ $(NODE_BINS) $(call run_all_multiuser_tests,COVERAGE_RUN="1") @$(KILL_COMMAND) || true +check-proxy-mobile: @JAILS_PATH@ $(NODE_BINS) + $(call run_JS_error_check) + $(eval FREE_PORT:=9979) + @pkill loolwsd || pkill --signal SIGKILL loolwsd || true + @sleep 5 + ../test/run_unit.sh \ + --test-name unit-php-proxy.la \ + --log-file workdir/php-proxy.log \ + --trs-file workdir/php-proxy.trs \ + --color-tests yes \ + --enable-hard-errors yes \ + --expect-failure no -- ../test/unit-php-proxy.la & + @$(WAIT_ON_BINARY) http://localhost:$(FREE_PORT) --timeout 60000 + $(call run_mobile_tests,$(spec)) + @pkill loolwsd || pkill --signal SIGKILL loolwsd || true + @JAILS_PATH@: mkdir -p $@ diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index 8113ee55e..f461f90cc 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -188,17 +188,21 @@ function afterAll(fileName) { Cypress.env('SERVER_PORT') + '/loleaflet/dist/admin/admin.html'); - cy.get('#uptime') - .should('not.have.text', '0'); + if (Cypress.env('SERVER_PORT') === 9979) { + cy.wait(5000); + } else { + cy.get('#uptime') + .should('not.have.text', '0'); - // We have all lines of document infos as one long string. - // We have PID number before the file names, with matching - // also on the PID number we can make sure to match on the - // whole file name, not on a suffix of a file name. - var regex = new RegExp('[0-9]' + fileName); - cy.get('#docview', { timeout: Cypress.config('defaultCommandTimeout') * 2.0 }) - .invoke('text') - .should('not.match', regex); + // We have all lines of document infos as one long string. + // We have PID number before the file names, with matching + // also on the PID number we can make sure to match on the + // whole file name, not on a suffix of a file name. + var regex = new RegExp('[0-9]' + fileName); + cy.get('#docview', { timeout: Cypress.config('defaultCommandTimeout') * 2.0 }) + .invoke('text') + .should('not.match', regex); + } cy.log('Waiting for closing the document - end.'); } diff --git a/test/Makefile.am b/test/Makefile.am index 899dd0764..967143b3e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -228,7 +228,6 @@ TESTS = \ unit-load.la \ unit-cursor.la \ unit-calc.la \ - unit-php-proxy.la \ unit-insert-delete.la \ unit-close.la \ unit-bad-doc-load.la \ diff --git a/test/UnitPHPProxy.cpp b/test/UnitPHPProxy.cpp index 57c44ac30..b3154415e 100644 --- a/test/UnitPHPProxy.cpp +++ b/test/UnitPHPProxy.cpp @@ -248,7 +248,7 @@ public: lastRequestMS = Util::getNowInMS(); int64_t diff = 0; - while (diff < 15000) + while (diff < 600000) { auto nowMS = Util::getNowInMS(); diff = nowMS - lastRequestMS;