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

Fix CI failure #1593

Merged
merged 4 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Gemfile.development_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
gem "shakapacker", "7.0.1"
gem "bootsnap", require: false
gem "rails", "~> 7.0", ">= 7.0.1"
gem "sqlite3"

# sqlite3 1.7.0 ends native gem support for Ruby 2.7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is sqllite even needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed for dummy app test

I tried to move it to the gemfile of the dummy app but it didn't work. So I kept it here and just fixed the version.

gem "sqlite3", "~> 1.0", "< 1.7.0"
gem "sass-rails", "~> 6.0"
gem "uglifier"
gem "jquery-rails"
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/locales/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def flatten_defaults(val)
def flatten(translations)
translations.each_with_object({}) do |(k, v), h|
if v.is_a? Hash
flatten(v).map { |hk, hv| h["#{k}.#{hk}".to_sym] = hv }
flatten(v).map { |hk, hv| h[:"#{k}.#{hk}"] = hv }
elsif v.is_a?(String)
h[k] = v.gsub("%{", "{")
elsif !v.is_a?(Array)
Expand Down
9 changes: 9 additions & 0 deletions spec/dummy/spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@

# Capybara config
config.include Capybara::DSL

# More information about headless=new option at https://www.selenium.dev/blog/2023/headless-is-going-away/
Capybara.register_driver :selenium_chrome_headless do |app|
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument("--headless=new")

Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end

#
# selenium_firefox webdriver only works for Travis-CI builds.
default_driver = :selenium_chrome_headless
Expand Down
10 changes: 5 additions & 5 deletions spec/dummy/spec/system/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def finished_all_ajax_requests?
it "changes name in message according to input" do
visit "/client_side_hello_world"
expect_change_text_in_dom_selector("#HelloWorld-react-component-0")
click_link "Hello World Component Server Rendered, with extra options"
click_on "Hello World Component Server Rendered, with extra options"
expect_change_text_in_dom_selector("#my-hello-world-id")
end
end
Expand Down Expand Up @@ -164,19 +164,19 @@ def finished_all_ajax_requests?

before do
visit "/"
click_link "React Router"
click_on "React Router"
end

context "when rendering /react_router" do
it { is_expected.to have_text("Woohoo, we can use react-router here!") }

it "clicking links correctly renders other pages" do
click_link "Router First Page"
click_on "Router First Page"
expect(page).to have_current_path("/react_router/first_page")
first_page_header_text = page.find(:css, "h2#first-page").text
expect(first_page_header_text).to eq("React Router First Page")

click_link "Router Second Page"
click_on "Router Second Page"
expect(page).to have_current_path("/react_router/second_page")
second_page_header_text = page.find(:css, "h2#second-page").text
expect(second_page_header_text).to eq("React Router Second Page")
Expand Down Expand Up @@ -212,7 +212,7 @@ def finished_all_ajax_requests?

it "HelloWorldRehydratable onChange should trigger" do
within("form") do
click_button "refresh"
click_on "refresh"
end
wait_for_ajax
within("#HelloWorldRehydratable-react-component-1") do
Expand Down
Loading