cypress-upload-file-post-form icon indicating copy to clipboard operation
cypress-upload-file-post-form copied to clipboard

A fixture file could not be found at any of the following paths:

Open akashtippa123 opened this issue 5 years ago • 35 comments

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 tile

akashtippa123 avatar Sep 27 '20 05:09 akashtippa123

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.

javieraviles avatar Sep 27 '20 14:09 javieraviles

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

akashtippa123 avatar Sep 27 '20 16:09 akashtippa123

could you attach the error? I am pretty sure it is some issue regarding paths/naming

javieraviles avatar Sep 27 '20 16:09 javieraviles

hd4 picture is present in the fixture folder but its telling file found

screen

akashtippa123 avatar Sep 27 '20 16:09 akashtippa123

Do you have a solution for resolving this issue, please help me, I am trying to resolve this issue from a long day

akashtippa123 avatar Sep 27 '20 16:09 akashtippa123

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.

javieraviles avatar Sep 27 '20 20:09 javieraviles

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() }

akashtippa123 avatar Sep 28 '20 03:09 akashtippa123

Just remove cypress\fixtures\ from your const yourFiturePath:

const yourFiturePath = 'hd4'

javieraviles avatar Sep 28 '20 06:09 javieraviles

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() }

akashtippa123 avatar Sep 28 '20 07:09 akashtippa123

well now your problem from the logs is solved. You might have an additional one somewhere else :)

javieraviles avatar Sep 28 '20 08:09 javieraviles

yes but still the problem is not resolved, I am trying to resolve this, please let me know you have any solution for this

akashtippa123 avatar Sep 28 '20 08:09 akashtippa123

as i said, the first problem is solved, you seem to have another one. If you want help, at least show the error :)

javieraviles avatar Sep 28 '20 08:09 javieraviles

I don't get any error everything fine Test case passed but the picture not uploaded file

akashtippa123 avatar Sep 28 '20 08:09 akashtippa123

i dont see any assertion checking whether the image got uploaded or not. How do you check?

javieraviles avatar Sep 28 '20 08:09 javieraviles

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') } myfile

akashtippa123 avatar Sep 28 '20 09:09 akashtippa123

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?

javieraviles avatar Sep 28 '20 09:09 javieraviles

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 .

akashtippa123 avatar Sep 28 '20 09:09 akashtippa123

maybe is a matter of waiting?

javieraviles avatar Sep 28 '20 09:09 javieraviles

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

akashtippa123 avatar Sep 28 '20 09:09 akashtippa123

maybe not visually but there is some, try maybe waiting half a second there

javieraviles avatar Sep 28 '20 09:09 javieraviles

yes, I tried but it's not working, the picture is not uploading

akashtippa123 avatar Sep 28 '20 10:09 akashtippa123

why are you so sure of that?

javieraviles avatar Sep 28 '20 10:09 javieraviles

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

form

akashtippa123 avatar Sep 28 '20 10:09 akashtippa123

is the command cy.get('.save').click() working?

javieraviles avatar Sep 28 '20 10:09 javieraviles

yes on this form image is optional

akashtippa123 avatar Sep 28 '20 10:09 akashtippa123

but you are clicking save right after uploading the image, so probably is moving to some other page and notification is never there?

javieraviles avatar Sep 28 '20 10:09 javieraviles

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

akashtippa123 avatar Sep 28 '20 11:09 akashtippa123

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

javieraviles avatar Sep 28 '20 11:09 javieraviles

i see in Visual mode hd4 is -FILE hd4 nothing happened it is a DOM snapshot also tried with 10000 waits

akashtippa123 avatar Sep 28 '20 11:09 akashtippa123

@javieraviles what is the cypress version you are using??

akashtippa123 avatar Sep 30 '20 16:09 akashtippa123