How to use fixtures on a custom command. #16013
-
Hello! First of all, thank you very much to the Cypress community and Engineers to have this incredible tool! One question about custom commands and fixtures. If you want to use data from fixtures on custom commands (and not on the specs), what would be the best way to do it? What I wanted to do is: Imagine that you want to register on a web with a new user and want to select a different role/sector on each register randomly. Those roles/sectors are saved as a list on a fixture and I just want to call the register() custom command from the specs. How would you do it? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@estefafdez there are lots of ways to do this, I have written a long-ish blog post https://glebbahmutov.com/blog/fixtures-in-custom-commands/ showing them. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much @bahmutov! I will close the discussion then :) |
Beta Was this translation helpful? Give feedback.
@estefafdez there are lots of ways to do this, I have written a long-ish blog post https://glebbahmutov.com/blog/fixtures-in-custom-commands/ showing them.