File upload can't preview after uploading #30399
Unanswered
benjaminagbong
asked this question in
Component Testing
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I really need help to fix this issue. I have successfully uploaded an image into the application, but i cannot submit my data because the image does not preview.
So how do I preview an image with cypress after uploading?
Here is the code snippet:
cy.get('#public_event_thumbnail').click()
// cy.get('#public_event_thumbnail') // Use the correct selector for the upload element
.selectFile('cypress/fixtures/logo.png', { force: true }); // Make sure 'logo.png' is in the fixtures folder
// Wait for the image preview to render
cy.wait(5000)
// cy.get('.cropit-preview-image') // Adjust the selector to match your preview image element
// .should('be.visible') // Ensure the preview image is visible
// .and(($img) => {
// // Optionally, check if the src attribute of the img tag contains the image file name
// expect($img[0].src).to.contain('logo.png'); // Check if the preview contains the correct image
// });
// Submit the event
cy.get('.step-1 > .panel-footer > .row > .col-sm-12 > .btn-primary').click();
};
Beta Was this translation helpful? Give feedback.
All reactions