diff --git a/ui.tests/Dockerfile b/ui.tests/Dockerfile index 09e0b9ef59..51a41f2c38 100644 --- a/ui.tests/Dockerfile +++ b/ui.tests/Dockerfile @@ -19,6 +19,7 @@ RUN apt -qqy update \ # Generic dependencies && apt -qqy --no-install-recommends install \ python \ + curl \ build-essential # Set Application Environment diff --git a/ui.tests/test-module/cypress/support/aem.js b/ui.tests/test-module/cypress/support/aem.js index 4c67a4896a..8355fb6c4d 100644 --- a/ui.tests/test-module/cypress/support/aem.js +++ b/ui.tests/test-module/cypress/support/aem.js @@ -142,6 +142,13 @@ Cypress.Commands.add('AEMDeletePage', function (path, ignoreVerification = false cy.get('coral-dialog[aria-hidden="false"] coral-checkbox[name="archive"] input').uncheck() // confirm the delete dialog cy.get('coral-dialog[aria-hidden="false"] ._coral-Button--warning').click() + + // wait until page is deleted + cy.waitUntil(() => cy.AEMPathNotExists(Cypress.env('AEM_PUBLISH_URL'), path + '.html'), { + errorMsg: `page ${path} should not exist`, + timeout: 15000, + interval: 1000 + }); }) // AEMDeleteTestPages will find pages in the current path that match the pattern and delete them. @@ -188,6 +195,18 @@ Cypress.Commands.add('AEMPathExists', function (baseUrl, path) { }) }) +Cypress.Commands.add('AEMPathNotExists', function (baseUrl, path) { + const url = new URL(path, baseUrl) + + return cy.request({ + url: url.href, + failOnStatusCode: false + }) + .then(response => { + return (response.status === 404) + }) +}) + Cypress.Commands.add('AEMDeleteAsset', function (assetPath) { const tokenUrl = new URL('/libs/granite/csrf/token.json', Cypress.env('AEM_AUTHOR_URL')) let csrfToken diff --git a/ui.tests/test-module/run.sh b/ui.tests/test-module/run.sh index 2fd2d803e1..1fb1254e3e 100755 --- a/ui.tests/test-module/run.sh +++ b/ui.tests/test-module/run.sh @@ -24,5 +24,24 @@ ps aux | grep Xvfb # disable color output when running Cypress export NO_COLOR=1 #export ELECTRON_EXTRA_LAUNCH_ARGS=--remote-debugging-port=9222 + +# setup proxy environment variables +if [ -n "${PROXY_HOST:-}" ]; then + if [ -n "${PROXY_HTTPS_PORT:-}" ]; then + export HTTP_PROXY="https://${PROXY_HOST}:${PROXY_HTTPS_PORT}" + elif [ -n "${PROXY_HTTP_PORT:-}" ]; then + export HTTP_PROXY="http://${PROXY_HOST}:${PROXY_HTTP_PORT}" + fi + if [ -n "${PROXY_CA_PATH:-}" ]; then + export NODE_EXTRA_CA_CERTS=${PROXY_CA_PATH} + fi + if [ -n "${PROXY_OBSERVABILITY_PORT:-}" ] && [ -n "${HTTP_PROXY:-}" ]; then + echo "Waiting for proxy" + curl --silent --retry ${PROXY_RETRY_ATTEMPTS:-3} --retry-connrefused --retry-delay ${PROXY_RETRY_DELAY:-10} \ + --proxy ${HTTP_PROXY} --proxy-cacert ${PROXY_CA_PATH:-""} \ + ${PROXY_HOST}:${PROXY_OBSERVABILITY_PORT} + fi +fi + # execute tests npm test