I created a test that requires me to upload a file. I installed cypress-file-upload
dependency into my project. I wrote the following script below. When I run the test it says it passed and that the file was uploaded, but when I check, the file is not uploaded because once a file has been uploaded, a message saying "File has uploaded successfully" should display. This is done with Node and with Angular. This is my first time creating a test of this nature, so any help or leads is appreciated. I followed the documentation, but I am still getting a false positive on my tests. Could the issue be that this particular HTML element is not a form and/or does not use an input?
This is my spec file. The png file is under fixtures in my project folder.
describe("Upload test", () => {
const imageFile = "lp.png";
it("File can upload", () => {
cy.get(".upload-file)").attachFile(imageFile)
});
});
The HTML for my upload file button. The frontend is in Angular.
<div class="button-group ng-star-inserted
<button class="btn btn-primary"/>
/>