From 5ea5cb3527f34b0bce483e4f9b33770dc96688b9 Mon Sep 17 00:00:00 2001 From: Mateusz Kochanek Date: Wed, 10 Apr 2024 08:21:57 +0200 Subject: [PATCH] CQ-4356927 UI Tests in WKND project fails --- .../src/conf.d/available_vhosts/wknd.vhost | 4 ++++ .../available_farms/wknd.farm | 10 +++++----- ui.tests/test-module/cypress/support/aem.js | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/dispatcher/src/conf.d/available_vhosts/wknd.vhost b/dispatcher/src/conf.d/available_vhosts/wknd.vhost index 2cdc8235c0..4769fe3e05 100644 --- a/dispatcher/src/conf.d/available_vhosts/wknd.vhost +++ b/dispatcher/src/conf.d/available_vhosts/wknd.vhost @@ -135,6 +135,10 @@ Include conf.d/variables/custom.vars RewriteEngine on Include conf.d/rewrites/rewrite.rules + + # Rewrite index page internally, pass through (PT) + RewriteRule "^(/?)$" "/index.html" [PT] + ErrorDocument 404 ${404_PAGE} ErrorDocument 500 ${500_PAGE} diff --git a/dispatcher/src/conf.dispatcher.d/available_farms/wknd.farm b/dispatcher/src/conf.dispatcher.d/available_farms/wknd.farm index 3df6e0af96..4a2fe9b1e8 100644 --- a/dispatcher/src/conf.dispatcher.d/available_farms/wknd.farm +++ b/dispatcher/src/conf.dispatcher.d/available_farms/wknd.farm @@ -90,12 +90,12 @@ # Marketing parameters can normally be ignored on most websites as they are tracked # through different means. /ignoreUrlParams { - # All parameters can be passed to the AEM publisher - /0001 { /glob "*" /type "deny" } + # All parameters can be passed to the AEM publisher + /0001 { /glob "*" /type "deny" } - # Ignore common marketing parameters by including the marketing_query_parameters.any file - $include "../cache/marketing_query_parameters.any" - } + # Ignore common marketing parameters by including the marketing_query_parameters.any file + $include "../cache/marketing_query_parameters.any" + } # Cache response headers next to a cached file. On the first request to # an uncached resource, all headers matching one of the values found here diff --git a/ui.tests/test-module/cypress/support/aem.js b/ui.tests/test-module/cypress/support/aem.js index 4c67a4896a..60286d5c10 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