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

Looking for for fixture files within subdirectories inside cypress/fixtures #14866

Closed
mohsenny opened this issue Feb 2, 2021 · 2 comments
Closed

Comments

@mohsenny
Copy link

mohsenny commented Feb 2, 2021

What would you like?

Currently fixture files (yml, json, etc) and fixture images (using cypress-file-upload module to test upload functionalities) should be directly inside the /fixtures directory, and creating directories inside /fixtures and placing the files there, would trigger an error that:

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

Having the fixture files directly under /fixtures causes no issues:

Screenshot 2021-02-02 at 11 24 37

Screenshot 2021-02-02 at 11 24 12

However having the under a subdirectory ( like: /fixtures/translations) causes the issue:

Screenshot 2021-02-02 at 11 23 50

Screenshot 2021-02-02 at 11 23 27

Why is this needed?

This is needed for better organizing fixtures files. Currently we have many fixtures files, from various translations, database seeding files to image files (for testing upload functionalities using cypress-file-upload module). At this moment all the files are mixed together inside /fixtures directory but ideally we would prefer to have separate sub directories like:

  • fixtures
  • fixtures/seed_files
  • fixtures/images
  • fixtures/translations
  • ...

Development Setup

  • cypress": "^5.6.0
  • cypress-file-upload": "^5.0.2"
  • node version: 15.3.0
@mwmcode
Copy link

mwmcode commented Feb 2, 2021

cyfix copy

I organize fixtures in folders and it works fine (cypress 5.6 & 6.4), maybe check your file path/name

cypress-file-upload is not maintained by cypress-io. that library seems to check inside fixtures/ by default

cy.get('[data-cy="file-input"]')
  .attachFile(['myfixture1.json', 'myfixture2.json']);

so maybe try passing it translations/es.json might work

@cypress-bot cypress-bot bot added the stage: awaiting response Potential fix was proposed; awaiting response label Feb 3, 2021
@mohsenny
Copy link
Author

mohsenny commented Feb 5, 2021

@mcha-dev you're absolutely right. Sorry for the noise 😓

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

3 participants