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

Why does this gem create cypress examples? #48

Closed
vfonic opened this issue Apr 4, 2020 · 8 comments · Fixed by #79
Closed

Why does this gem create cypress examples? #48

vfonic opened this issue Apr 4, 2020 · 8 comments · Fixed by #79

Comments

@vfonic
Copy link
Contributor

vfonic commented Apr 4, 2020

I've noticed that, after I run bin/rails g cypress_on_rails:install, I got a lot of cypress-only examples (not related to cypress-on-rails gem).

At first I thought these were somehow related to added functionality of cypress-on-rails and spent some time trying to find out what's added. But it turns out that that's not the case. As far as I can tell, these are just examples of how to use cypress API.

If that's the case, I'd suggest focusing on keeping the cypress-on-rails-specific examples, which would make it easier for user (developer) to get the hang of cypress-of-rails added functionality.
Cypress-only examples could be suggested to be added to the main cypress repo. Or you could simply have a link in README to where these examples are already located.

This is the commit that originally added these examples:
fc84511

Maybe it made sense back then, but now I'd remove it and simplify the gem by also being able to remove --no-install-cypress-examples.

I think with v2.0.0 around the corner, this would be a perfect time to remove it.

What do you think?

@yagudaev
Copy link
Contributor

yagudaev commented Apr 4, 2020

I agree, the examples of cypress ships with are pretty useless and very half-stack. We should get rid of them and replace them with cypress-on-rails specific examples instead.

@grantspeelman
Copy link
Collaborator

The reason is comes with the Cypress examples is to make it more friendly to newbies of Cypress. Basically Cypress is still pretty new and this gem can be someones first introduction to it, thus both sets of examples are needed.

@vfonic
Copy link
Contributor Author

vfonic commented Apr 7, 2020

I agree. It would be good to be able to have/generate (not necessarily automatically) both sets of examples.

I've replied in more detail here: #24

@grantspeelman
Copy link
Collaborator

I guess we could ask the question in the generator on whether or not they want the examples. Should cater for both the newbie and pro.

@yagudaev
Copy link
Contributor

@grantspeelman I propose we do get rid of examples that are not rails specific. I've spent a few days digging into rails generators in general to improve workflow on my team. I essentially overwrote the rails generators and extended them so that running

rails scaffold Widget name:string number:integer
# of if the model already exists
rails scaffold_controller Widget name:string number:integer

This create much more useful generators. It does require something like

# application.rb
    config.generators do |g|
      g.test_framework :cypress_and_rspec
   end

I'll try to wrap it all up in an article about generators and a PR for this specific generator as I think people would find it really useful.

@grantspeelman
Copy link
Collaborator

I still learning towards making it easier for beginners of cypress.

You can disable the cypress examples with a flag --no-install-cypress-examples.
If we add that to the README.md would that be good enough?

@vfonic
Copy link
Contributor Author

vfonic commented Aug 12, 2020

Basically Cypress is still pretty new and this gem can be someones first introduction to it, thus both sets of examples are needed.

First version (v0.1.0) of Cypress is 5 years old and v1 is 3 years old. In JS world, I'd call that old, not new. It also has 6.5M downloads a month. It's pretty well established.

On the other hand, in Rails world, many people will add Cypress on existing project. And although many of those people will be new to Cypress, I don't believe I've seen many other packages add examples that you'd later remove. Ruby gems don't tend to do this. (Please correct me if I'm wrong.)

I've seen config files with examples/defaults commented out, but code examples...that seems more like something we can use Rails generators for, at least in Rails world.

Anyway, it's not that big of a deal. It's your call and I already said I'd do it differently (but it's not that important). I guess the best solution is to decide on one of the three options (mentioned below) and focus on more important features.

I think these are the only three steps forward:

  1. "WON'T FIX" - close this issue, it won't be changed
  2. Add the --no-install-cypress-examples to README
  3. By default skip generating Cypress examples
    3.a) Skip generating Cypress examples and document it in README

@grantspeelman
Copy link
Collaborator

even though old in JS world terms, it's not old in people terms.
That said, think I'll make it optional and add to the README telling people how to generate the examples if they are new to cypress.

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

Successfully merging a pull request may close this issue.

3 participants