From e17316dcfab231e3d451ef3d60eae516a53b9b03 Mon Sep 17 00:00:00 2001 From: takahashim Date: Mon, 18 Dec 2023 19:04:21 +0900 Subject: [PATCH 1/4] fix: options of Capybara driver --- spec/rails_helper.rb | 18 ++++++++++++++++++ ...min_officializations_user_extension_spec.rb | 2 +- spec/system/comment_sort_spec.rb | 2 +- spec/system/needs_user_extension_spec.rb | 2 +- spec/system/user_profile_spec.rb | 4 ++-- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 37bbc78319..befce623fe 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -31,6 +31,24 @@ puts e.to_s.strip exit 1 end + +Capybara.register_driver :headless_chrome do |app| + options = ::Selenium::WebDriver::Chrome::Options.new + options.args << "--headless=new" + options.args << "--no-sandbox" + options.args << if ENV["BIG_SCREEN_SIZE"].present? + "--window-size=1920,3000" + else + "--window-size=1920,1080" + end + options.args << "--ignore-certificate-errors" if ENV["TEST_SSL"] + Capybara::Selenium::Driver.new( + app, + browser: :chrome, + capabilities: [options] + ) +end + RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures # config.fixture_path = "#{::Rails.root}/spec/fixtures" diff --git a/spec/system/admin_officializations_user_extension_spec.rb b/spec/system/admin_officializations_user_extension_spec.rb index ab8e169d83..a2f316a526 100644 --- a/spec/system/admin_officializations_user_extension_spec.rb +++ b/spec/system/admin_officializations_user_extension_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -xdescribe "Admin manages officializations", type: :system do +describe "Admin manages officializations", type: :system do let(:model_name) { Decidim::User.model_name } let(:filterable_concern) { Decidim::Admin::Officializations::Filterable } diff --git a/spec/system/comment_sort_spec.rb b/spec/system/comment_sort_spec.rb index 17109148bb..c834a1ed63 100644 --- a/spec/system/comment_sort_spec.rb +++ b/spec/system/comment_sort_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -xdescribe "Comments", type: :system, perform_enqueued: true do +describe "Comments", type: :system, perform_enqueued: true do let!(:component) { create(:debates_component, organization: organization) } let!(:commentable) { create(:debate, :open_ama, component: component) } diff --git a/spec/system/needs_user_extension_spec.rb b/spec/system/needs_user_extension_spec.rb index 9bceddff4a..99b4dcfd83 100644 --- a/spec/system/needs_user_extension_spec.rb +++ b/spec/system/needs_user_extension_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -xdescribe "Need user extension", type: :system do +describe "Need user extension", type: :system do let(:organization) { create(:organization) } let(:user) { create(:user, :confirmed, organization: organization) } diff --git a/spec/system/user_profile_spec.rb b/spec/system/user_profile_spec.rb index 4faa38cc18..bcbe549a33 100644 --- a/spec/system/user_profile_spec.rb +++ b/spec/system/user_profile_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -require "spec_helper" +require "rails_helper" -xdescribe "Profile", type: :system do +describe "Profile", type: :system do let(:user) { create(:user, :confirmed) } before do From f1140826da841606eec50a670489a12c3bce6c68 Mon Sep 17 00:00:00 2001 From: takahashim Date: Tue, 19 Dec 2023 00:20:38 +0900 Subject: [PATCH 2/4] spec: use css selector --- spec/system/comment_sort_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/system/comment_sort_spec.rb b/spec/system/comment_sort_spec.rb index c834a1ed63..1fdd160856 100644 --- a/spec/system/comment_sort_spec.rb +++ b/spec/system/comment_sort_spec.rb @@ -32,8 +32,10 @@ within ".comments" do within ".order-by__dropdown" do - click_link "古い順" # Opens the dropdown - click_link "評価の高い順" + # click_link "古い順" # Opens the dropdown + # click_link "評価の高い順" + page.find("#comments-order-menu-control").click # Opens the dropdown + page.find("#comments-order-chooser-menu li:first-of-type a").click end end From cf174c87552947c77be8de5b2b5502dad2c3e52e Mon Sep 17 00:00:00 2001 From: takahashim Date: Tue, 19 Dec 2023 00:31:59 +0900 Subject: [PATCH 3/4] spec: use English --- spec/system/comment_sort_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/system/comment_sort_spec.rb b/spec/system/comment_sort_spec.rb index 1fdd160856..28131b987c 100644 --- a/spec/system/comment_sort_spec.rb +++ b/spec/system/comment_sort_spec.rb @@ -49,6 +49,7 @@ expect(page).to have_css(".comment", minimum: 1) page.find(".order-by .dropdown.menu .is-dropdown-submenu-parent").hover - expect(page).to have_css("#comments-order-menu-control", text: "評価の高い順") + # expect(page).to have_css("#comments-order-menu-control", text: "評価の高い順") + expect(page).to have_css("#comments-order-menu-control", text: "Best rated") end end From 4b254a19d56068ff28936784abd192ae5d8a7422 Mon Sep 17 00:00:00 2001 From: takahashim Date: Wed, 27 Dec 2023 01:16:19 +0900 Subject: [PATCH 4/4] UPGRADE.md: delete comments about skipping tests --- docs/UPGRADE.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/UPGRADE.md b/docs/UPGRADE.md index 75a2ef73cc..9fb2e0256f 100644 --- a/docs/UPGRADE.md +++ b/docs/UPGRADE.md @@ -113,8 +113,3 @@ Decidim本体のバージョンを更新する際、特に注意が必要な内 `Decidim::Map::Provider::StaticMap::CfjOsm`という独自のstatic map providerを定義するためのものです。 `config/initializers/decidim.rb`のconfig.maps以下のstaticのところで導入されています。 - -* `spec/system`以下 - -`decidim-dev (0.27.4)`のgemが依存しているパッケージ(capybara, selenium-webdriver)が古く、testの本質とは関係ない部分で落ちてしまうので、一旦スキップする対応をしています。 -次期バージョンではこの辺りは更新されそうなので、要確認