diff --git a/Appraisals b/Appraisals index e4f338f5..ac7dec51 100644 --- a/Appraisals +++ b/Appraisals @@ -167,6 +167,19 @@ def self.with_timecop_gem(timecop_versions: 0) end end +def self.with_cuprite_gem(cuprite_versions: 0, capybara_versions: 3) + Array(cuprite_versions).each do |cuprite_v| + Array(capybara_versions).each do |capybara_v| + appraise "cuprite-#{cuprite_v}-capybara-#{capybara_v}" do + gem "capybara", "~> #{capybara_v}" + gem "cuprite", "~> #{cuprite_v}" + + gem "cucumber", "~> 9" + end + end + end +end + major, minor, = RUBY_VERSION.segments with_minitest_gem @@ -179,6 +192,7 @@ with_active_support_gem(versions: 4..7) with_knapsack_pro_rspec_gem with_selenium_gem if Gem::Version.new("3.0") <= RUBY_VERSION with_timecop_gem +with_cuprite_gem if Gem::Version.new("3.0") <= RUBY_VERSION ruby_runtime = "#{RUBY_ENGINE}-#{major}.#{minor}" diff --git a/Rakefile b/Rakefile index d842a7b3..8b8b1c42 100644 --- a/Rakefile +++ b/Rakefile @@ -68,7 +68,10 @@ TEST_METADATA = { "knapsack_pro-7-rspec-3" => "✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ❌ jruby" }, "selenium" => { - "selenium-4-capybara-3" => "❌ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ❌ 3.4 / ✅ jruby" + "selenium-4-capybara-3" => "❌ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby" + }, + "cuprite" => { + "cuprite-0-capybara-3" => "❌ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby" }, "timecop" => { "timecop-0" => "✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby" @@ -151,7 +154,9 @@ namespace :spec do ci_queue_rspec knapsack_rspec knapsack_auto_instrument - selenium timecop + selenium + timecop + cuprite ].each do |contrib| desc "" # "Explicitly hiding from `rake -T`" RSpec::Core::RakeTask.new(contrib) do |t, args| diff --git a/Steepfile b/Steepfile index 7a3d755f..deb2a0b2 100644 --- a/Steepfile +++ b/Steepfile @@ -33,4 +33,5 @@ target :lib do library "timecop" library "webmock" library "simplecov" + library "cuprite" end diff --git a/gemfiles/jruby_9.4_cuprite_0_capybara_3.gemfile b/gemfiles/jruby_9.4_cuprite_0_capybara_3.gemfile new file mode 100644 index 00000000..7d2298cd --- /dev/null +++ b/gemfiles/jruby_9.4_cuprite_0_capybara_3.gemfile @@ -0,0 +1,28 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rake-compiler" +gem "simplecov" +gem "rspec" +gem "rspec-collection_matchers" +gem "rspec_junit_formatter" +gem "appraisal" +gem "climate_control" +gem "webmock" +gem "rake" +gem "yard" +gem "os" +gem "capybara", "~> 3" +gem "cuprite", "~> 0" +gem "cucumber", "~> 9" + +group :check do + +end + +group :development do + +end + +gemspec path: "../" diff --git a/gemfiles/jruby_9.4_cuprite_0_capybara_3.gemfile.lock b/gemfiles/jruby_9.4_cuprite_0_capybara_3.gemfile.lock new file mode 100644 index 00000000..4c002a29 --- /dev/null +++ b/gemfiles/jruby_9.4_cuprite_0_capybara_3.gemfile.lock @@ -0,0 +1,157 @@ +PATH + remote: .. + specs: + datadog-ci (1.11.0) + datadog (~> 2.4) + msgpack + +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.2.0) + bigdecimal (3.1.9-java) + builder (3.3.0) + 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) + climate_control (1.2.0) + concurrent-ruby (1.3.5) + crack (1.0.0) + bigdecimal + rexml + cucumber (9.2.1) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) + cucumber-cucumber-expressions (~> 17.0) + cucumber-gherkin (> 24, < 28) + cucumber-html-formatter (> 20.3, < 22) + cucumber-messages (> 19, < 25) + diff-lcs (~> 1.5) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.3) + cucumber-gherkin (>= 27, < 28) + cucumber-messages (>= 20, < 23) + cucumber-tag-expressions (> 5, < 7) + cucumber-cucumber-expressions (17.1.0) + bigdecimal + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) + cucumber-html-formatter (21.7.0) + cucumber-messages (> 19, < 27) + cucumber-messages (22.0.0) + cucumber-tag-expressions (6.1.1) + cuprite (0.15.1) + capybara (~> 3.0) + ferrum (~> 0.15.0) + datadog (2.9.0) + datadog-ruby_core_source (~> 3.3, >= 3.3.7) + libdatadog (~> 14.3.1.1.0) + libddwaf (~> 1.18.0.0.0) + msgpack + datadog-ruby_core_source (3.3.7) + diff-lcs (1.5.1) + docile (1.4.1) + ferrum (0.15) + addressable (~> 2.5) + concurrent-ruby (~> 1.1) + webrick (~> 1.7) + websocket-driver (~> 0.7) + ffi (1.17.1-java) + hashdiff (1.1.2) + libdatadog (14.3.1.1.0) + libddwaf (1.18.0.0.0-java) + ffi (~> 1.0) + matrix (0.4.2) + mini_mime (1.1.5) + msgpack (1.7.5-java) + multi_test (1.1.0) + nokogiri (1.18.2-java) + racc (~> 1.4) + os (1.1.4) + public_suffix (6.0.1) + racc (1.8.1-java) + rack (3.1.8) + rack-test (2.2.0) + rack (>= 1.3) + rake (13.2.1) + rake-compiler (1.2.9) + rake + regexp_parser (2.10.0) + rexml (3.4.0) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.13.1) + simplecov_json_formatter (0.1.4) + sys-uname (1.3.1) + ffi (~> 1.1) + thor (1.3.2) + webmock (3.24.0) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.1) + websocket-driver (0.7.7-java) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + yard (0.9.37) + +PLATFORMS + universal-java-11 + +DEPENDENCIES + appraisal + capybara (~> 3) + climate_control + cucumber (~> 9) + cuprite (~> 0) + datadog-ci! + os + rake + rake-compiler + rspec + rspec-collection_matchers + rspec_junit_formatter + simplecov + webmock + yard + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/ruby_3.0_cuprite_0_capybara_3.gemfile b/gemfiles/ruby_3.0_cuprite_0_capybara_3.gemfile new file mode 100644 index 00000000..32e80f88 --- /dev/null +++ b/gemfiles/ruby_3.0_cuprite_0_capybara_3.gemfile @@ -0,0 +1,29 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "debug" +gem "rake-compiler" +gem "simplecov" +gem "rspec" +gem "rspec-collection_matchers" +gem "rspec_junit_formatter" +gem "appraisal" +gem "climate_control" +gem "webmock" +gem "rake" +gem "yard" +gem "os" +gem "capybara", "~> 3" +gem "cuprite", "~> 0" +gem "cucumber", "~> 9" + +group :check do + +end + +group :development do + +end + +gemspec path: "../" diff --git a/gemfiles/ruby_3.0_cuprite_0_capybara_3.gemfile.lock b/gemfiles/ruby_3.0_cuprite_0_capybara_3.gemfile.lock new file mode 100644 index 00000000..3687b4c9 --- /dev/null +++ b/gemfiles/ruby_3.0_cuprite_0_capybara_3.gemfile.lock @@ -0,0 +1,178 @@ +PATH + remote: .. + specs: + datadog-ci (1.11.0) + datadog (~> 2.4) + msgpack + +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.2.0) + bigdecimal (3.1.9) + builder (3.3.0) + 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) + climate_control (1.2.0) + concurrent-ruby (1.3.5) + crack (1.0.0) + bigdecimal + rexml + cucumber (9.2.1) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) + cucumber-cucumber-expressions (~> 17.0) + cucumber-gherkin (> 24, < 28) + cucumber-html-formatter (> 20.3, < 22) + cucumber-messages (> 19, < 25) + diff-lcs (~> 1.5) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.3) + cucumber-gherkin (>= 27, < 28) + cucumber-messages (>= 20, < 23) + cucumber-tag-expressions (> 5, < 7) + cucumber-cucumber-expressions (17.1.0) + bigdecimal + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) + cucumber-html-formatter (21.7.0) + cucumber-messages (> 19, < 27) + cucumber-messages (22.0.0) + cucumber-tag-expressions (6.1.1) + cuprite (0.15.1) + capybara (~> 3.0) + ferrum (~> 0.15.0) + datadog (2.9.0) + datadog-ruby_core_source (~> 3.3, >= 3.3.7) + libdatadog (~> 14.3.1.1.0) + libddwaf (~> 1.18.0.0.0) + msgpack + datadog-ruby_core_source (3.3.7) + date (3.4.1) + debug (1.10.0) + irb (~> 1.10) + reline (>= 0.3.8) + diff-lcs (1.5.1) + docile (1.4.1) + ferrum (0.15) + addressable (~> 2.5) + concurrent-ruby (~> 1.1) + webrick (~> 1.7) + websocket-driver (~> 0.7) + ffi (1.17.1-aarch64-linux-gnu) + hashdiff (1.1.2) + io-console (0.8.0) + irb (1.15.1) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + libdatadog (14.3.1.1.0-aarch64-linux) + libddwaf (1.18.0.0.0-aarch64-linux) + ffi (~> 1.0) + matrix (0.4.2) + mini_mime (1.1.5) + msgpack (1.7.5) + multi_test (1.1.0) + nokogiri (1.17.2-aarch64-linux) + racc (~> 1.4) + os (1.1.4) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + psych (5.2.3) + date + stringio + public_suffix (6.0.1) + racc (1.8.1) + rack (3.1.8) + rack-test (2.2.0) + rack (>= 1.3) + rake (13.2.1) + rake-compiler (1.2.9) + rake + rdoc (6.11.0) + psych (>= 4.0.0) + regexp_parser (2.10.0) + reline (0.6.0) + io-console (~> 0.5) + rexml (3.4.0) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.13.1) + simplecov_json_formatter (0.1.4) + stringio (3.1.2) + sys-uname (1.3.1) + ffi (~> 1.1) + thor (1.3.2) + webmock (3.24.0) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.1) + websocket-driver (0.7.7) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + yard (0.9.37) + +PLATFORMS + aarch64-linux + +DEPENDENCIES + appraisal + capybara (~> 3) + climate_control + cucumber (~> 9) + cuprite (~> 0) + datadog-ci! + debug + os + rake + rake-compiler + rspec + rspec-collection_matchers + rspec_junit_formatter + simplecov + webmock + yard + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/ruby_3.1_cuprite_0_capybara_3.gemfile b/gemfiles/ruby_3.1_cuprite_0_capybara_3.gemfile new file mode 100644 index 00000000..32e80f88 --- /dev/null +++ b/gemfiles/ruby_3.1_cuprite_0_capybara_3.gemfile @@ -0,0 +1,29 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "debug" +gem "rake-compiler" +gem "simplecov" +gem "rspec" +gem "rspec-collection_matchers" +gem "rspec_junit_formatter" +gem "appraisal" +gem "climate_control" +gem "webmock" +gem "rake" +gem "yard" +gem "os" +gem "capybara", "~> 3" +gem "cuprite", "~> 0" +gem "cucumber", "~> 9" + +group :check do + +end + +group :development do + +end + +gemspec path: "../" diff --git a/gemfiles/ruby_3.1_cuprite_0_capybara_3.gemfile.lock b/gemfiles/ruby_3.1_cuprite_0_capybara_3.gemfile.lock new file mode 100644 index 00000000..79a8a378 --- /dev/null +++ b/gemfiles/ruby_3.1_cuprite_0_capybara_3.gemfile.lock @@ -0,0 +1,178 @@ +PATH + remote: .. + specs: + datadog-ci (1.11.0) + datadog (~> 2.4) + msgpack + +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.2.0) + bigdecimal (3.1.9) + builder (3.3.0) + 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) + climate_control (1.2.0) + concurrent-ruby (1.3.5) + crack (1.0.0) + bigdecimal + rexml + cucumber (9.2.1) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) + cucumber-cucumber-expressions (~> 17.0) + cucumber-gherkin (> 24, < 28) + cucumber-html-formatter (> 20.3, < 22) + cucumber-messages (> 19, < 25) + diff-lcs (~> 1.5) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.3) + cucumber-gherkin (>= 27, < 28) + cucumber-messages (>= 20, < 23) + cucumber-tag-expressions (> 5, < 7) + cucumber-cucumber-expressions (17.1.0) + bigdecimal + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) + cucumber-html-formatter (21.7.0) + cucumber-messages (> 19, < 27) + cucumber-messages (22.0.0) + cucumber-tag-expressions (6.1.1) + cuprite (0.15.1) + capybara (~> 3.0) + ferrum (~> 0.15.0) + datadog (2.9.0) + datadog-ruby_core_source (~> 3.3, >= 3.3.7) + libdatadog (~> 14.3.1.1.0) + libddwaf (~> 1.18.0.0.0) + msgpack + datadog-ruby_core_source (3.3.7) + date (3.4.1) + debug (1.10.0) + irb (~> 1.10) + reline (>= 0.3.8) + diff-lcs (1.5.1) + docile (1.4.1) + ferrum (0.15) + addressable (~> 2.5) + concurrent-ruby (~> 1.1) + webrick (~> 1.7) + websocket-driver (~> 0.7) + ffi (1.17.1-aarch64-linux-gnu) + hashdiff (1.1.2) + io-console (0.8.0) + irb (1.15.1) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + libdatadog (14.3.1.1.0-aarch64-linux) + libddwaf (1.18.0.0.0-aarch64-linux) + ffi (~> 1.0) + matrix (0.4.2) + mini_mime (1.1.5) + msgpack (1.7.5) + multi_test (1.1.0) + nokogiri (1.18.2-aarch64-linux-gnu) + racc (~> 1.4) + os (1.1.4) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + psych (5.2.3) + date + stringio + public_suffix (6.0.1) + racc (1.8.1) + rack (3.1.8) + rack-test (2.2.0) + rack (>= 1.3) + rake (13.2.1) + rake-compiler (1.2.9) + rake + rdoc (6.11.0) + psych (>= 4.0.0) + regexp_parser (2.10.0) + reline (0.6.0) + io-console (~> 0.5) + rexml (3.4.0) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.13.1) + simplecov_json_formatter (0.1.4) + stringio (3.1.2) + sys-uname (1.3.1) + ffi (~> 1.1) + thor (1.3.2) + webmock (3.24.0) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.1) + websocket-driver (0.7.7) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + yard (0.9.37) + +PLATFORMS + aarch64-linux + +DEPENDENCIES + appraisal + capybara (~> 3) + climate_control + cucumber (~> 9) + cuprite (~> 0) + datadog-ci! + debug + os + rake + rake-compiler + rspec + rspec-collection_matchers + rspec_junit_formatter + simplecov + webmock + yard + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/ruby_3.2_cuprite_0_capybara_3.gemfile b/gemfiles/ruby_3.2_cuprite_0_capybara_3.gemfile new file mode 100644 index 00000000..32e80f88 --- /dev/null +++ b/gemfiles/ruby_3.2_cuprite_0_capybara_3.gemfile @@ -0,0 +1,29 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "debug" +gem "rake-compiler" +gem "simplecov" +gem "rspec" +gem "rspec-collection_matchers" +gem "rspec_junit_formatter" +gem "appraisal" +gem "climate_control" +gem "webmock" +gem "rake" +gem "yard" +gem "os" +gem "capybara", "~> 3" +gem "cuprite", "~> 0" +gem "cucumber", "~> 9" + +group :check do + +end + +group :development do + +end + +gemspec path: "../" diff --git a/gemfiles/ruby_3.2_cuprite_0_capybara_3.gemfile.lock b/gemfiles/ruby_3.2_cuprite_0_capybara_3.gemfile.lock new file mode 100644 index 00000000..79a8a378 --- /dev/null +++ b/gemfiles/ruby_3.2_cuprite_0_capybara_3.gemfile.lock @@ -0,0 +1,178 @@ +PATH + remote: .. + specs: + datadog-ci (1.11.0) + datadog (~> 2.4) + msgpack + +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.2.0) + bigdecimal (3.1.9) + builder (3.3.0) + 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) + climate_control (1.2.0) + concurrent-ruby (1.3.5) + crack (1.0.0) + bigdecimal + rexml + cucumber (9.2.1) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) + cucumber-cucumber-expressions (~> 17.0) + cucumber-gherkin (> 24, < 28) + cucumber-html-formatter (> 20.3, < 22) + cucumber-messages (> 19, < 25) + diff-lcs (~> 1.5) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.3) + cucumber-gherkin (>= 27, < 28) + cucumber-messages (>= 20, < 23) + cucumber-tag-expressions (> 5, < 7) + cucumber-cucumber-expressions (17.1.0) + bigdecimal + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) + cucumber-html-formatter (21.7.0) + cucumber-messages (> 19, < 27) + cucumber-messages (22.0.0) + cucumber-tag-expressions (6.1.1) + cuprite (0.15.1) + capybara (~> 3.0) + ferrum (~> 0.15.0) + datadog (2.9.0) + datadog-ruby_core_source (~> 3.3, >= 3.3.7) + libdatadog (~> 14.3.1.1.0) + libddwaf (~> 1.18.0.0.0) + msgpack + datadog-ruby_core_source (3.3.7) + date (3.4.1) + debug (1.10.0) + irb (~> 1.10) + reline (>= 0.3.8) + diff-lcs (1.5.1) + docile (1.4.1) + ferrum (0.15) + addressable (~> 2.5) + concurrent-ruby (~> 1.1) + webrick (~> 1.7) + websocket-driver (~> 0.7) + ffi (1.17.1-aarch64-linux-gnu) + hashdiff (1.1.2) + io-console (0.8.0) + irb (1.15.1) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + libdatadog (14.3.1.1.0-aarch64-linux) + libddwaf (1.18.0.0.0-aarch64-linux) + ffi (~> 1.0) + matrix (0.4.2) + mini_mime (1.1.5) + msgpack (1.7.5) + multi_test (1.1.0) + nokogiri (1.18.2-aarch64-linux-gnu) + racc (~> 1.4) + os (1.1.4) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + psych (5.2.3) + date + stringio + public_suffix (6.0.1) + racc (1.8.1) + rack (3.1.8) + rack-test (2.2.0) + rack (>= 1.3) + rake (13.2.1) + rake-compiler (1.2.9) + rake + rdoc (6.11.0) + psych (>= 4.0.0) + regexp_parser (2.10.0) + reline (0.6.0) + io-console (~> 0.5) + rexml (3.4.0) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.13.1) + simplecov_json_formatter (0.1.4) + stringio (3.1.2) + sys-uname (1.3.1) + ffi (~> 1.1) + thor (1.3.2) + webmock (3.24.0) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.1) + websocket-driver (0.7.7) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + yard (0.9.37) + +PLATFORMS + aarch64-linux + +DEPENDENCIES + appraisal + capybara (~> 3) + climate_control + cucumber (~> 9) + cuprite (~> 0) + datadog-ci! + debug + os + rake + rake-compiler + rspec + rspec-collection_matchers + rspec_junit_formatter + simplecov + webmock + yard + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/ruby_3.3_cuprite_0_capybara_3.gemfile b/gemfiles/ruby_3.3_cuprite_0_capybara_3.gemfile new file mode 100644 index 00000000..32e80f88 --- /dev/null +++ b/gemfiles/ruby_3.3_cuprite_0_capybara_3.gemfile @@ -0,0 +1,29 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "debug" +gem "rake-compiler" +gem "simplecov" +gem "rspec" +gem "rspec-collection_matchers" +gem "rspec_junit_formatter" +gem "appraisal" +gem "climate_control" +gem "webmock" +gem "rake" +gem "yard" +gem "os" +gem "capybara", "~> 3" +gem "cuprite", "~> 0" +gem "cucumber", "~> 9" + +group :check do + +end + +group :development do + +end + +gemspec path: "../" diff --git a/gemfiles/ruby_3.3_cuprite_0_capybara_3.gemfile.lock b/gemfiles/ruby_3.3_cuprite_0_capybara_3.gemfile.lock new file mode 100644 index 00000000..e12e97b2 --- /dev/null +++ b/gemfiles/ruby_3.3_cuprite_0_capybara_3.gemfile.lock @@ -0,0 +1,178 @@ +PATH + remote: .. + specs: + datadog-ci (1.11.0) + datadog (~> 2.4) + msgpack + +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.2.0) + bigdecimal (3.1.9) + builder (3.3.0) + 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) + climate_control (1.2.0) + concurrent-ruby (1.3.5) + crack (1.0.0) + bigdecimal + rexml + cucumber (9.2.1) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) + cucumber-cucumber-expressions (~> 17.0) + cucumber-gherkin (> 24, < 28) + cucumber-html-formatter (> 20.3, < 22) + cucumber-messages (> 19, < 25) + diff-lcs (~> 1.5) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.3) + cucumber-gherkin (>= 27, < 28) + cucumber-messages (>= 20, < 23) + cucumber-tag-expressions (> 5, < 7) + cucumber-cucumber-expressions (17.1.0) + bigdecimal + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) + cucumber-html-formatter (21.7.0) + cucumber-messages (> 19, < 27) + cucumber-messages (22.0.0) + cucumber-tag-expressions (6.1.1) + cuprite (0.15.1) + capybara (~> 3.0) + ferrum (~> 0.15.0) + datadog (2.9.0) + datadog-ruby_core_source (~> 3.3, >= 3.3.7) + libdatadog (~> 14.3.1.1.0) + libddwaf (~> 1.18.0.0.0) + msgpack + datadog-ruby_core_source (3.3.7) + date (3.4.1) + debug (1.10.0) + irb (~> 1.10) + reline (>= 0.3.8) + diff-lcs (1.5.1) + docile (1.4.1) + ferrum (0.15) + addressable (~> 2.5) + concurrent-ruby (~> 1.1) + webrick (~> 1.7) + websocket-driver (~> 0.7) + ffi (1.17.1-aarch64-linux-gnu) + hashdiff (1.1.2) + io-console (0.8.0) + irb (1.15.1) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + libdatadog (14.3.1.1.0-aarch64-linux) + libddwaf (1.18.0.0.0-aarch64-linux) + ffi (~> 1.0) + matrix (0.4.2) + mini_mime (1.1.5) + msgpack (1.7.5) + multi_test (1.1.0) + nokogiri (1.18.2-aarch64-linux-gnu) + racc (~> 1.4) + os (1.1.4) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + psych (5.2.3) + date + stringio + public_suffix (6.0.1) + racc (1.8.1) + rack (3.1.8) + rack-test (2.2.0) + rack (>= 1.3) + rake (13.2.1) + rake-compiler (1.2.9) + rake + rdoc (6.11.0) + psych (>= 4.0.0) + regexp_parser (2.10.0) + reline (0.6.0) + io-console (~> 0.5) + rexml (3.4.0) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.13.1) + simplecov_json_formatter (0.1.4) + stringio (3.1.2) + sys-uname (1.3.1) + ffi (~> 1.1) + thor (1.3.2) + webmock (3.24.0) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.1) + websocket-driver (0.7.7) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + yard (0.9.37) + +PLATFORMS + aarch64-linux + +DEPENDENCIES + appraisal + capybara (~> 3) + climate_control + cucumber (~> 9) + cuprite (~> 0) + datadog-ci! + debug + os + rake + rake-compiler + rspec + rspec-collection_matchers + rspec_junit_formatter + simplecov + webmock + yard + +BUNDLED WITH + 2.4.19 diff --git a/gemfiles/ruby_3.4_cuprite_0_capybara_3.gemfile b/gemfiles/ruby_3.4_cuprite_0_capybara_3.gemfile new file mode 100644 index 00000000..32e80f88 --- /dev/null +++ b/gemfiles/ruby_3.4_cuprite_0_capybara_3.gemfile @@ -0,0 +1,29 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "debug" +gem "rake-compiler" +gem "simplecov" +gem "rspec" +gem "rspec-collection_matchers" +gem "rspec_junit_formatter" +gem "appraisal" +gem "climate_control" +gem "webmock" +gem "rake" +gem "yard" +gem "os" +gem "capybara", "~> 3" +gem "cuprite", "~> 0" +gem "cucumber", "~> 9" + +group :check do + +end + +group :development do + +end + +gemspec path: "../" diff --git a/gemfiles/ruby_3.4_cuprite_0_capybara_3.gemfile.lock b/gemfiles/ruby_3.4_cuprite_0_capybara_3.gemfile.lock new file mode 100644 index 00000000..09f6468e --- /dev/null +++ b/gemfiles/ruby_3.4_cuprite_0_capybara_3.gemfile.lock @@ -0,0 +1,217 @@ +PATH + remote: .. + specs: + datadog-ci (1.11.0) + datadog (~> 2.4) + msgpack + +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.2.0) + bigdecimal (3.1.9) + builder (3.3.0) + 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) + climate_control (1.2.0) + concurrent-ruby (1.3.5) + crack (1.0.0) + bigdecimal + rexml + cucumber (9.2.1) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) + cucumber-cucumber-expressions (~> 17.0) + cucumber-gherkin (> 24, < 28) + cucumber-html-formatter (> 20.3, < 22) + cucumber-messages (> 19, < 25) + diff-lcs (~> 1.5) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.3) + cucumber-gherkin (>= 27, < 28) + cucumber-messages (>= 20, < 23) + cucumber-tag-expressions (> 5, < 7) + cucumber-cucumber-expressions (17.1.0) + bigdecimal + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) + cucumber-html-formatter (21.7.0) + cucumber-messages (> 19, < 27) + cucumber-messages (22.0.0) + cucumber-tag-expressions (6.1.1) + cuprite (0.15.1) + capybara (~> 3.0) + ferrum (~> 0.15.0) + datadog (2.9.0) + datadog-ruby_core_source (~> 3.3, >= 3.3.7) + libdatadog (~> 14.3.1.1.0) + libddwaf (~> 1.18.0.0.0) + msgpack + datadog-ruby_core_source (3.3.7) + date (3.4.1) + debug (1.10.0) + irb (~> 1.10) + reline (>= 0.3.8) + diff-lcs (1.5.1) + docile (1.4.1) + ferrum (0.15) + addressable (~> 2.5) + concurrent-ruby (~> 1.1) + webrick (~> 1.7) + websocket-driver (~> 0.7) + ffi (1.17.1-aarch64-linux-gnu) + ffi (1.17.1-aarch64-linux-musl) + ffi (1.17.1-arm-linux-gnu) + ffi (1.17.1-arm-linux-musl) + ffi (1.17.1-arm64-darwin) + ffi (1.17.1-x86_64-darwin) + ffi (1.17.1-x86_64-linux-gnu) + ffi (1.17.1-x86_64-linux-musl) + hashdiff (1.1.2) + io-console (0.8.0) + irb (1.15.1) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + libdatadog (14.3.1.1.0) + libdatadog (14.3.1.1.0-aarch64-linux) + libdatadog (14.3.1.1.0-x86_64-linux) + libddwaf (1.18.0.0.0) + ffi (~> 1.0) + libddwaf (1.18.0.0.0-aarch64-linux) + ffi (~> 1.0) + libddwaf (1.18.0.0.0-arm64-darwin) + ffi (~> 1.0) + libddwaf (1.18.0.0.0-x86_64-darwin) + ffi (~> 1.0) + libddwaf (1.18.0.0.0-x86_64-linux) + ffi (~> 1.0) + matrix (0.4.2) + mini_mime (1.1.5) + msgpack (1.7.5) + multi_test (1.1.0) + nokogiri (1.18.2-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.2-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.18.2-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.2-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.18.2-arm64-darwin) + racc (~> 1.4) + nokogiri (1.18.2-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.18.2-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.2-x86_64-linux-musl) + racc (~> 1.4) + os (1.1.4) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + psych (5.2.3) + date + stringio + public_suffix (6.0.1) + racc (1.8.1) + rack (3.1.8) + rack-test (2.2.0) + rack (>= 1.3) + rake (13.2.1) + rake-compiler (1.2.9) + rake + rdoc (6.11.0) + psych (>= 4.0.0) + regexp_parser (2.10.0) + reline (0.6.0) + io-console (~> 0.5) + rexml (3.4.0) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.13.1) + simplecov_json_formatter (0.1.4) + stringio (3.1.2) + sys-uname (1.3.1) + ffi (~> 1.1) + thor (1.3.2) + webmock (3.24.0) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.1) + websocket-driver (0.7.7) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + yard (0.9.37) + +PLATFORMS + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin + x86_64-linux + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + appraisal + capybara (~> 3) + climate_control + cucumber (~> 9) + cuprite (~> 0) + datadog-ci! + debug + os + rake + rake-compiler + rspec + rspec-collection_matchers + rspec_junit_formatter + simplecov + webmock + yard + +BUNDLED WITH + 2.5.17 diff --git a/lib/datadog/ci.rb b/lib/datadog/ci.rb index 2720ad23..51d0da44 100644 --- a/lib/datadog/ci.rb +++ b/lib/datadog/ci.rb @@ -418,6 +418,7 @@ def test_optimisation # Additional test libraries (auto instrumented later on test session start) require_relative "ci/contrib/selenium/integration" +require_relative "ci/contrib/cuprite/integration" require_relative "ci/contrib/simplecov/integration" # Configuration extensions diff --git a/lib/datadog/ci/contrib/cuprite/configuration/settings.rb b/lib/datadog/ci/contrib/cuprite/configuration/settings.rb new file mode 100644 index 00000000..0e9e5f05 --- /dev/null +++ b/lib/datadog/ci/contrib/cuprite/configuration/settings.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require "datadog/core" + +require_relative "../ext" +require_relative "../../settings" + +require_relative "../../../ext/rum" + +module Datadog + module CI + module Contrib + module Cuprite + module Configuration + # Custom settings for the Cuprite integration + # @public_api + class Settings < Datadog::CI::Contrib::Settings + option :enabled do |o| + o.type :bool + o.env Ext::ENV_ENABLED + o.default true + end + + option :rum_flush_wait_millis do |o| + o.type :int + o.env CI::Ext::RUM::ENV_RUM_FLUSH_WAIT_MILLIS + o.default 500 + end + end + end + end + end + end +end diff --git a/lib/datadog/ci/contrib/cuprite/driver.rb b/lib/datadog/ci/contrib/cuprite/driver.rb new file mode 100644 index 00000000..9887c7ec --- /dev/null +++ b/lib/datadog/ci/contrib/cuprite/driver.rb @@ -0,0 +1,94 @@ +# frozen_string_literal: true + +require_relative "script_executor" +require_relative "../patcher" + +require_relative "../../ext/rum" +require_relative "../../ext/test" +require_relative "../../utils/rum" + +module Datadog + module CI + module Contrib + module Cuprite + # instruments Capybara::Cuprite::Driver + module Driver + def self.included(base) + base.prepend(InstanceMethods) + end + + module InstanceMethods + def visit(url) + result = super + + return result unless datadog_configuration[:enabled] + + Datadog.logger.debug("[Cuprite] Navigation to #{url}") + + # on session reset Capybara navigates to about:blank + return result if url == "about:blank" + + active_test = Datadog::CI.active_test + Datadog.logger.debug("[Cuprite] Active test: #{active_test}") + + return result unless active_test + + # Set the test's trace id as a cookie in browser session + Datadog.logger.debug do + "[Cuprite] Setting cookie #{CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID} to #{active_test.trace_id}" + end + set_cookie(CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID, active_test.trace_id.to_s) + + # set the test type to browser + active_test.set_tag(CI::Ext::Test::TAG_TYPE, CI::Ext::Test::Type::BROWSER) + + # set the tags specific to the browser test + active_test.set_tag(CI::Ext::Test::TAG_BROWSER_DRIVER, "cuprite") + active_test.set_tag(CI::Ext::Test::TAG_BROWSER_DRIVER_VERSION, datadog_integration.version) + active_test.set_tag(CI::Ext::Test::TAG_BROWSER_NAME, browser.options.browser_name || "chrome") + active_test.set_tag(CI::Ext::Test::TAG_BROWSER_VERSION, browser.version.product) + + result + end + + def reset! + Datadog.logger.debug("[Cuprite] Driver reset! event") + + datadog_end_rum_session + + super + end + + def quit + Datadog.logger.debug("[Cuprite] Driver quit event") + + datadog_end_rum_session + + super + end + + private + + def datadog_integration + CI::Contrib::Instrumentation.fetch_integration(:cuprite) + end + + def datadog_configuration + Datadog.configuration.ci[:cuprite] + end + + def datadog_end_rum_session + return unless datadog_configuration[:enabled] + + executor = ScriptExecutor.new(browser) + Utils::RUM.stop_rum_session(executor, rum_flush_wait_millis: datadog_configuration[:rum_flush_wait_millis]) + + Datadog.logger.debug("[Cuprite] Deleting Datadog cookie") + remove_cookie(CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID) + end + end + end + end + end + end +end diff --git a/lib/datadog/ci/contrib/cuprite/ext.rb b/lib/datadog/ci/contrib/cuprite/ext.rb new file mode 100644 index 00000000..31b22150 --- /dev/null +++ b/lib/datadog/ci/contrib/cuprite/ext.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Datadog + module CI + module Contrib + module Cuprite + # Cuprite integration constants + # @public_api + module Ext + ENV_ENABLED = "DD_CIVISIBILITY_CUPRITE_ENABLED" + end + end + end + end +end diff --git a/lib/datadog/ci/contrib/cuprite/integration.rb b/lib/datadog/ci/contrib/cuprite/integration.rb new file mode 100644 index 00000000..d5b87e59 --- /dev/null +++ b/lib/datadog/ci/contrib/cuprite/integration.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +require_relative "../integration" +require_relative "configuration/settings" +require_relative "patcher" + +module Datadog + module CI + module Contrib + module Cuprite + # Description of Cuprite integration + class Integration < Contrib::Integration + MINIMUM_VERSION = Gem::Version.new("0.15.0") + + def version + Gem.loaded_specs["cuprite"]&.version + end + + def loaded? + !defined?(::Capybara).nil? && !defined?(::Capybara::Cuprite).nil? && + !defined?(::Capybara::Cuprite::Driver).nil? + end + + def compatible? + super && version >= MINIMUM_VERSION + end + + # additional instrumentations for test libraries are late instrumented on test session start + def late_instrument? + true + end + + def new_configuration + Configuration::Settings.new + end + + def patcher + Patcher + end + end + end + end + end +end diff --git a/lib/datadog/ci/contrib/cuprite/patcher.rb b/lib/datadog/ci/contrib/cuprite/patcher.rb new file mode 100644 index 00000000..348aad89 --- /dev/null +++ b/lib/datadog/ci/contrib/cuprite/patcher.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require_relative "../patcher" + +require_relative "driver" + +module Datadog + module CI + module Contrib + module Cuprite + # Patcher enables patching of 'Capybara::Cuprite::Driver' class. + module Patcher + include Datadog::CI::Contrib::Patcher + + module_function + + def patch + ::Capybara::Cuprite::Driver.include(Driver) + end + end + end + end + end +end diff --git a/lib/datadog/ci/contrib/cuprite/script_executor.rb b/lib/datadog/ci/contrib/cuprite/script_executor.rb new file mode 100644 index 00000000..64fcfc22 --- /dev/null +++ b/lib/datadog/ci/contrib/cuprite/script_executor.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require_relative "../../ext/rum" + +module Datadog + module CI + module Contrib + module Cuprite + class ScriptExecutor + # Ferrum::Browser requires a JS script to be wrapped in a function() { ... } block + WRAPPED_SCRIPTS = { + CI::Ext::RUM::SCRIPT_IS_RUM_ACTIVE => "function() { #{CI::Ext::RUM::SCRIPT_IS_RUM_ACTIVE}; }", + CI::Ext::RUM::SCRIPT_STOP_RUM_SESSION => <<~JS + function() { + #{CI::Ext::RUM::SCRIPT_STOP_RUM_SESSION} + } + JS + }.freeze + + def initialize(ferrum_browser) + @ferrum_browser = ferrum_browser + end + + def execute_script(script) + script = WRAPPED_SCRIPTS.fetch(script, script) + @ferrum_browser.evaluate_func(script) + end + end + end + end + end +end diff --git a/lib/datadog/ci/contrib/selenium/capybara_driver.rb b/lib/datadog/ci/contrib/selenium/capybara_driver.rb index 5dd671ce..3f2fbc29 100644 --- a/lib/datadog/ci/contrib/selenium/capybara_driver.rb +++ b/lib/datadog/ci/contrib/selenium/capybara_driver.rb @@ -2,9 +2,9 @@ require_relative "../patcher" -require_relative "ext" -require_relative "rum" +require_relative "../../ext/rum" require_relative "../../ext/test" +require_relative "../../utils/rum" module Datadog module CI @@ -22,10 +22,10 @@ def reset! Datadog.logger.debug("[Selenium] Capybara session reset event") - RUM.stop_rum_session(@browser) + Utils::RUM.stop_rum_session(@browser, rum_flush_wait_millis: datadog_configuration[:rum_flush_wait_millis]) Datadog.logger.debug("[Selenium] RUM session stopped, deleting cookie") - @browser.manage.delete_cookie(Ext::COOKIE_TEST_EXECUTION_ID) + @browser.manage.delete_cookie(CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID) rescue ::Selenium::WebDriver::Error::WebDriverError => e Datadog.logger.debug("[Selenium] Error while resetting Capybara session: #{e.message}") ensure diff --git a/lib/datadog/ci/contrib/selenium/configuration/settings.rb b/lib/datadog/ci/contrib/selenium/configuration/settings.rb index bce29ad1..cdfd202f 100644 --- a/lib/datadog/ci/contrib/selenium/configuration/settings.rb +++ b/lib/datadog/ci/contrib/selenium/configuration/settings.rb @@ -5,6 +5,8 @@ require_relative "../ext" require_relative "../../settings" +require_relative "../../../ext/rum" + module Datadog module CI module Contrib @@ -21,7 +23,7 @@ class Settings < Datadog::CI::Contrib::Settings option :rum_flush_wait_millis do |o| o.type :int - o.env Ext::ENV_RUM_FLUSH_WAIT_MILLIS + o.env CI::Ext::RUM::ENV_RUM_FLUSH_WAIT_MILLIS o.default 500 end end diff --git a/lib/datadog/ci/contrib/selenium/driver.rb b/lib/datadog/ci/contrib/selenium/driver.rb index 75a2757c..1d988fa4 100644 --- a/lib/datadog/ci/contrib/selenium/driver.rb +++ b/lib/datadog/ci/contrib/selenium/driver.rb @@ -2,8 +2,8 @@ require_relative "../patcher" -require_relative "ext" -require_relative "rum" +require_relative "../../utils/rum" +require_relative "../../ext/rum" require_relative "../../ext/test" module Datadog @@ -22,10 +22,10 @@ def quit Datadog.logger.debug("[Selenium] Driver quit event") - RUM.stop_rum_session(@bridge) + Utils::RUM.stop_rum_session(@bridge, rum_flush_wait_millis: datadog_configuration[:rum_flush_wait_millis]) Datadog.logger.debug("[Selenium] RUM session stopped, deleting cookie") - @bridge.manage.delete_cookie(Ext::COOKIE_TEST_EXECUTION_ID) + @bridge.manage.delete_cookie(CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID) rescue ::Selenium::WebDriver::Error::WebDriverError => e Datadog.logger.debug("[Selenium] Error while quitting Selenium driver: #{e.message}") ensure diff --git a/lib/datadog/ci/contrib/selenium/ext.rb b/lib/datadog/ci/contrib/selenium/ext.rb index 4e6aae8f..47452b90 100644 --- a/lib/datadog/ci/contrib/selenium/ext.rb +++ b/lib/datadog/ci/contrib/selenium/ext.rb @@ -8,21 +8,6 @@ module Selenium # @public_api module Ext ENV_ENABLED = "DD_CIVISIBILITY_SELENIUM_ENABLED" - ENV_RUM_FLUSH_WAIT_MILLIS = "DD_CIVISIBILITY_RUM_FLUSH_WAIT_MILLIS" - - COOKIE_TEST_EXECUTION_ID = "datadog-ci-visibility-test-execution-id" - - SCRIPT_IS_RUM_ACTIVE = <<~JS - return !!window.DD_RUM - JS - SCRIPT_STOP_RUM_SESSION = <<~JS - if (window.DD_RUM && window.DD_RUM.stopSession) { - window.DD_RUM.stopSession(); - return true; - } else { - return false; - } - JS end end end diff --git a/lib/datadog/ci/contrib/selenium/navigation.rb b/lib/datadog/ci/contrib/selenium/navigation.rb index dd76b92f..187bfd5c 100644 --- a/lib/datadog/ci/contrib/selenium/navigation.rb +++ b/lib/datadog/ci/contrib/selenium/navigation.rb @@ -2,7 +2,7 @@ require_relative "../patcher" -require_relative "ext" +require_relative "../../ext/rum" require_relative "../../ext/test" module Datadog @@ -32,7 +32,7 @@ def to(url) return result unless active_test # Set the test's trace id as a cookie in browser session - cookie_hash = {name: Ext::COOKIE_TEST_EXECUTION_ID, value: active_test.trace_id.to_s} + cookie_hash = {name: CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID, value: active_test.trace_id.to_s} Datadog.logger.debug { "[Selenium] Setting cookie: #{cookie_hash}" } @bridge.manage.add_cookie(cookie_hash) diff --git a/lib/datadog/ci/contrib/selenium/rum.rb b/lib/datadog/ci/contrib/selenium/rum.rb deleted file mode 100644 index f5fb25d4..00000000 --- a/lib/datadog/ci/contrib/selenium/rum.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -require_relative "ext" -require_relative "../../ext/test" -require_relative "../../utils/parsing" - -module Datadog - module CI - module Contrib - module Selenium - # Provides functionality to interact with Datadog Real User Monitoring product - # via executing JavaScript code in the browser. - # - # Relevant docs: https://docs.datadoghq.com/real_user_monitoring/browser/ - module RUM - def self.is_rum_active?(script_executor) - is_rum_active_script_result = script_executor.execute_script(Ext::SCRIPT_IS_RUM_ACTIVE) - Datadog.logger.debug { "[Selenium] SCRIPT_IS_RUM_ACTIVE result is #{is_rum_active_script_result.inspect}" } - Utils::Parsing.convert_to_bool(is_rum_active_script_result) - end - - def self.stop_rum_session(script_executor) - config = Datadog.configuration.ci[:selenium] - if is_rum_active?(script_executor) - Datadog::CI.active_test&.set_tag( - CI::Ext::Test::TAG_IS_RUM_ACTIVE, - "true" - ) - - result = script_executor.execute_script(Ext::SCRIPT_STOP_RUM_SESSION) - Datadog.logger.debug { "[Selenium] SCRIPT_STOP_RUM_SESSION result is #{result.inspect}" } - - # introduce a delay to allow the RUM session to be stopped - delay = config[:rum_flush_wait_millis] / 1000.0 - Datadog.logger.debug { "[Selenium] Waiting for #{delay} seconds" } - sleep(delay) - end - end - end - end - end - end -end diff --git a/lib/datadog/ci/ext/rum.rb b/lib/datadog/ci/ext/rum.rb new file mode 100644 index 00000000..3be5d576 --- /dev/null +++ b/lib/datadog/ci/ext/rum.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Datadog + module CI + module Ext + # Defines constants for Git tags + module RUM + ENV_RUM_FLUSH_WAIT_MILLIS = "DD_CIVISIBILITY_RUM_FLUSH_WAIT_MILLIS" + + COOKIE_TEST_EXECUTION_ID = "datadog-ci-visibility-test-execution-id" + + SCRIPT_IS_RUM_ACTIVE = <<~JS + return !!window.DD_RUM + JS + SCRIPT_STOP_RUM_SESSION = <<~JS + if (window.DD_RUM && window.DD_RUM.stopSession) { + window.DD_RUM.stopSession(); + return true; + } else { + return false; + } + JS + end + end + end +end diff --git a/lib/datadog/ci/utils/rum.rb b/lib/datadog/ci/utils/rum.rb new file mode 100644 index 00000000..fb6ee96f --- /dev/null +++ b/lib/datadog/ci/utils/rum.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +require_relative "../ext/rum" +require_relative "../ext/test" +require_relative "parsing" + +module Datadog + module CI + module Utils + # Provides functionality to interact with Datadog Real User Monitoring product + # via executing JavaScript code in the browser. + # + # Relevant docs: https://docs.datadoghq.com/real_user_monitoring/browser/ + module RUM + def self.is_rum_active?(script_executor) + is_rum_active_script_result = script_executor.execute_script(Ext::RUM::SCRIPT_IS_RUM_ACTIVE) + + Datadog.logger.debug { "[RUM] SCRIPT_IS_RUM_ACTIVE result is #{is_rum_active_script_result.inspect}" } + + Utils::Parsing.convert_to_bool(is_rum_active_script_result) + end + + def self.stop_rum_session(script_executor, rum_flush_wait_millis: 500) + return unless is_rum_active?(script_executor) + + Datadog::CI.active_test&.set_tag( + CI::Ext::Test::TAG_IS_RUM_ACTIVE, + "true" + ) + + result = script_executor.execute_script(Ext::RUM::SCRIPT_STOP_RUM_SESSION) + Datadog.logger.debug { "[RUM] SCRIPT_STOP_RUM_SESSION result is #{result.inspect}" } + + # introduce a delay to allow the RUM session to be stopped + delay = rum_flush_wait_millis / 1000.0 + Datadog.logger.debug { "[RUM] Waiting for #{delay} seconds" } + sleep(delay) + end + end + end + end +end diff --git a/sig/datadog/ci/contrib/cuprite/configuration/settings.rbs b/sig/datadog/ci/contrib/cuprite/configuration/settings.rbs new file mode 100644 index 00000000..39795f8b --- /dev/null +++ b/sig/datadog/ci/contrib/cuprite/configuration/settings.rbs @@ -0,0 +1,12 @@ +module Datadog + module CI + module Contrib + module Cuprite + module Configuration + class Settings < Datadog::CI::Contrib::Settings + end + end + end + end + end +end diff --git a/sig/datadog/ci/contrib/cuprite/driver.rbs b/sig/datadog/ci/contrib/cuprite/driver.rbs new file mode 100644 index 00000000..6a20cc00 --- /dev/null +++ b/sig/datadog/ci/contrib/cuprite/driver.rbs @@ -0,0 +1,29 @@ +module Datadog + module CI + module Contrib + module Cuprite + module Driver + def self.included: (untyped base) -> untyped + + module InstanceMethods + include Capybara::Cuprite::Driver + + def visit: (untyped url) -> untyped + + def reset!: () -> untyped + + def quit: () -> untyped + + private + + def datadog_integration: () -> untyped + + def datadog_configuration: () -> untyped + + def datadog_end_rum_session: () -> (nil | untyped) + end + end + end + end + end +end diff --git a/sig/datadog/ci/contrib/cuprite/ext.rbs b/sig/datadog/ci/contrib/cuprite/ext.rbs new file mode 100644 index 00000000..2ae73967 --- /dev/null +++ b/sig/datadog/ci/contrib/cuprite/ext.rbs @@ -0,0 +1,11 @@ +module Datadog + module CI + module Contrib + module Cuprite + module Ext + ENV_ENABLED: "DD_CIVISIBILITY_CUPRITE_ENABLED" + end + end + end + end +end diff --git a/sig/datadog/ci/contrib/cuprite/integration.rbs b/sig/datadog/ci/contrib/cuprite/integration.rbs new file mode 100644 index 00000000..0f9deeb4 --- /dev/null +++ b/sig/datadog/ci/contrib/cuprite/integration.rbs @@ -0,0 +1,23 @@ +module Datadog + module CI + module Contrib + module Cuprite + class Integration < Contrib::Integration + MINIMUM_VERSION: Gem::Version + + def version: () -> untyped + + def loaded?: () -> bool + + def compatible?: () -> bool + + def late_instrument?: () -> true + + def new_configuration: () -> untyped + + def patcher: () -> untyped + end + end + end + end +end diff --git a/sig/datadog/ci/contrib/cuprite/patcher.rbs b/sig/datadog/ci/contrib/cuprite/patcher.rbs new file mode 100644 index 00000000..9abdfd4f --- /dev/null +++ b/sig/datadog/ci/contrib/cuprite/patcher.rbs @@ -0,0 +1,13 @@ +module Datadog + module CI + module Contrib + module Cuprite + module Patcher + include Datadog::CI::Contrib::Patcher + + def self?.patch: () -> untyped + end + end + end + end +end diff --git a/sig/datadog/ci/contrib/cuprite/script_executor.rbs b/sig/datadog/ci/contrib/cuprite/script_executor.rbs new file mode 100644 index 00000000..d30deeb7 --- /dev/null +++ b/sig/datadog/ci/contrib/cuprite/script_executor.rbs @@ -0,0 +1,16 @@ +module Datadog + module CI + module Contrib + module Cuprite + class ScriptExecutor + @ferrum_browser: Ferrum::Browser + WRAPPED_SCRIPTS: ::Hash[::String, ::String] + + def initialize: (Ferrum::Browser ferrum_browser) -> void + + def execute_script: (String script) -> String + end + end + end + end +end diff --git a/sig/datadog/ci/contrib/selenium/ext.rbs b/sig/datadog/ci/contrib/selenium/ext.rbs index 0b8cdede..a3dce477 100644 --- a/sig/datadog/ci/contrib/selenium/ext.rbs +++ b/sig/datadog/ci/contrib/selenium/ext.rbs @@ -4,14 +4,6 @@ module Datadog module Selenium module Ext ENV_ENABLED: "DD_CIVISIBILITY_SELENIUM_ENABLED" - - ENV_RUM_FLUSH_WAIT_MILLIS: "DD_CIVISIBILITY_RUM_FLUSH_WAIT_MILLIS" - - COOKIE_TEST_EXECUTION_ID: "datadog-ci-visibility-test-execution-id" - - SCRIPT_IS_RUM_ACTIVE: String - - SCRIPT_STOP_RUM_SESSION: String end end end diff --git a/sig/datadog/ci/contrib/selenium/rum.rbs b/sig/datadog/ci/contrib/selenium/rum.rbs deleted file mode 100644 index a2ef5d18..00000000 --- a/sig/datadog/ci/contrib/selenium/rum.rbs +++ /dev/null @@ -1,13 +0,0 @@ -module Datadog - module CI - module Contrib - module Selenium - module RUM - def self.is_rum_active?: (untyped script_executor) -> bool - - def self.stop_rum_session: (untyped script_executor) -> void - end - end - end - end -end diff --git a/sig/datadog/ci/ext/rum.rbs b/sig/datadog/ci/ext/rum.rbs new file mode 100644 index 00000000..b5a3a492 --- /dev/null +++ b/sig/datadog/ci/ext/rum.rbs @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Datadog + module CI + module Ext + module RUM + ENV_RUM_FLUSH_WAIT_MILLIS: "DD_CIVISIBILITY_RUM_FLUSH_WAIT_MILLIS" + + COOKIE_TEST_EXECUTION_ID: "datadog-ci-visibility-test-execution-id" + + SCRIPT_IS_RUM_ACTIVE: String + SCRIPT_STOP_RUM_SESSION: String + end + end + end +end diff --git a/sig/datadog/ci/utils/rum.rbs b/sig/datadog/ci/utils/rum.rbs new file mode 100644 index 00000000..9239048d --- /dev/null +++ b/sig/datadog/ci/utils/rum.rbs @@ -0,0 +1,11 @@ +module Datadog + module CI + module Utils + module RUM + def self.is_rum_active?: (untyped script_executor) -> bool + + def self.stop_rum_session: (untyped script_executor, ?rum_flush_wait_millis: Integer) -> void + end + end + end +end diff --git a/spec/datadog/ci/contrib/cuprite/features/passing.feature b/spec/datadog/ci/contrib/cuprite/features/passing.feature new file mode 100644 index 00000000..b9b4b7aa --- /dev/null +++ b/spec/datadog/ci/contrib/cuprite/features/passing.feature @@ -0,0 +1,4 @@ +Feature: Datadog integration with browser tests via cuprite + + Scenario: Browser scenario + Given visit page diff --git a/spec/datadog/ci/contrib/cuprite/features/step_definitions/steps.rb b/spec/datadog/ci/contrib/cuprite/features/step_definitions/steps.rb new file mode 100644 index 00000000..6a0549f6 --- /dev/null +++ b/spec/datadog/ci/contrib/cuprite/features/step_definitions/steps.rb @@ -0,0 +1,19 @@ +require "capybara" +require "capybara/cucumber" +require "capybara/cuprite" + +Capybara.register_driver(:cuprite) do |app| + Capybara::Cuprite::Driver.new(app, window_size: [1200, 800]) +end + +Capybara.current_driver = :cuprite +Capybara.default_driver = :cuprite +Capybara.javascript_driver = :cuprite + +Then "visit page" do + visit "http://www.example.com" + + Capybara.reset_session! + + Capybara.current_session.quit +end diff --git a/spec/datadog/ci/contrib/cuprite/instrumentation_spec.rb b/spec/datadog/ci/contrib/cuprite/instrumentation_spec.rb new file mode 100644 index 00000000..1b89867f --- /dev/null +++ b/spec/datadog/ci/contrib/cuprite/instrumentation_spec.rb @@ -0,0 +1,107 @@ +require "cucumber" +require "capybara/cuprite" + +RSpec.describe "Browser tests with cuprite" do + let(:cucumber_features_root) { File.join(__dir__, "features") } + + before do + allow(Datadog::CI::Git::LocalRepository).to receive(:root).and_return(cucumber_features_root) + end + + include_context "CI mode activated" do + let(:integration_name) { :cucumber } + end + + let(:cookies_spy) { spy("cookies") } + let(:browser) do + instance_double( + Capybara::Cuprite::Browser, + :cookies => cookies_spy, + :current_url => "http://www.example.com", + :options => instance_double(Ferrum::Browser::Options, browser_name: "mockbrowser"), + :version => instance_double(Ferrum::Browser::VersionInfo, product: "mockversion"), + :url_blacklist= => nil, + :url_whitelist= => nil, + :reset => nil, + :quit => nil + ) + end + + let(:stdin) { StringIO.new } + # let(:stdout) { StringIO.new } + # let(:stderr) { StringIO.new } + let(:stdout) { $stdout } + let(:stderr) { $stderr } + + let(:kernel) { double(:kernel) } + + # Cucumber runtime setup + let(:existing_runtime) { Cucumber::Runtime.new(runtime_options) } + let(:runtime_options) { {} } + # CLI configuration + let(:features_path) { "spec/datadog/ci/contrib/cuprite/features" } + let(:args) do + [ + "-r", + "spec/datadog/ci/contrib/cuprite/features/step_definitions/steps.rb", + features_path + ] + end + + let(:cli) do + Cucumber::Cli::Main.new(args, stdout, stderr, kernel) + end + let(:expected_test_run_code) { 0 } + + # spies + let(:executed_scripts) { [] } + let(:visited_urls) { [] } + + before do + expect(Capybara::Cuprite::Browser).to receive(:new).and_return(browser) + allow(browser).to receive(:evaluate_func) do |script| + executed_scripts << script + "true" + end + allow(browser).to receive(:visit) do |url| + visited_urls << url + end + + expect(kernel).to receive(:exit).with(expected_test_run_code) + ClimateControl.modify("DD_CIVISIBILITY_SELENIUM_ENABLED" => "1", "DD_CIVISIBILITY_RUM_FLUSH_WAIT_MILLIS" => "1") do + cli.execute!(existing_runtime) + end + end + + it "recognize the test as browser test and adds additional tags" do + expect(visited_urls).to eq(["http://www.example.com"]) + expect(executed_scripts).to eq( + [ + Datadog::CI::Contrib::Cuprite::ScriptExecutor::WRAPPED_SCRIPTS[Datadog::CI::Ext::RUM::SCRIPT_IS_RUM_ACTIVE], + Datadog::CI::Contrib::Cuprite::ScriptExecutor::WRAPPED_SCRIPTS[Datadog::CI::Ext::RUM::SCRIPT_STOP_RUM_SESSION], + Datadog::CI::Contrib::Cuprite::ScriptExecutor::WRAPPED_SCRIPTS[Datadog::CI::Ext::RUM::SCRIPT_IS_RUM_ACTIVE], + Datadog::CI::Contrib::Cuprite::ScriptExecutor::WRAPPED_SCRIPTS[Datadog::CI::Ext::RUM::SCRIPT_STOP_RUM_SESSION] + ] + ) + + expect(test_spans).to have(1).item + + expect(cookies_spy).to have_received(:set).with( + {name: "datadog-ci-visibility-test-execution-id", value: first_test_span.trace_id.to_s, domain: "www.example.com"} + ) + expect(cookies_spy).to have_received(:remove).with( + {name: "datadog-ci-visibility-test-execution-id", domain: "www.example.com"} + ) + + expect(first_test_span).to have_test_tag(:type, "browser") + expect(first_test_span).to have_test_tag(:browser_driver, "cuprite") + expect(first_test_span).to have_test_tag( + :browser_driver_version, + Gem.loaded_specs["cuprite"].version.to_s + ) + expect(first_test_span).to have_test_tag(:browser_name, "mockbrowser") + expect(first_test_span).to have_test_tag(:browser_version, "mockversion") + + expect(first_test_span).to have_test_tag(:is_rum_active, "true") + end +end diff --git a/spec/datadog/ci/contrib/selenium/instrumentation_spec.rb b/spec/datadog/ci/contrib/selenium/instrumentation_spec.rb index eb77668e..4a12b57f 100644 --- a/spec/datadog/ci/contrib/selenium/instrumentation_spec.rb +++ b/spec/datadog/ci/contrib/selenium/instrumentation_spec.rb @@ -58,7 +58,6 @@ let(:visited_urls) { [] } before do - # expect(kernel).to receive(:exit).with(expected_test_run_code) expect(Selenium::WebDriver::Remote::Bridge).to receive(:new).and_return(bridge) allow(bridge).to receive(:execute_script) do |script| executed_scripts << script @@ -78,12 +77,12 @@ expect(visited_urls).to eq(["http://www.example.com", "about:blank"]) expect(executed_scripts).to eq( [ - Datadog::CI::Contrib::Selenium::Ext::SCRIPT_IS_RUM_ACTIVE, - Datadog::CI::Contrib::Selenium::Ext::SCRIPT_STOP_RUM_SESSION, + Datadog::CI::Ext::RUM::SCRIPT_IS_RUM_ACTIVE, + Datadog::CI::Ext::RUM::SCRIPT_STOP_RUM_SESSION, "window.sessionStorage.clear()", "window.localStorage.clear()", - Datadog::CI::Contrib::Selenium::Ext::SCRIPT_IS_RUM_ACTIVE, - Datadog::CI::Contrib::Selenium::Ext::SCRIPT_STOP_RUM_SESSION + Datadog::CI::Ext::RUM::SCRIPT_IS_RUM_ACTIVE, + Datadog::CI::Ext::RUM::SCRIPT_STOP_RUM_SESSION ] ) diff --git a/vendor/rbs/cuprite/0/driver.rbs b/vendor/rbs/cuprite/0/driver.rbs new file mode 100644 index 00000000..8ac0787b --- /dev/null +++ b/vendor/rbs/cuprite/0/driver.rbs @@ -0,0 +1,40 @@ +module Capybara +end + +module Capybara::Cuprite +end + +module Ferrum +end + +class Ferrum::Browser + def version: () -> Ferrum::Browser::VersionInfo + + def options: () -> Ferrum::Browser::Options + + def evaluate_func: (String script) -> String +end + +class Ferrum::Browser::Options + def browser_name: () -> String +end + +class Ferrum::Browser::VersionInfo + def product: () -> String +end + +module Capybara::Cuprite::Driver + def visit: (String url) -> untyped + + def reset!: () -> void + + def quit: () -> void + + def set_cookie: (String name, String value, ?Hash[Symbol, untyped] options) -> void + + def remove_cookie: (String name, ?Hash[Symbol, untyped] options) -> void + + def execute_script: (String script, ?untyped args) -> untyped + + def browser: () -> Ferrum::Browser +end