Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CQ-4356927 UI Tests in WKND project fails occasionally #452

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui.tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN apt -qqy update \
# Generic dependencies
&& apt -qqy --no-install-recommends install \
python \
curl \
build-essential

# Set Application Environment
Expand Down
19 changes: 19 additions & 0 deletions ui.tests/test-module/cypress/support/aem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()

mateusz-kochanek marked this conversation as resolved.
Show resolved Hide resolved
// 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.
Expand Down Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions ui.tests/test-module/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading