cypress-upload-file-post-form
cypress-upload-file-post-form copied to clipboard
A fixture file could not be found at any of the following paths:
Code
it('Questionnaires ', function() { const yourFiturePath = 'cypress\fixtures\pic\hd4.jpg
cy.get('.upload-button').attachFile(yourFiturePath) cy.get('.save').click() }
hd4.jpg file is present in the given path but It's giving me the error

the naming in the image file and its path looks so weird to me...
In the code you wrote cypress\fixtures\pic\hd4.jpg.
In the error shows cypress\fixtures\cypressixtureshd4.jpg, but looks like there is some strange symbol between cypress and ixtureshd4.jpg you are missing. Also seems like extension should not be provided since Cypress is trying many extensions for you already attached to the filename.
this time I tried this code
t('Questionnaires ', function() { const yourFiturePath = 'cypress\fixtures\hd4
cy.get('.upload-button').attachFile(yourFiturePath) cy.get('.save').click() }
same error I got, if you help me to resolve, it's very helpful for me
could you attach the error? I am pretty sure it is some issue regarding paths/naming
hd4 picture is present in the fixture folder but its telling file found

Do you have a solution for resolving this issue, please help me, I am trying to resolve this issue from a long day
So again, your code is looking for cypress\fixtures\cypressixtureshd4.jpg, but I think your file is actually cypress\fixtures\hd4.jpg. To me it looks like you are passing the path cypress\fixtures twice somehow, resulting into your code thinking your file name is cypress\fixtures\hd4 where \f is some special character (as it looks in your screenshot, red section, top part) which gets omitted in the end -> filename: cypressixtureshd4 which of course does not exist.
No, I am not passing twice path, and there is no special char at all My code exactly it is only, Really I don't understand from where that special char is coming it('Questionnaires ', function() { const yourFiturePath = 'cypress\fixtures\hd4'
cy.get('.upload-button').attachFile(yourFiturePath) cy.get('.save').click() }
Just remove cypress\fixtures\ from your const yourFiturePath:
const yourFiturePath = 'hd4'
Yes I tried as you suggested this time I didn't get any error but still, the photo is not uploaded it('Questionnaires ', function() { const yourFiturePath = 'hd4'
cy.get('.upload-button').attachFile(yourFiturePath) cy.get('.save').click() }
well now your problem from the logs is solved. You might have an additional one somewhere else :)
yes but still the problem is not resolved, I am trying to resolve this, please let me know you have any solution for this
as i said, the first problem is solved, you seem to have another one. If you want help, at least show the error :)
I don't get any error everything fine Test case passed but the picture not uploaded

i dont see any assertion checking whether the image got uploaded or not. How do you check?
After uploading the image it will show "Image uploaded successfully" but Assertion is failed because the picture is not uploaded.
it('Questionnaires ', function() {
const yourFiturePath = 'hd4'
cy.get('.upload-button').attachFile(yourFiturePath)
cy.get('.ant-notification-notice').should('contain.text','Image uploaded successfully')
}

If you do it manually do you see the notification right after clicking save? no additional steps?
maybe is a matter of waiting?
I think you can debug the test running cypress in a visual mode, can you see the pop up there?
Yes I after uploading picture it will show success message
On Mon, 28 Sep, 2020, 2:54 pm Javier Aviles, [email protected] wrote:
If you do it manually do you see the notification right after clicking save? no additional steps?
maybe is a matter of waiting?
I think you can debug the test running cypress in a visual mode, can you see the pop up there?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/javieraviles/cypress-upload-file-post-form/issues/2#issuecomment-699890756, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOY2SKA6O7J66VUECVQVBITSIBI53ANCNFSM4R3KWYZA .
maybe is a matter of waiting?
manually once I select a picture from local, it will upload the picture then immediately it will show the message, no delay after uploaded the picture
maybe not visually but there is some, try maybe waiting half a second there
yes, I tried but it's not working, the picture is not uploading
why are you so sure of that?
I see in the app after executing the script I don't see picture and pic name see this form after uploading it should show images, image is not shown on image place holder

is the command cy.get('.save').click() working?
yes on this form image is optional
but you are clicking save right after uploading the image, so probably is moving to some other page and notification is never there?
No Scenario is 1: I will enter all fields 2: then I will upload picture 3: After uploading the picture it will show a success message 4: I will validate the success message 5: then I will click on the Save button
the success message will show before I clicking on the save button
if you run cypress test in visual mode, can you see how it uploads the image? maybe play with some big waitings so you have time to check
i see in Visual mode hd4 is -FILE hd4 nothing happened it is a DOM snapshot also tried with 10000 waits
@javieraviles what is the cypress version you are using??