From 5425f5cfa6ec021ebb012c97dfedb74dc4bc6ead Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 17 Jul 2022 19:33:15 +0200 Subject: [PATCH] Switch from apparition to cuprite driver Apparition4 isn't really maintained anymore and there are no new releases and it always logs a lot of errors, making the output hard to read. So lets switch to cuprite, as it also supports everything we need and is still maintained. Supersedes #8330 --- Gemfile | 2 +- Gemfile.lock | 13 +++++++++---- features/desktop/auto_follow_back.feature | 2 +- features/desktop/conversations.feature | 2 +- features/desktop/mentions.feature | 4 ++-- features/desktop/post_with_a_poll.feature | 1 - features/mobile/edits_profile.feature | 2 +- features/mobile/getting_started.feature | 2 +- features/step_definitions/auth_code_steps.rb | 1 - features/support/env.rb | 10 +++++----- features/support/paths.rb | 10 ++++------ 11 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Gemfile b/Gemfile index bcb823d83..32e5d3875 100644 --- a/Gemfile +++ b/Gemfile @@ -224,8 +224,8 @@ group :test do # Cucumber (integration tests) - gem "apparition", "0.6.0" gem "capybara", "3.35.3" + gem "cuprite", "0.14.3" gem "database_cleaner-active_record", "2.0.1" gem "cucumber-api-steps", "0.14", require: false diff --git a/Gemfile.lock b/Gemfile.lock index be3662252..c82d3bb83 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -74,9 +74,6 @@ GEM addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) aes_key_wrap (1.1.0) - apparition (0.6.0) - capybara (~> 3.13, < 4) - websocket-driver (>= 0.6.5) asset_sync (2.15.2) activemodel (>= 4.1.0) fog-core @@ -190,6 +187,9 @@ GEM cucumber-wire (6.2.1) cucumber-core (~> 10.1, >= 10.1.0) cucumber-cucumber-expressions (~> 14.0, >= 14.0.0) + cuprite (0.14.3) + capybara (~> 3.0) + ferrum (~> 0.13.0) database_cleaner-active_record (2.0.1) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) @@ -280,6 +280,11 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) + ferrum (0.13) + addressable (~> 2.5) + concurrent-ruby (~> 1.1) + webrick (~> 1.7) + websocket-driver (>= 0.6, < 0.8) ffi (1.15.5) ffi-compiler (1.0.1) ffi (>= 1.0.0) @@ -773,7 +778,6 @@ DEPENDENCIES acts-as-taggable-on (= 9.0.1) acts_as_api (= 1.0.1) addressable (= 2.8.0) - apparition (= 0.6.0) asset_sync (= 2.15.2) autoprefixer-rails (= 10.4.7.0) babel-transpiler (= 0.7.0) @@ -785,6 +789,7 @@ DEPENDENCIES configurate (= 0.5.0) cucumber-api-steps (= 0.14) cucumber-rails (= 2.5.1) + cuprite (= 0.14.3) database_cleaner-active_record (= 2.0.1) devise (= 4.8.1) devise-two-factor (= 4.0.2) diff --git a/features/desktop/auto_follow_back.feature b/features/desktop/auto_follow_back.feature index 1b7404805..4e63934a8 100644 --- a/features/desktop/auto_follow_back.feature +++ b/features/desktop/auto_follow_back.feature @@ -24,7 +24,7 @@ Feature: auto follow back a user Scenario: When a user with auto follow back enabled is shared with by a user he's ignoring, he's not sharing back When I sign in as "bob@bob.bob" And I am on "alice@alice.alice"'s page - And I click on the profile block button + And I confirm the alert after I click on the profile block button And I sign out When I sign in as "alice@alice.alice" And I am on "bob@bob.bob"'s page diff --git a/features/desktop/conversations.feature b/features/desktop/conversations.feature index a8affa3ad..c53d62abb 100644 --- a/features/desktop/conversations.feature +++ b/features/desktop/conversations.feature @@ -60,7 +60,7 @@ Feature: private conversations When I sign in as "bob@bob.bob" And I send a message with subject "Greetings" and text "hello, alice!" to "Alice Awesome" Then I should see "Greetings" within "#conversation-inbox" - When I click on selector ".hide_conversation" + When I confirm the prompt after I click on selector ".hide_conversation" Then I should not see "Greetings" within "#conversation-inbox" When I sign in as "alice@alice.alice" Then I should have 1 unread private message diff --git a/features/desktop/mentions.feature b/features/desktop/mentions.feature index 8cba48e96..33581ebe4 100644 --- a/features/desktop/mentions.feature +++ b/features/desktop/mentions.feature @@ -52,8 +52,8 @@ Feature: Mentions And I click on the first user in the mentions dropdown list And I press "Share" Then I should see "Bob Jones" within ".stream-element" - When I follow "Bob Jones" - Then I should see "Bob Jones" + When I follow "Bob Jones" within ".stream-element" + Then I should see "Bob Jones" within "#author_info" Scenario: A user mentions another user in a comment and it displays correctly Given following users exist: diff --git a/features/desktop/post_with_a_poll.feature b/features/desktop/post_with_a_poll.feature index 63edd85a5..48ee46b34 100644 --- a/features/desktop/post_with_a_poll.feature +++ b/features/desktop/post_with_a_poll.feature @@ -87,7 +87,6 @@ Feature: posting with a poll | poll_question | What kind of yogurt do you like? | And I fill in the following for the options: | normal | - | | And I click on selector "#poll_creator_container" And I click on selector "#publisher button#submit" Then I should see an element ".poll-answer input.error" diff --git a/features/mobile/edits_profile.feature b/features/mobile/edits_profile.feature index 9120898f2..4958b31e6 100644 --- a/features/mobile/edits_profile.feature +++ b/features/mobile/edits_profile.feature @@ -40,7 +40,7 @@ Feature: editing the profile in the mobile view And I should see "#starwars" within "ul#as-selections-tags" When I accept the alert after I attach the file "spec/fixtures/bad_urls.txt" to "qqfile" within "#file-upload" - And I attach the file "spec/fixtures/button.png" to hidden "qqfile" within "#file-upload" + And I confirm the prompt after I attach the file "spec/fixtures/button.png" to hidden "qqfile" within "#file-upload" Then I should see "button.png completed" And I should see a "img" within "#profile_photo_upload" diff --git a/features/mobile/getting_started.feature b/features/mobile/getting_started.feature index 12b341b92..d55175e41 100644 --- a/features/mobile/getting_started.feature +++ b/features/mobile/getting_started.feature @@ -18,7 +18,7 @@ Feature: editing the getting started in the mobile view Scenario: new user adds a profile photo and tags When I accept the alert after I attach the file "spec/fixtures/bad_urls.txt" to "qqfile" within "#file-upload" - And I attach the file "spec/fixtures/button.png" to hidden "qqfile" within "#file-upload" + And I confirm the prompt after I attach the file "spec/fixtures/button.png" to hidden "qqfile" within "#file-upload" Then I should see a "img" within "#profile_photo_upload" When I fill in "follow_tags" with "#men" diff --git a/features/step_definitions/auth_code_steps.rb b/features/step_definitions/auth_code_steps.rb index a4f71475d..ad3508dfd 100644 --- a/features/step_definitions/auth_code_steps.rb +++ b/features/step_definitions/auth_code_steps.rb @@ -22,7 +22,6 @@ Given /^I send a post request from that client to the code flow authorization en end When /^I parse the auth code and create a request to the token endpoint$/ do - current_url = page.driver.network_traffic.last.url # We get a redirect to example.org that we can't follow code = current_url[/(?<=code=)[^&]+/] expect(code).to be_present post api_openid_connect_access_tokens_path, code: code, diff --git a/features/support/env.rb b/features/support/env.rb index 9297993e1..375ce77c8 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -13,7 +13,7 @@ require "cucumber/rails" require "capybara/rails" require "capybara/cucumber" require "capybara/session" -require "capybara/apparition" +require "capybara/cuprite" require "cucumber/api_steps" @@ -24,15 +24,15 @@ Rails.application.routes.default_url_options[:port] = AppConfig.pod_uri.port Capybara.server = :webrick -Capybara.register_driver :apparition do |app| +Capybara.register_driver :cuprite do |app| # Pass headless: false here if you need to see the browser - Capybara::Apparition::Driver.new( + Capybara::Cuprite::Driver.new( app, headless: true, - browser_options: %i[no_sandbox disable_setuid_sandbox disable_gpu] + browser_options: {'no-sandbox': nil} ) end -Capybara.javascript_driver = :apparition +Capybara.javascript_driver = :cuprite # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In # order to ease the transition to Capybara we set the default here. If you'd diff --git a/features/support/paths.rb b/features/support/paths.rb index 01cada463..df7a43f19 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -70,12 +70,10 @@ module NavigationHelpers end def confirm_on_page(page_name) - page.driver.send(:retry_if_wrong_world) do - if page_name == "my profile page" - expect(page).to have_path_in([person_path(@me.person), user_profile_path(@me.username)]) - else - expect(page).to have_path(path_to(page_name)) - end + if page_name == "my profile page" + expect(page).to have_path_in([person_path(@me.person), user_profile_path(@me.username)]) + else + expect(page).to have_path(path_to(page_name)) end end end