Skip to content

Commit

Permalink
CQ-4356927 UI Tests in WKND project fails
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-kochanek committed May 6, 2024
1 parent 50a5240 commit 5ea5cb3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
4 changes: 4 additions & 0 deletions dispatcher/src/conf.d/available_vhosts/wknd.vhost
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ Include conf.d/variables/custom.vars
<IfModule mod_rewrite.c>
RewriteEngine on
Include conf.d/rewrites/rewrite.rules

# Rewrite index page internally, pass through (PT)
RewriteRule "^(/?)$" "/index.html" [PT]

</IfModule>
ErrorDocument 404 ${404_PAGE}
ErrorDocument 500 ${500_PAGE}
Expand Down
10 changes: 5 additions & 5 deletions dispatcher/src/conf.dispatcher.d/available_farms/wknd.farm
Original file line number Diff line number Diff line change
Expand Up @@ -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
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()

// 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

0 comments on commit 5ea5cb3

Please sign in to comment.