Skip to content

Commit ffda438

Browse files
Copilotfbacall
andauthored
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>
1 parent bf50d05 commit ffda438

4 files changed

Lines changed: 37 additions & 8 deletions

File tree

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@ group :development do
9191
end
9292

9393
group :test do
94+
gem 'capybara'
9495
gem 'committee'
9596
gem 'minitest'
9697
gem 'minitest-reporters'
9798
gem 'rails-controller-testing'
99+
gem 'selenium-webdriver'
98100
gem 'vcr'
99101
gem 'webmock'
100102
end

Gemfile.lock

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,15 @@ GEM
135135
railties (>= 3.1)
136136
builder (3.3.0)
137137
byebug (11.1.3)
138+
capybara (3.40.0)
139+
addressable
140+
matrix
141+
mini_mime (>= 0.1.3)
142+
nokogiri (~> 1.11)
143+
rack (>= 1.6.0)
144+
rack-test (>= 0.6.3)
145+
regexp_parser (>= 1.5, < 3.0)
146+
xpath (~> 3.2)
138147
case_transform (0.2)
139148
activesupport
140149
cgi (0.5.1)
@@ -640,6 +649,7 @@ GEM
640649
faraday (>= 1)
641650
faraday-multipart (>= 1)
642651
ruby-progressbar (1.13.0)
652+
rubyzip (2.4.1)
643653
safely_block (0.4.0)
644654
sass (3.7.4)
645655
sass-listen (~> 4.0.0)
@@ -658,6 +668,10 @@ GEM
658668
tilt
659669
scanf (1.0.0)
660670
securerandom (0.4.1)
671+
selenium-webdriver (4.16.0)
672+
rexml (~> 3.2, >= 3.2.5)
673+
rubyzip (>= 1.2.2, < 3.0)
674+
websocket (~> 1.0)
661675
sentry-rails (5.11.0)
662676
railties (>= 5.0)
663677
sentry-ruby (~> 5.11.0)
@@ -800,13 +814,16 @@ GEM
800814
crack (>= 0.3.2)
801815
hashdiff (>= 0.4.0, < 2.0.0)
802816
webrick (1.9.1)
817+
websocket (1.2.11)
803818
websocket-driver (0.8.0)
804819
base64
805820
websocket-extensions (>= 0.1.0)
806821
websocket-extensions (0.1.5)
807822
whenever (1.0.0)
808823
chronic (>= 0.6.3)
809824
will_paginate (4.0.0)
825+
xpath (3.2.0)
826+
nokogiri (~> 1.8)
810827
yaml-ld (0.0.3)
811828
json-ld (~> 3.3)
812829
psych (>= 3.3)
@@ -830,6 +847,7 @@ DEPENDENCIES
830847
bootstrap-sass
831848
bootstrap-tab-history-rails
832849
byebug
850+
capybara
833851
committee
834852
country_select
835853
devise
@@ -880,6 +898,7 @@ DEPENDENCIES
880898
ruby-openai
881899
sass-rails
882900
sassc-rails
901+
selenium-webdriver
883902
sentry-rails
884903
sentry-ruby
885904
sentry-sidekiq
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require 'test_helper'
2+
3+
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4+
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400] do |options|
5+
options.add_argument('--no-sandbox')
6+
options.add_argument('--disable-dev-shm-usage')
7+
end
8+
end
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
require 'test_helper'
1+
require 'application_system_test_case'
22

3-
class EventsCalendarIntegrationTest < ActionDispatch::IntegrationTest
4-
test 'calendar page loads and renders event calendar' do
3+
class EventsCalendarSystemTest < ApplicationSystemTestCase
4+
test 'calendar tab loads and renders events with javascript' do
55
freeze_time(Time.utc(2026, 5, 20, 12, 0, 0)) do
66
Event.create!(
77
title: 'System calendar event',
@@ -15,12 +15,12 @@ class EventsCalendarIntegrationTest < ActionDispatch::IntegrationTest
1515
country: 'United Kingdom'
1616
)
1717

18-
get calendar_events_path
18+
visit events_path
1919

20-
assert_response :success
21-
assert_select '#events-calendar #calendar.simple-calendar'
22-
assert_select '#events-calendar table.table.table-striped'
23-
assert_select '#events-calendar a.clear-both', text: 'System calendar event'
20+
within('.index-display-options') { click_link 'Calendar' }
21+
22+
assert_selector('#events_calendar #calendar.simple-calendar')
23+
assert_selector('#events_calendar a.clear-both', text: 'System calendar event')
2424
end
2525
end
2626
end

0 commit comments

Comments
 (0)