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

Support for Rails 7 #523

Closed
erikaxel opened this issue Dec 16, 2021 · 13 comments · Fixed by #526
Closed

Support for Rails 7 #523

erikaxel opened this issue Dec 16, 2021 · 13 comments · Fixed by #526
Labels
🍼 incomplete Blocked until more information is provided rails-7.x

Comments

@erikaxel
Copy link

erikaxel commented Dec 16, 2021

Rails 7 has been released and it would be great if cucumber-rails could support it.

I did an initial "fix" where I just relaxed the gemspec requirement and added test runners for 7.0 in erikaxel@6b22561
However that seems to be insufficient since a couple of tests fail. I'm not very familiar with this project so I'm a bit stumped on where to continue. Happy to help if I can, but it would be great with some pointers on where to start. The errors on the CI can be seen here: https://github.com/erikaxel/cucumber-rails/actions/runs/1587333272

PS: Also happy to make my initial commit with tests running on 7.0 into a PR if that is helpful.

@luke-hill
Copy link
Contributor

luke-hill commented Dec 16, 2021

You're a bit keen on the gun :) But yes I will get to this as/when appropriate.

I fully expect the next 2/3 weeks to have little to no uptake (% wise), of rails 7. So we should have some time on our hands.

EDIT: The errors seem to be related to browser rendering. If you are able to debug. That is the first place you should start. Try debugging what website loads up. I bet it's some form of "error" page.

@benny-burkhart
Copy link

Something in the dependencies might need an update -- I ended up with 1.4.0 first.
image

@luke-hill
Copy link
Contributor

Yes, as we are discussing, your PR isn't quite valid.

As a bare minimum we need to check

  • New CI
  • Existing features (Think we have 3/4 breakages)
  • Any caveats with the rails "fake" installs.

@benny-burkhart
Copy link

Hmmm I can see that CI doesn't seem to cover Rails 7... Do you know where to add that?

@luke-hill
Copy link
Contributor

Yes, there is already a spiked branch and PR above. If you check the OP.

@tagliala
Copy link

tagliala commented Dec 20, 2021

Hi @erikaxel ,

I've investigated the failures

cucumber features/capybara_javascript_drivers.feature:3 # Scenario: Use Browser UI backed by DB
cucumber features/capybara_javascript_drivers.feature:88 # Scenario: Use Browser UI without a DB

depend by the fact that Rails 7 generates a form with a form.datetime_field :when, so it has a modern datetimepicker and so the cucumber rails helper is not able to find date component dropdowns.

A possible fix:

diff --git a/features/capybara_javascript_drivers.feature b/features/capybara_javascript_drivers.feature
index 271639d..92f4f6b 100644
--- a/features/capybara_javascript_drivers.feature
+++ b/features/capybara_javascript_drivers.feature
@@ -4,6 +4,7 @@ Feature: Capybara Javascript Drivers
     Given I have created a new Rails app and installed cucumber-rails
     And I force selenium to run Firefox in headless mode
     When I run `bundle exec rails g scaffold appointment name:string when:datetime`
+    When I run `sed -i -e 's/datetime_field/datetime_select/' app/views/appointments/_form.html.erb`
     And I write to "features/create_appointment.feature" with:
       """
       @javascript
@@ -89,6 +90,7 @@ Feature: Capybara Javascript Drivers
     Given I have created a new Rails app and installed cucumber-rails without database_cleaner
     And I force selenium to run Firefox in headless mode
     When I run `bundle exec rails g scaffold appointment name:string when:datetime`
+    When I run `sed -i -e 's/datetime_field/datetime_select/' app/views/appointments/_form.html.erb`
     And I write to "features/create_appointment.feature" with:
       """
       @javascript

 features/emulate_javascript.feature:48

failes because the default scaffold in Rails 7 does not provide anymore a link to delete an object in the index

That link is provided as a button to destroy inside the show

I do not have a fast solution for this

@luke-hill
Copy link
Contributor

luke-hill commented Dec 21, 2021

If that's the issue, then the desired solution would be to amend the datepicker and select the datepicker in 2 different ways. We had a helper for rails6, evidently we need one for rails7 too :)

I will have some time on the bridge week to work on this, if no-one picks it up before then

@luke-hill luke-hill added 🍼 incomplete Blocked until more information is provided rails-7.x labels Dec 21, 2021
@tagliala
Copy link

Hi @luke-hill , thanks

I don't know if I will have time, but the third and last failure can be fixed in a similar way (following a different path when it runs on Rails 7)

@luke-hill
Copy link
Contributor

Thanks for triaging. It'll make it easier as/when someone picks it up. I'll look at this in a couple of weeks if no-one gets to it before then.

Atm I imagine the rails7 uptake is miniscule.

@xanderificnl
Copy link

Something in the dependencies might need an update -- I ended up with 1.4.0 first. image

I kept getting hit by '~@javascript' in active_record.rb being invalid. After having not considered/realized an older version got installed, I scanned through lots of comments (most dating back 10 years.), looking through commits related to active_record.rb it finally did hit me. Version 1.4 got installed.

In case someone else also hits that issue, and also looks/searches through issues -- hopefully this'll save them some time.

@luke-hill
Copy link
Contributor

As mentioned in the earlier posts, this is to be expected. Unfortunately I caught covid over the xmas break.

There have been bits and pieces commits which have fixed part of the issue. But essentially this just needs working on.

mathieujobin added a commit to mathieujobin/cucumber-rails that referenced this issue Jan 10, 2022
@mathieujobin
Copy link
Contributor

mathieujobin commented Jan 10, 2022

Not sure if this help, but I made this branch to get me forward, I was hoping to open a PR, but it isn't complete.

github: 'mathieujobin/cucumber-rails', branch: 'rails7'

  • Added Rails 7 to the test suite - e85fb17
  • ruby 2.5 fails, probably because I bumped bundler, funny thing though is ruby 2.4 pass just fine
  • rails 7 fails with the 3 fore-above mentioned tests.
  • removed support for rails 5.0 and 5.1, ruby 2.4 and 2.5 6af6bf1 971dfd9
  • used workaround for 2/3 of the test failures as suggested in this issue 188c00b

@mgrunberg
Copy link
Contributor

I made #526 based on the tagliala comments but with a different workaround. mathieujobin, sorry for not continuing your branch but I wanted to take a different approach and leave drop old rails and ruby support for a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍼 incomplete Blocked until more information is provided rails-7.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants