我有一个接受文件并使用的表单cypress-file-upload,我让它正常工作。但是我也有一个场景,当没有文件上传时我需要验证错误。包本身正在验证文件是否存在。在这种情况下我们如何测试?
cy.get('input[type="file"]').attachFile();// Cannot read property 'filePath' of undefined
cy.get('input[type="file"]').attachFile(""); //missing "filePath" or "fileName".
Please make sure you are passing either "filePath" or "fileName"
cy.get('input[type="file"]').attachFile("expense1.json")//Works for the positive case
cy.get(".alert").should('be.visible').and('contain', "You poor guy did not upload a file...")