Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
akashtippa123 opened this issue Sep 27, 2020 · 35 comments
Open

Comments

@akashtippa123
Copy link

akashtippa123 commented Sep 27, 2020

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

@javieraviles
Copy link
Owner

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.

@akashtippa123
Copy link
Author

akashtippa123 commented Sep 27, 2020

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

@javieraviles
Copy link
Owner

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

@akashtippa123
Copy link
Author

akashtippa123 commented Sep 27, 2020

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

screen

@akashtippa123
Copy link
Author

akashtippa123 commented Sep 27, 2020

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

@javieraviles
Copy link
Owner

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.

@akashtippa123
Copy link
Author

akashtippa123 commented Sep 28, 2020

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

@javieraviles
Copy link
Owner

Just remove cypress\fixtures\ from your const yourFiturePath:

const yourFiturePath = 'hd4'

@akashtippa123
Copy link
Author

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

@javieraviles
Copy link
Owner

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

@akashtippa123
Copy link
Author

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

@javieraviles
Copy link
Owner

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

@akashtippa123
Copy link
Author

akashtippa123 commented Sep 28, 2020

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

@javieraviles
Copy link
Owner

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

@akashtippa123
Copy link
Author

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

@javieraviles
Copy link
Owner

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?

@akashtippa123
Copy link
Author

akashtippa123 commented Sep 28, 2020 via email

@javieraviles
Copy link
Owner

maybe is a matter of waiting?

@akashtippa123
Copy link
Author

akashtippa123 commented Sep 28, 2020

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

@javieraviles
Copy link
Owner

javieraviles commented Sep 28, 2020

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

@akashtippa123
Copy link
Author

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

@javieraviles
Copy link
Owner

why are you so sure of that?

@akashtippa123
Copy link
Author

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

@javieraviles
Copy link
Owner

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

@akashtippa123
Copy link
Author

yes on this form image is optional

@javieraviles
Copy link
Owner

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

@akashtippa123
Copy link
Author

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

@javieraviles
Copy link
Owner

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

@akashtippa123
Copy link
Author

akashtippa123 commented Sep 28, 2020

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

@akashtippa123
Copy link
Author

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

@javieraviles
Copy link
Owner

That's exactly what the package.json file is meant for, have a look! https://github.com/javieraviles/cypress-upload-file-post-form/blob/master/package.json

@Janani123-hub
Copy link

I am getting the same error. Please help me out to resolve it. My cypress version is "cypress": "^9.4.1"

@rgupta8888
Copy link

I am also getting exactly same errors which @akashtippa123 mentioning.

@shivamGit123
Copy link

I am also getting the same error , my cypress version is 12.3.0

@id-dan
Copy link

id-dan commented Mar 5, 2023

pls try to delete "fixturesFolder" from cypress.config.js/ts,
https://stackoverflow.com/a/75539482

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants