diff --git a/cypress/integration/Post.Images.feature b/cypress/integration/Post.Images.feature index d00f5f9f9..5b03c047c 100644 --- a/cypress/integration/Post.Images.feature +++ b/cypress/integration/Post.Images.feature @@ -18,6 +18,7 @@ Feature: Upload/Delete images on posts Then I should be able to "add" a teaser image And I add all required fields And I click on "save button" + And I wait for 750 milliseconds Then I am on page ".../new-post" And I wait for 750 milliseconds And the post was saved successfully with the "new" teaser image @@ -27,6 +28,7 @@ Feature: Upload/Delete images on posts And I should be able to "change" a teaser image And I click on "save button" Then I see a toaster with "Saved!" + And I wait for 750 milliseconds And I am on page ".../post-to-be-updated" And I wait for 750 milliseconds Then the post was saved successfully with the "updated" teaser image @@ -40,9 +42,10 @@ Feature: Upload/Delete images on posts Scenario: Add image, then delete it When I click on "create post button" Then I should be able to "add" a teaser image - And I should be able to remove the image + Then I should be able to "remove" a teaser image And I add all required fields And I click on "save button" + And I wait for 750 milliseconds Then I am on page ".../new-post" And I wait for 750 milliseconds And the "new" post was saved successfully without a teaser image @@ -50,8 +53,9 @@ Feature: Upload/Delete images on posts Scenario: Delete existing image Given I navigate to page "post/edit/p1" And my post has a teaser image - Then I should be able to remove the image + Then I should be able to "remove" a teaser image And I click on "save button" + And I wait for 750 milliseconds Then I am on page ".../post-to-be-updated" And I wait for 750 milliseconds And the "updated" post was saved successfully without a teaser image \ No newline at end of file diff --git a/cypress/integration/Post.Images/I_should_be_able_to_remove_the_image.js b/cypress/integration/Post.Images/I_should_be_able_to_remove_the_image.js deleted file mode 100644 index 76e238f1c..000000000 --- a/cypress/integration/Post.Images/I_should_be_able_to_remove_the_image.js +++ /dev/null @@ -1,6 +0,0 @@ -import { Then } from "cypress-cucumber-preprocessor/steps"; - -Then('I should be able to remove the image', () => { - cy.get('.delete-image-button' /* .dz-message > .base-button .crop-cancel*/) - .click() -}) \ No newline at end of file diff --git a/cypress/integration/Post.Images/I_should_be_able_to_{string}_a_teaser_image.js b/cypress/integration/Post.Images/I_should_be_able_to_{string}_a_teaser_image.js index 9c089d674..ce5b54f25 100644 --- a/cypress/integration/Post.Images/I_should_be_able_to_{string}_a_teaser_image.js +++ b/cypress/integration/Post.Images/I_should_be_able_to_{string}_a_teaser_image.js @@ -1,12 +1,30 @@ import { Then } from "cypress-cucumber-preprocessor/steps"; Then("I should be able to {string} a teaser image", condition => { - cy.reload() - const teaserImageUpload = (condition === 'change') ? "humanconnection.png" : "onourjourney.png"; - cy.fixture(teaserImageUpload).as('postTeaserImage').then(function() { - cy.get("#postdropzone").upload( - { fileContent: this.postTeaserImage, fileName: teaserImageUpload, mimeType: "image/png" }, - { subjectType: "drag-n-drop", force: true } - ); - }) + // cy.reload() + switch(condition){ + case 'change': + cy.get('.delete-image-button') + .click() + cy.fixture('humanconnection.png').as('postTeaserImage').then(function() { + cy.get("#postdropzone").upload( + { fileContent: this.postTeaserImage, fileName: 'humanconnection.png', mimeType: "image/png" }, + { subjectType: "drag-n-drop", force: true } + ).wait(750); + }) + break; + case 'add': + cy.fixture('onourjourney.png').as('postTeaserImage').then(function() { + cy.get("#postdropzone").upload( + { fileContent: this.postTeaserImage, fileName: 'onourjourney.png', mimeType: "image/png" }, + { subjectType: "drag-n-drop", force: true } + ).wait(750); + }) + break; + case 'remove': + cy.get('.delete-image-button') + .click() + break; + } + }) \ No newline at end of file diff --git a/cypress/integration/common/.post.js b/cypress/integration/common/.post.js index 16f65d29a..6beaf7e96 100644 --- a/cypress/integration/common/.post.js +++ b/cypress/integration/common/.post.js @@ -38,10 +38,4 @@ And("the post with title {string} has a ribbon for pinned posts", (title) => { /* Then('confirm crop', () => { cy.get('.crop-confirm') .click() -}) */ - - -/*Then('I should be able to remove the image', () => { - cy.get('.dz-message > .base-button') - .click() -})*/ +}) */ \ No newline at end of file