Skip to content

Commit

Permalink
Fix CI failure (#1593)
Browse files Browse the repository at this point in the history
* Empty commit to ensure failure

* Set sqlite3 version to be below 1.7.0

* Customize selenium driver to use headless=new

More information at
https://www.selenium.dev/blog/2023/headless-is-going-away/

* Fix Rubocop issues
  • Loading branch information
ahangarha authored Jan 7, 2024
1 parent 38e764a commit 6f1ca20
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
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
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

0 comments on commit 6f1ca20

Please sign in to comment.