Skip to content

Commit 0a95de7

Browse files
floehopperchrislo
andcommitted
Remove unused Cuprite-related code
The JavaScript driver for Capybara was being configured to use Cuprite to drive a browser for JS-enabled specs. However, there are no such specs at the moment and it's not obvious that there have ever been any. When we added `js: true` to an existing feature spec and ran it, we saw an exception, so it's not obvious that it was even working. The feature specs currently use the default Capybara driver which is rack-test. Since this doesn't drive a browser, it doesn't support screenshots, so we removed the `capybara-screenshot` gem as well. `Capybara.asset_host` is only relevant for browser-based specs and so it doesn't need to be set any more. The code that was checking for the browser binary by rescuing `Ferrum::BinaryNotFoundError` is no longer needed, because Ferrum is the lower-level gem used by Cuprite. Currently if a JS-enabled spec is needed it's added to the e2e specs [1] which use Python & Playwright. If we ever need to add JS-enabled specs to this repo, it would probably make sense to use the Playwright driver for Capybara for consistency with the e2e specs. [1]: https://github.com/NHSDigital/manage-vaccinations-in-schools-testing/ Co-authored-by: Chris Lowis <chris.lowis@gofreerange.com>
1 parent 25ad0b5 commit 0a95de7

3 files changed

Lines changed: 0 additions & 45 deletions

File tree

Gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ group :test do
118118
gem "capybara"
119119
gem "capybara_accessible_selectors",
120120
github: "citizensadvice/capybara_accessible_selectors"
121-
gem "capybara-screenshot"
122121
gem "climate_control"
123-
gem "cuprite"
124122
gem "database_cleaner-active_record"
125123
gem "its"
126124
gem "rack_session_access"

Gemfile.lock

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,13 @@ GEM
237237
rack-test (>= 0.6.3)
238238
regexp_parser (>= 1.5, < 3.0)
239239
xpath (~> 3.2)
240-
capybara-screenshot (1.0.27)
241-
capybara (>= 1.0, < 4)
242-
launchy
243240
caxlsx (4.4.2)
244241
htmlentities (~> 4.3, >= 4.3.4)
245242
marcel (~> 1.0)
246243
nokogiri (~> 1.10, >= 1.10.4)
247244
rubyzip (>= 2.4, < 4)
248245
cgi (0.5.1)
249246
charlock_holmes (0.7.9)
250-
childprocess (5.1.0)
251-
logger (~> 1.5)
252247
climate_control (1.2.0)
253248
coderay (1.1.3)
254249
concurrent-ruby (1.3.6)
@@ -271,9 +266,6 @@ GEM
271266
cssbundling-rails (1.4.3)
272267
railties (>= 6.0.0)
273268
csv (3.3.5)
274-
cuprite (0.17)
275-
capybara (~> 3.0)
276-
ferrum (~> 0.17.0)
277269
data_migrate (11.3.1)
278270
activerecord (>= 6.1)
279271
railties (>= 6.1)
@@ -346,12 +338,6 @@ GEM
346338
faraday (>= 1, < 3)
347339
faraday-net_http (3.4.2)
348340
net-http (~> 0.5)
349-
ferrum (0.17.1)
350-
addressable (~> 2.5)
351-
base64 (~> 0.2)
352-
concurrent-ruby (~> 1.1)
353-
webrick (~> 1.7)
354-
websocket-driver (~> 0.7)
355341
ffi (1.17.3-arm64-darwin)
356342
ffi (1.17.3-x86_64-linux-gnu)
357343
fhir_models (5.0.0)
@@ -446,10 +432,6 @@ GEM
446432
kramdown-parser-gfm (1.1.0)
447433
kramdown (~> 2.0)
448434
language_server-protocol (3.17.0.5)
449-
launchy (3.1.1)
450-
addressable (~> 2.8)
451-
childprocess (~> 5.0)
452-
logger (~> 1.6)
453435
lint_roller (1.1.0)
454436
listen (3.9.0)
455437
rb-fsevent (~> 0.10, >= 0.10.3)
@@ -945,15 +927,13 @@ DEPENDENCIES
945927
bootsnap
946928
brakeman
947929
capybara
948-
capybara-screenshot
949930
capybara_accessible_selectors!
950931
caxlsx
951932
charlock_holmes
952933
climate_control
953934
config
954935
cssbundling-rails
955936
csv
956-
cuprite
957937
data_migrate
958938
database_cleaner-active_record
959939
debug

spec/spec_helper.rb

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -108,26 +108,11 @@
108108
end
109109
require "rspec/rails"
110110
# Add additional requires below this line. Rails is not loaded until this point!
111-
require "capybara/cuprite"
112-
require "capybara-screenshot/rspec"
113111
require "rack_session_access/capybara"
114112
require "console"
115113

116114
Faker::Config.locale = "en-GB"
117115

118-
Capybara.register_driver(:cuprite_custom) do |app|
119-
Capybara::Cuprite::Driver.new(
120-
app,
121-
inspector: ENV["DEBUG_TESTS"],
122-
js_errors: true,
123-
window_size: [1200, 800],
124-
process_timeout: 30
125-
)
126-
end
127-
128-
Capybara.asset_host = "http://localhost:4000"
129-
Capybara.javascript_driver = :cuprite_custom
130-
131116
Console.logger.off!
132117
Capybara.server = :falcon
133118

@@ -186,14 +171,6 @@
186171

187172
config.filter_run_excluding :local_users
188173

189-
if ENV["CI"].blank?
190-
begin
191-
Ferrum::Browser.new
192-
rescue Ferrum::BinaryNotFoundError
193-
config.filter_run_excluding :js
194-
end
195-
end
196-
197174
config.infer_spec_type_from_file_location!
198175

199176
config.define_derived_metadata(file_path: %r{/spec/components/}) do |metadata|

0 commit comments

Comments
 (0)