-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Version 2.0 Multiple gems direction #24
Comments
@yagudaev and @justin808 let me know what you think. |
Rspec-expectations has this in the gemspec: s.add_runtime_dependency "rspec-support", "~> #{RSpec::Expectations::Version::STRING.split('.')[0..1].concat(['0']).join('.')}" to pin the common code dependency...
If the codebase is small enough, which it currently is, would just having one master branch be good enough? I'll think more about this on the weekend. |
I thought about it a bit more, going as far as having separate gems might not be worth it yet. |
@grantspeelman @justin808 I don't think that splitting gem into several gems would be reasonable right now. Based on my experience with Cypress in Rails, i think the most valuable thing right now is to organize workflow with backend data. Basically, we have 3 possible sources of data:
We could consider possible wrappers around that scenarios. One particular thing i was thinking about is ability to partly reseting DB. For some cases it would speed up testing, b/c reseting and re-seeding sometimes look pretty heavy. Also having a way to slightly update some data would be really nice feature. I use |
yes, I think splitting it right now might be too early but starting to have the separation inside the gem is where we could start. |
Can you elaborate more on the partly reseting of the DB? is this not something that database_cleaner already provides, ie so won't updating the clean.rb be enough? Or are you thinking tighter integration with database_cleaner so you can specify it's options from within cypress. For example cy.appCleanerStrategy('truncation', { only: ["widgets", "dogs", "some_other_table"] })
cy.appCleanerClean() for the updating data part, maybe something like? # updating
cy.appUpdate([
['Post', 23, { name: 'Cypress on Rails is cool' }],
['User', { find_by: { email: "[email protected]" } }, { name: 'Grant' }]
])
# destroying
cy.appDestroy([
['Post', 23 ],
['User', { where: { active: false } }]
])
# or both
cy.appActiveRecord([
['Post', 'update', 23, { name: 'Cypress on Rails is cool' }],
['Post', 'destroy', 23 ],
['User', 'update', { find_by: { email: "[email protected]" } }, { name: 'Grant' }],
['User', 'destroy_all', { where: { active: false } }]
]) We could create 2 new issues for these and flesh out the examples more and then start looking at how we can implement them. |
@grantspeelman Yeah, your examples looks really good. 👍
For sure, it could be done by adding some logic to My idea was to provide some clean and simple integration with Cypress. In "perfect world" i could use only |
Moved the database cleaning discussion to #26 |
After a long discussion with @grantspeelman in a zoom call. The major issue with v1 is that too many files are generated and thus any gem upgrades are difficult to apply. The solution is to create a complementary node package that encapsulates much of what is generated so that the generator just provides the required configuration files, like cypress_helper.rb with some simple hello world style examples. We also want to bring some of the files in the lib/generators/cypress_on_rails/templates/spec/cypress/app_commands into the gem. CC: @MUTOgen |
I like the idea of the NPM module to encapsulate all the generated commands. Great discussion guys. Sorry for being late to the party, been busy trying to launch our product at work. |
Sorry for coming late to the party. :) Thanks for the great gem! I really love the simplicity of app commands and scenarios. I just started using this gem and I feel at home already. Thank you! :) I had a little bit bumpy road starting to use this gem. The initial onboarding experience for me was a bit "off". I had to go into generated files and remove/refactor the code. I think having all these checks in ruby files for DatabaseCleaner and FactoryBot or FactoryGirl or SmartWrapper, make the code harder to read and harder to maintain. Couple of examples:
This code assumes, if user doesn't use
We should have that else-part removed or at least commented out.
After running the gem's install generator, I don't want to have any code in my app that doesn't work or wouldn't work if I remove some other gem from my app (
I'm not sure in what scenario we'd have both
Does this actually always work? We could maybe use |
@vfonic thanks for you input. So that's a bit about the background and my original thinking. Hopefully this helps with context |
@vfonic on your point number 7 |
@grantspeelman Thanks for the background info! It definitely makes sense. I see now that I agree with you, tighter integration of this gem and smoother experience seems to be the way to go. This approach still keeps only one gem, while providing better/cleaner DX, in my opinion. |
Yes, this is the plan for version 2.
This will allow a more integrated ("Just Works") experience with the various "tools". This all said, pulling so many projects together and keeping update with all their changes is no easy task but could be a beautiful Development experience 😄 |
Thank you for your work!
Maybe we can still ship v2 having everything in one gem? There are really not that many files. It would be a big overhead. |
@vfonic Let me know if you'd like to give us a hand. Feel free to join our Slack and DM me with this link: Slack Invite |
So for version 2.0 I was thinking that we could take it a little further than just deprecating
CypressDev
. I think we should actually split this gem up into multiple gems. Looks like everyone wants tighter integration as where when I updated gem I made it more of a starter pack. ie generates a whole lot of files for you and you can modify them as you see fit.Therefore I see the following new gems being born (names maybe need work 😄 ):
cypress-factory_girl (Cypress::FactoryGirl)
This being the main thing at the moment that everyone seems interested in.
Basically a rack application that turns your factory girl factories into a simple API with a easy way to interact with it from cypress
cypress-active_record_fixtures (Cypress::ActiveRecordFixtures)
make it easy to load your fixtures from cypress
cypress-scenarios (Cypress::Scenarios)
simple way to execute ruby files and "scenarios" from cypress
cypress-class_execute (Cypress::ClassExecute)
make it easy to interact with your model classes (and other classes) directly from cypress
this is basically what i currently do to generate data, I create wrapper classes around the normal models to make it easy to create data and takes advantage of rails class loading and unloading.
*cypress-on_rails (Cypress::OnRails)
this gem basically pulls all the other gems together and provides generators and binaries to get easily setup with rails
I like this approach because it allows to easily create new extensions to whats available and makes it possible to still use the different pieces with other ruby frameworks.
Or course there are pros and cons to this approach, so open to everyones thoughts and if this makes sense to go this direction.
The text was updated successfully, but these errors were encountered: