Skip to content

Commit

Permalink
chore: Fix assets cypress test
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvac committed Aug 23, 2023
1 parent cccf6e1 commit 5642e2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

describe('AEM Assets', f => {
describe('AEM Assets', () => {

beforeEach(() => {
// End any existing user session
Expand All @@ -24,7 +24,7 @@ describe('AEM Assets', f => {
cy.AEMLogin(Cypress.env('AEM_AUTHOR_USERNAME'), Cypress.env('AEM_AUTHOR_PASSWORD'))
})

it('should be possible to upload an asset', f => {
it('should be possible to upload an asset', () => {
const assetsPath = '/content/dam';
const imageName = 'image.png';
const imagePath = `${assetsPath}/${imageName}`;
Expand All @@ -40,7 +40,8 @@ describe('AEM Assets', f => {
cy.get('coral-dialog.is-open coral-dialog-footer [variant="primary"]').click();

// Wait until Asset exists
cy.waitUntil(() => cy.AEMPathExists(Cypress.env('AEM_AUTHOR_URL'), imagePath), {errorMsg: `asset ${imagePath} should exist`}, {
cy.waitUntil(() => cy.AEMPathExists(Cypress.env('AEM_AUTHOR_URL'), imagePath), {
errorMsg: `asset ${imagePath} should exist`,
timeout: 10000,
interval: 500
});
Expand All @@ -52,7 +53,8 @@ describe('AEM Assets', f => {
cy.AEMDeleteAsset(imagePath);

// Wait until Asset does not exist anymore
cy.waitUntil(() => cy.AEMPathExists(Cypress.env('AEM_AUTHOR_URL'), imagePath).then(result => !result), {errorMsg: `asset ${imagePath} should not exist`}, {
cy.waitUntil(() => cy.AEMPathExists(Cypress.env('AEM_AUTHOR_URL'), imagePath).then(result => !result), {
errorMsg: `asset ${imagePath} should not exist`,
timeout: 10000,
interval: 500
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Cypress.Commands.add('AEMPathExists', function (baseUrl, path) {
failOnStatusCode: false,
})
.then(response => {
return (response.status == 200)
return (response.status === 200)
});
})

Expand Down

0 comments on commit 5642e2e

Please sign in to comment.