fix some flakyness

This commit is contained in:
Ulf Gebhardt 2021-04-11 15:25:51 +02:00
parent a40cab7f5c
commit aa2fffb947
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
4 changed files with 33 additions and 23 deletions

View File

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

View File

@ -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()
})

View File

@ -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;
}
})

View File

@ -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()
})*/
}) */