I have created a custom command that takes in the file name, mime type, encoding, and an attribute value to grab the specific component that will be handling the upload. Everything works, but I have found that Cypress will move on to the next test, even though the upload has not completed. Which can fail future tests waiting for the data from the upload.
I want to be able to track the output so I can halt Cypress from continuing on until upload is complete
There really aren't reproducible steps, but I will include my custom command so you can see what I am currently doing.
Cypress.Commands.add(
'upload_via_dropzone',
(attrVal, fileName, mimeType, encoding, subjectType = 'drag-n-drop') => {
return cy.fixture(fileName, encoding).then(fileContent => {
cy.get(`[data-test="${attrVal}"]`).upload(
{ fileContent, fileName, mimeType, encoding },
{ subjectType, force: true },
);
});
},
);
Cypres v3.3.1, OS: Mojave, Chrome
Hi @zach446
Thanks for submitting the issue!
I think that is definitely a good case. Hopefully investigate that during the weekend.
Well, after thinking a while here's the suggestion.
I think the upload process you mention is more about waiting network request to complete – correct me if I'm wrong.
If that is correct, the only way to do it properly is:
https://docs.cypress.io/api/commands/wait.html#Wait-for-a-specific-XHR-to-respond
Does this help? Or you have something else on your mind?
I see what you mean. The API call I make after I upload is the process that needs to be waited on, not the upload itself. That makes more sense. I don't know why I was thinking it was the other way around.
I will show myself out lol
Most helpful comment
I see what you mean. The API call I make after I upload is the process that needs to be waited on, not the upload itself. That makes more sense. I don't know why I was thinking it was the other way around.
I will show myself out lol