From 42c1814e2ee859b82cd980fe63930cf5ef9e8645 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 May 2026 12:53:14 +0000 Subject: [PATCH 1/5] Add integration test for events calendar rendering Agent-Logs-Url: https://github.com/ElixirTeSS/TeSS/sessions/427a7bae-9e9f-4ae8-8977-17b925fec24c Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com> --- .../events_calendar_integration_test.rb | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/integration/events_calendar_integration_test.rb diff --git a/test/integration/events_calendar_integration_test.rb b/test/integration/events_calendar_integration_test.rb new file mode 100644 index 000000000..f3476cc02 --- /dev/null +++ b/test/integration/events_calendar_integration_test.rb @@ -0,0 +1,26 @@ +require 'test_helper' + +class EventsCalendarIntegrationTest < ActionDispatch::IntegrationTest + test 'calendar page loads and renders event calendar' do + freeze_time(Time.utc(2026, 5, 20, 12, 0, 0)) do + Event.create!( + title: 'System calendar event', + url: 'http://example.com/system-calendar-event', + user: users(:regular_user), + content_provider: content_providers(:goblet), + timezone: 'UTC', + start: Time.now.beginning_of_month + 10.days, + end: Time.now.beginning_of_month + 10.days + 2.hours, + city: 'Manchester', + country: 'United Kingdom' + ) + + get calendar_events_path + + assert_response :success + assert_select '#events-calendar #calendar.simple-calendar' + assert_select '#events-calendar table.table.table-striped' + assert_select '#events-calendar a.clear-both', text: 'System calendar event' + end + end +end From 31481513d1f72af219111a274722b6d9e892dae2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 26 May 2026 13:30:19 +0000 Subject: [PATCH 2/5] Add headless browser system test for events calendar JS rendering Agent-Logs-Url: https://github.com/ElixirTeSS/TeSS/sessions/2a3b05a5-ac64-45dd-90f2-21a62813e5bb Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com> --- Gemfile | 2 ++ Gemfile.lock | 19 +++++++++++++++++++ test/application_system_test_case.rb | 8 ++++++++ .../events_calendar_system_test.rb} | 16 ++++++++-------- 4 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 test/application_system_test_case.rb rename test/{integration/events_calendar_integration_test.rb => system/events_calendar_system_test.rb} (53%) diff --git a/Gemfile b/Gemfile index 935e341f0..98b174175 100644 --- a/Gemfile +++ b/Gemfile @@ -91,10 +91,12 @@ group :development do end group :test do + gem 'capybara' gem 'committee' gem 'minitest' gem 'minitest-reporters' gem 'rails-controller-testing' + gem 'selenium-webdriver' gem 'vcr' gem 'webmock' end diff --git a/Gemfile.lock b/Gemfile.lock index 5e606b21f..d29f83bdd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -135,6 +135,15 @@ GEM railties (>= 3.1) builder (3.3.0) byebug (11.1.3) + capybara (3.40.0) + addressable + matrix + mini_mime (>= 0.1.3) + nokogiri (~> 1.11) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (>= 1.5, < 3.0) + xpath (~> 3.2) case_transform (0.2) activesupport cgi (0.5.1) @@ -643,6 +652,7 @@ GEM faraday (>= 1) faraday-multipart (>= 1) ruby-progressbar (1.13.0) + rubyzip (2.4.1) safely_block (0.4.0) sass (3.7.4) sass-listen (~> 4.0.0) @@ -661,6 +671,10 @@ GEM tilt scanf (1.0.0) securerandom (0.4.1) + selenium-webdriver (4.16.0) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) sentry-rails (5.11.0) railties (>= 5.0) sentry-ruby (~> 5.11.0) @@ -803,6 +817,7 @@ GEM crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) webrick (1.9.2) + websocket (1.2.11) websocket-driver (0.8.0) base64 websocket-extensions (>= 0.1.0) @@ -810,6 +825,8 @@ GEM whenever (1.0.0) chronic (>= 0.6.3) will_paginate (4.0.0) + xpath (3.2.0) + nokogiri (~> 1.8) yaml-ld (0.0.3) json-ld (~> 3.3) psych (>= 3.3) @@ -833,6 +850,7 @@ DEPENDENCIES bootstrap-sass bootstrap-tab-history-rails byebug + capybara committee country_select devise @@ -883,6 +901,7 @@ DEPENDENCIES ruby-openai sass-rails sassc-rails + selenium-webdriver sentry-rails sentry-ruby sentry-sidekiq diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb new file mode 100644 index 000000000..38c58b5fe --- /dev/null +++ b/test/application_system_test_case.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class ApplicationSystemTestCase < ActionDispatch::SystemTestCase + driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400] do |options| + options.add_argument('--no-sandbox') + options.add_argument('--disable-dev-shm-usage') + end +end diff --git a/test/integration/events_calendar_integration_test.rb b/test/system/events_calendar_system_test.rb similarity index 53% rename from test/integration/events_calendar_integration_test.rb rename to test/system/events_calendar_system_test.rb index f3476cc02..34913d8f8 100644 --- a/test/integration/events_calendar_integration_test.rb +++ b/test/system/events_calendar_system_test.rb @@ -1,7 +1,7 @@ -require 'test_helper' +require 'application_system_test_case' -class EventsCalendarIntegrationTest < ActionDispatch::IntegrationTest - test 'calendar page loads and renders event calendar' do +class EventsCalendarSystemTest < ApplicationSystemTestCase + test 'calendar tab loads and renders events with javascript' do freeze_time(Time.utc(2026, 5, 20, 12, 0, 0)) do Event.create!( title: 'System calendar event', @@ -15,12 +15,12 @@ class EventsCalendarIntegrationTest < ActionDispatch::IntegrationTest country: 'United Kingdom' ) - get calendar_events_path + visit events_path - assert_response :success - assert_select '#events-calendar #calendar.simple-calendar' - assert_select '#events-calendar table.table.table-striped' - assert_select '#events-calendar a.clear-both', text: 'System calendar event' + within('.index-display-options') { click_link 'Calendar' } + + assert_selector('#events_calendar #calendar.simple-calendar') + assert_selector('#events_calendar a.clear-both', text: 'System calendar event') end end end From 5547e6230ded133f15cb2db6811c5a1c5a1d5939 Mon Sep 17 00:00:00 2001 From: Finn Bacall Date: Tue, 26 May 2026 15:45:05 +0100 Subject: [PATCH 3/5] Allow localhost in VCR (or selenium can't get through) --- test/test_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_helper.rb b/test/test_helper.rb index 17218b588..8d6583b3f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -35,6 +35,7 @@ VCR.configure do |config| config.cassette_library_dir = 'test/vcr_cassettes' config.hook_into :webmock + config.ignore_localhost = true # config.allow_http_connections_when_no_cassette = true end From f96cd49ea51cafd9046af76c580bb58c354e01ec Mon Sep 17 00:00:00 2001 From: Finn Bacall Date: Tue, 26 May 2026 15:52:58 +0100 Subject: [PATCH 4/5] Update action to run system tests and rename it --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a26626838..578947491 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: CI +name: Tests on: [push, pull_request] @@ -62,3 +62,5 @@ jobs: run: yarn install --frozen-lockfile --non-interactive - name: Run tests run: bundle exec rails test + - name: Run system tests + run: bundle exec rails test:system From 098126877893eff45835a9209c86979df5a566e8 Mon Sep 17 00:00:00 2001 From: Finn Bacall Date: Wed, 27 May 2026 10:15:14 +0100 Subject: [PATCH 5/5] Bump gem versions --- Gemfile.lock | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d29f83bdd..0f8b3d923 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -111,7 +111,7 @@ GEM activerecord (>= 4.0) autoprefixer-rails (10.4.13.0) execjs (~> 2) - base64 (0.1.2) + base64 (0.3.0) bcp47_spec (0.2.1) bcrypt (3.1.22) benchmark (0.5.0) @@ -434,7 +434,7 @@ GEM orm_adapter (0.5.0) ostruct (0.6.3) parallel (1.23.0) - parser (3.2.2.3) + parser (3.3.11.1) ast (~> 2.4.1) racc pg (1.5.6) @@ -633,12 +633,11 @@ GEM faraday (>= 0.9, < 3, != 2.0.0) rss (0.3.0) rexml - rubocop (1.56.1) - base64 (~> 0.1.1) + rubocop (1.57.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.3) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) @@ -652,7 +651,7 @@ GEM faraday (>= 1) faraday-multipart (>= 1) ruby-progressbar (1.13.0) - rubyzip (2.4.1) + rubyzip (3.3.0) safely_block (0.4.0) sass (3.7.4) sass-listen (~> 4.0.0) @@ -671,9 +670,11 @@ GEM tilt scanf (1.0.0) securerandom (0.4.1) - selenium-webdriver (4.16.0) + selenium-webdriver (4.44.0) + base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2, < 3.0) + rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) sentry-rails (5.11.0) railties (>= 5.0)