From 1ece7ad44b3d2173c38a5bdadf416003d94134f5 Mon Sep 17 00:00:00 2001 From: Anna Topalidi Date: Fri, 5 Jan 2024 12:37:56 +0100 Subject: [PATCH 1/3] add time zone to conference_program, add tests --- .../add_time_zone.html.erb.deface | 6 +++ spec/system/conference_spec.rb | 50 ++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 app/overrides/decidim/conferences/conference_program/_program_meeting/add_time_zone.html.erb.deface diff --git a/app/overrides/decidim/conferences/conference_program/_program_meeting/add_time_zone.html.erb.deface b/app/overrides/decidim/conferences/conference_program/_program_meeting/add_time_zone.html.erb.deface new file mode 100644 index 00000000..8153585b --- /dev/null +++ b/app/overrides/decidim/conferences/conference_program/_program_meeting/add_time_zone.html.erb.deface @@ -0,0 +1,6 @@ + + +
+ <%= gpc_time_format start_time %> – <%= gpc_time_format end_time %> + <%= gpc_time_zone(start_time) %> +
diff --git a/spec/system/conference_spec.rb b/spec/system/conference_spec.rb index 4c645faa..4c3bddc4 100644 --- a/spec/system/conference_spec.rb +++ b/spec/system/conference_spec.rb @@ -1,7 +1,25 @@ # frozen_string_literal: true require "rails_helper" - +require "selenium/webdriver" + +Capybara.register_driver :headless_chrome do |app| + options = Selenium::WebDriver::Chrome::Options.new + options.args << "--explicitly-allowed-ports=#{Capybara.server_port}" + 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, + options: options + ) +end describe "Visit a conference", type: :system do let(:organization) { create :organization } let(:conference) { create :conference, slug: slug, registrations_enabled: registrations_enabled, organization: organization } @@ -76,4 +94,34 @@ it_behaves_like "no links" end end + + context "when conference program show" do + let(:organization) { create :organization, time_zone: "UTC" } + let!(:component) { create(:component, manifest_name: :meetings, participatory_space: conference) } + let!(:conference_speakers) { create_list(:conference_speaker, 3, :with_meeting, conference: conference, meetings_component: component) } + let(:meetings) { Decidim::ConferenceMeeting.where(component: component) } + let!(:user) { create(:user, :confirmed, organization: organization, time_zone: timezone) } + let(:timezone) { "CET" } + + context "when the user is logged in" do + before do + sign_in user + visit decidim_conferences.conference_conference_program_path(conference, component) + end + + it "shows user's time zone" do + expect(page).to have_content("CET") + end + end + + context "when the user is not logged in" do + before do + visit decidim_conferences.conference_conference_program_path(conference, component) + end + + it "shows the organization's time zone" do + expect(page).to have_content("UTC") + end + end + end end From 93e770a325a001e5377097bb72d7b1da47654b7d Mon Sep 17 00:00:00 2001 From: Anna Topalidi Date: Fri, 5 Jan 2024 12:46:54 +0100 Subject: [PATCH 2/3] remove extra code --- spec/system/conference_spec.rb | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/spec/system/conference_spec.rb b/spec/system/conference_spec.rb index 4c3bddc4..8d6f17a0 100644 --- a/spec/system/conference_spec.rb +++ b/spec/system/conference_spec.rb @@ -3,23 +3,6 @@ require "rails_helper" require "selenium/webdriver" -Capybara.register_driver :headless_chrome do |app| - options = Selenium::WebDriver::Chrome::Options.new - options.args << "--explicitly-allowed-ports=#{Capybara.server_port}" - 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, - options: options - ) -end describe "Visit a conference", type: :system do let(:organization) { create :organization } let(:conference) { create :conference, slug: slug, registrations_enabled: registrations_enabled, organization: organization } From 0c5c996e19eed3a3b28954ee1c055339bfbbec73 Mon Sep 17 00:00:00 2001 From: Anna Topalidi Date: Fri, 5 Jan 2024 13:28:44 +0100 Subject: [PATCH 3/3] fix chromedriver in test.yml --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a4996077..e8c1606e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,6 +36,10 @@ jobs: with: fetch-depth: 1 + - uses: nanasess/setup-chromedriver@v2 + with: + chromedriver-version: 119.0.6045.105 + - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ env.RUBY_VERSION }}