datadog-ci 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da95176899cf1e2427fadba7e177e85a5906c8c8131026e4b6e7fd3ec7ffae91
4
- data.tar.gz: 1e948e2a734e658b9cbff55c9e1d0a57164d422a921124d17e73879a8da96361
3
+ metadata.gz: ccfa630b807e5675fd68f68e571aeda530a0923e4cd4bdd29451f3065f8c4c7c
4
+ data.tar.gz: 0a777e031ade13b09619a034206a1258285fd3e63c4bd36a5a3e24a3840590e0
5
5
  SHA512:
6
- metadata.gz: 4bbc47cd1af4024c4822f3c3686f728d50a87b729c8316b3e80648e370fc3c274bcd551644aad0a17203927d2ca08957af400447000ee25485a6f17f1cbaec62
7
- data.tar.gz: f8b0fb90d93076341c88a44d4e08f867318996b350c10a498101d5893de32b70811110b78c093a8ba13b88ea6d53ba011013995fd0a11e5ba61b035d84950063
6
+ metadata.gz: c47398d3cc2557b047741b7f8699e6464ee323bf3a32da43442fad8e666ca7cbc3fa973a88a006be3b86d0d3a61b44573755589b909fc21b75feb9b1f374de23
7
+ data.tar.gz: e183e41a31344d2beb1f03790d48f31259d52b043f23a340b1480db065e23909ce3f90204dbc9e98a4ef88a22a3fe16d759bf47fca080701c0a3a750ef7adfc9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.12.0] - 2025-01-23
4
+
5
+ ### Added
6
+
7
+ * Add Datadog RUM integration support for browser tests with cuprite driver ([#283][])
8
+
3
9
  ## [1.11.0] - 2025-01-02
4
10
 
5
11
  ### Changed
@@ -380,7 +386,8 @@ Currently test suite level visibility is not used by our instrumentation: it wil
380
386
 
381
387
  - Ruby versions < 2.7 no longer supported ([#8][])
382
388
 
383
- [Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v1.11.0...main
389
+ [Unreleased]: https://github.com/DataDog/datadog-ci-rb/compare/v1.12.0...main
390
+ [1.12.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.11.0...v1.12.0
384
391
  [1.11.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.10.0...v1.11.0
385
392
  [1.10.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.9.0...v1.10.0
386
393
  [1.9.0]: https://github.com/DataDog/datadog-ci-rb/compare/v1.8.1...v1.9.0
@@ -546,4 +553,5 @@ Currently test suite level visibility is not used by our instrumentation: it wil
546
553
  [#267]: https://github.com/DataDog/datadog-ci-rb/issues/267
547
554
  [#271]: https://github.com/DataDog/datadog-ci-rb/issues/271
548
555
  [#272]: https://github.com/DataDog/datadog-ci-rb/issues/272
549
- [#275]: https://github.com/DataDog/datadog-ci-rb/issues/275
556
+ [#275]: https://github.com/DataDog/datadog-ci-rb/issues/275
557
+ [#283]: https://github.com/DataDog/datadog-ci-rb/issues/283
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "datadog/core"
4
+
5
+ require_relative "../ext"
6
+ require_relative "../../settings"
7
+
8
+ require_relative "../../../ext/rum"
9
+
10
+ module Datadog
11
+ module CI
12
+ module Contrib
13
+ module Cuprite
14
+ module Configuration
15
+ # Custom settings for the Cuprite integration
16
+ # @public_api
17
+ class Settings < Datadog::CI::Contrib::Settings
18
+ option :enabled do |o|
19
+ o.type :bool
20
+ o.env Ext::ENV_ENABLED
21
+ o.default true
22
+ end
23
+
24
+ option :rum_flush_wait_millis do |o|
25
+ o.type :int
26
+ o.env CI::Ext::RUM::ENV_RUM_FLUSH_WAIT_MILLIS
27
+ o.default 500
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "script_executor"
4
+ require_relative "../patcher"
5
+
6
+ require_relative "../../ext/rum"
7
+ require_relative "../../ext/test"
8
+ require_relative "../../utils/rum"
9
+
10
+ module Datadog
11
+ module CI
12
+ module Contrib
13
+ module Cuprite
14
+ # instruments Capybara::Cuprite::Driver
15
+ module Driver
16
+ def self.included(base)
17
+ base.prepend(InstanceMethods)
18
+ end
19
+
20
+ module InstanceMethods
21
+ def visit(url)
22
+ result = super
23
+
24
+ return result unless datadog_configuration[:enabled]
25
+
26
+ Datadog.logger.debug("[Cuprite] Navigation to #{url}")
27
+
28
+ # on session reset Capybara navigates to about:blank
29
+ return result if url == "about:blank"
30
+
31
+ active_test = Datadog::CI.active_test
32
+ Datadog.logger.debug("[Cuprite] Active test: #{active_test}")
33
+
34
+ return result unless active_test
35
+
36
+ # Set the test's trace id as a cookie in browser session
37
+ Datadog.logger.debug do
38
+ "[Cuprite] Setting cookie #{CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID} to #{active_test.trace_id}"
39
+ end
40
+ set_cookie(CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID, active_test.trace_id.to_s)
41
+
42
+ # set the test type to browser
43
+ active_test.set_tag(CI::Ext::Test::TAG_TYPE, CI::Ext::Test::Type::BROWSER)
44
+
45
+ # set the tags specific to the browser test
46
+ active_test.set_tag(CI::Ext::Test::TAG_BROWSER_DRIVER, "cuprite")
47
+ active_test.set_tag(CI::Ext::Test::TAG_BROWSER_DRIVER_VERSION, datadog_integration.version)
48
+ active_test.set_tag(CI::Ext::Test::TAG_BROWSER_NAME, browser.options.browser_name || "chrome")
49
+ active_test.set_tag(CI::Ext::Test::TAG_BROWSER_VERSION, browser.version.product)
50
+
51
+ result
52
+ end
53
+
54
+ def reset!
55
+ Datadog.logger.debug("[Cuprite] Driver reset! event")
56
+
57
+ datadog_end_rum_session
58
+
59
+ super
60
+ end
61
+
62
+ def quit
63
+ Datadog.logger.debug("[Cuprite] Driver quit event")
64
+
65
+ datadog_end_rum_session
66
+
67
+ super
68
+ end
69
+
70
+ private
71
+
72
+ def datadog_integration
73
+ CI::Contrib::Instrumentation.fetch_integration(:cuprite)
74
+ end
75
+
76
+ def datadog_configuration
77
+ Datadog.configuration.ci[:cuprite]
78
+ end
79
+
80
+ def datadog_end_rum_session
81
+ return unless datadog_configuration[:enabled]
82
+
83
+ executor = ScriptExecutor.new(browser)
84
+ Utils::RUM.stop_rum_session(executor, rum_flush_wait_millis: datadog_configuration[:rum_flush_wait_millis])
85
+
86
+ Datadog.logger.debug("[Cuprite] Deleting Datadog cookie")
87
+ remove_cookie(CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID)
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Datadog
4
+ module CI
5
+ module Contrib
6
+ module Cuprite
7
+ # Cuprite integration constants
8
+ # @public_api
9
+ module Ext
10
+ ENV_ENABLED = "DD_CIVISIBILITY_CUPRITE_ENABLED"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../integration"
4
+ require_relative "configuration/settings"
5
+ require_relative "patcher"
6
+
7
+ module Datadog
8
+ module CI
9
+ module Contrib
10
+ module Cuprite
11
+ # Description of Cuprite integration
12
+ class Integration < Contrib::Integration
13
+ MINIMUM_VERSION = Gem::Version.new("0.15.0")
14
+
15
+ def version
16
+ Gem.loaded_specs["cuprite"]&.version
17
+ end
18
+
19
+ def loaded?
20
+ !defined?(::Capybara).nil? && !defined?(::Capybara::Cuprite).nil? &&
21
+ !defined?(::Capybara::Cuprite::Driver).nil?
22
+ end
23
+
24
+ def compatible?
25
+ super && version >= MINIMUM_VERSION
26
+ end
27
+
28
+ # additional instrumentations for test libraries are late instrumented on test session start
29
+ def late_instrument?
30
+ true
31
+ end
32
+
33
+ def new_configuration
34
+ Configuration::Settings.new
35
+ end
36
+
37
+ def patcher
38
+ Patcher
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../patcher"
4
+
5
+ require_relative "driver"
6
+
7
+ module Datadog
8
+ module CI
9
+ module Contrib
10
+ module Cuprite
11
+ # Patcher enables patching of 'Capybara::Cuprite::Driver' class.
12
+ module Patcher
13
+ include Datadog::CI::Contrib::Patcher
14
+
15
+ module_function
16
+
17
+ def patch
18
+ ::Capybara::Cuprite::Driver.include(Driver)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../ext/rum"
4
+
5
+ module Datadog
6
+ module CI
7
+ module Contrib
8
+ module Cuprite
9
+ class ScriptExecutor
10
+ # Ferrum::Browser requires a JS script to be wrapped in a function() { ... } block
11
+ WRAPPED_SCRIPTS = {
12
+ CI::Ext::RUM::SCRIPT_IS_RUM_ACTIVE => "function() { #{CI::Ext::RUM::SCRIPT_IS_RUM_ACTIVE}; }",
13
+ CI::Ext::RUM::SCRIPT_STOP_RUM_SESSION => <<~JS
14
+ function() {
15
+ #{CI::Ext::RUM::SCRIPT_STOP_RUM_SESSION}
16
+ }
17
+ JS
18
+ }.freeze
19
+
20
+ def initialize(ferrum_browser)
21
+ @ferrum_browser = ferrum_browser
22
+ end
23
+
24
+ def execute_script(script)
25
+ script = WRAPPED_SCRIPTS.fetch(script, script)
26
+ @ferrum_browser.evaluate_func(script)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -2,9 +2,9 @@
2
2
 
3
3
  require_relative "../patcher"
4
4
 
5
- require_relative "ext"
6
- require_relative "rum"
5
+ require_relative "../../ext/rum"
7
6
  require_relative "../../ext/test"
7
+ require_relative "../../utils/rum"
8
8
 
9
9
  module Datadog
10
10
  module CI
@@ -22,10 +22,10 @@ module Datadog
22
22
 
23
23
  Datadog.logger.debug("[Selenium] Capybara session reset event")
24
24
 
25
- RUM.stop_rum_session(@browser)
25
+ Utils::RUM.stop_rum_session(@browser, rum_flush_wait_millis: datadog_configuration[:rum_flush_wait_millis])
26
26
 
27
27
  Datadog.logger.debug("[Selenium] RUM session stopped, deleting cookie")
28
- @browser.manage.delete_cookie(Ext::COOKIE_TEST_EXECUTION_ID)
28
+ @browser.manage.delete_cookie(CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID)
29
29
  rescue ::Selenium::WebDriver::Error::WebDriverError => e
30
30
  Datadog.logger.debug("[Selenium] Error while resetting Capybara session: #{e.message}")
31
31
  ensure
@@ -5,6 +5,8 @@ require "datadog/core"
5
5
  require_relative "../ext"
6
6
  require_relative "../../settings"
7
7
 
8
+ require_relative "../../../ext/rum"
9
+
8
10
  module Datadog
9
11
  module CI
10
12
  module Contrib
@@ -21,7 +23,7 @@ module Datadog
21
23
 
22
24
  option :rum_flush_wait_millis do |o|
23
25
  o.type :int
24
- o.env Ext::ENV_RUM_FLUSH_WAIT_MILLIS
26
+ o.env CI::Ext::RUM::ENV_RUM_FLUSH_WAIT_MILLIS
25
27
  o.default 500
26
28
  end
27
29
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  require_relative "../patcher"
4
4
 
5
- require_relative "ext"
6
- require_relative "rum"
5
+ require_relative "../../utils/rum"
6
+ require_relative "../../ext/rum"
7
7
  require_relative "../../ext/test"
8
8
 
9
9
  module Datadog
@@ -22,10 +22,10 @@ module Datadog
22
22
 
23
23
  Datadog.logger.debug("[Selenium] Driver quit event")
24
24
 
25
- RUM.stop_rum_session(@bridge)
25
+ Utils::RUM.stop_rum_session(@bridge, rum_flush_wait_millis: datadog_configuration[:rum_flush_wait_millis])
26
26
 
27
27
  Datadog.logger.debug("[Selenium] RUM session stopped, deleting cookie")
28
- @bridge.manage.delete_cookie(Ext::COOKIE_TEST_EXECUTION_ID)
28
+ @bridge.manage.delete_cookie(CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID)
29
29
  rescue ::Selenium::WebDriver::Error::WebDriverError => e
30
30
  Datadog.logger.debug("[Selenium] Error while quitting Selenium driver: #{e.message}")
31
31
  ensure
@@ -8,21 +8,6 @@ module Datadog
8
8
  # @public_api
9
9
  module Ext
10
10
  ENV_ENABLED = "DD_CIVISIBILITY_SELENIUM_ENABLED"
11
- ENV_RUM_FLUSH_WAIT_MILLIS = "DD_CIVISIBILITY_RUM_FLUSH_WAIT_MILLIS"
12
-
13
- COOKIE_TEST_EXECUTION_ID = "datadog-ci-visibility-test-execution-id"
14
-
15
- SCRIPT_IS_RUM_ACTIVE = <<~JS
16
- return !!window.DD_RUM
17
- JS
18
- SCRIPT_STOP_RUM_SESSION = <<~JS
19
- if (window.DD_RUM && window.DD_RUM.stopSession) {
20
- window.DD_RUM.stopSession();
21
- return true;
22
- } else {
23
- return false;
24
- }
25
- JS
26
11
  end
27
12
  end
28
13
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "../patcher"
4
4
 
5
- require_relative "ext"
5
+ require_relative "../../ext/rum"
6
6
  require_relative "../../ext/test"
7
7
 
8
8
  module Datadog
@@ -32,7 +32,7 @@ module Datadog
32
32
  return result unless active_test
33
33
 
34
34
  # Set the test's trace id as a cookie in browser session
35
- cookie_hash = {name: Ext::COOKIE_TEST_EXECUTION_ID, value: active_test.trace_id.to_s}
35
+ cookie_hash = {name: CI::Ext::RUM::COOKIE_TEST_EXECUTION_ID, value: active_test.trace_id.to_s}
36
36
  Datadog.logger.debug { "[Selenium] Setting cookie: #{cookie_hash}" }
37
37
  @bridge.manage.add_cookie(cookie_hash)
38
38
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "json"
4
4
 
5
+ require "datadog/core/telemetry/logging"
5
6
  require "datadog/core/utils/url"
6
7
 
7
8
  require_relative "base"
@@ -96,6 +97,8 @@ module Datadog
96
97
  result
97
98
  rescue => e
98
99
  Datadog.logger.error("Failed to extract additional tags from GitHub Actions: #{e}")
100
+ Core::Telemetry::Logger.report(e, description: "Failed to extract additional tags from GitHub Actions")
101
+
99
102
  {}
100
103
  end
101
104
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "datadog/core/telemetry/logging"
4
+
3
5
  require_relative "git"
4
6
  require_relative "environment/extractor"
5
7
 
@@ -73,6 +75,7 @@ module Datadog
73
75
  return if !repo_url.nil? && !repo_url.empty?
74
76
 
75
77
  Datadog.logger.error("DD_GIT_REPOSITORY_URL is not set or empty; no repo URL was automatically extracted")
78
+ Core::Telemetry::Logger.error("DD_GIT_REPOSITORY_URL is not set or empty; no repo URL was automatically extracted")
76
79
  end
77
80
 
78
81
  def validate_git_sha(git_sha)
@@ -89,6 +92,7 @@ module Datadog
89
92
  end
90
93
 
91
94
  Datadog.logger.error(message)
95
+ Core::Telemetry::Logger.error(message)
92
96
  end
93
97
  end
94
98
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Datadog
4
+ module CI
5
+ module Ext
6
+ # Defines constants for Git tags
7
+ module RUM
8
+ ENV_RUM_FLUSH_WAIT_MILLIS = "DD_CIVISIBILITY_RUM_FLUSH_WAIT_MILLIS"
9
+
10
+ COOKIE_TEST_EXECUTION_ID = "datadog-ci-visibility-test-execution-id"
11
+
12
+ SCRIPT_IS_RUM_ACTIVE = <<~JS
13
+ return !!window.DD_RUM
14
+ JS
15
+ SCRIPT_STOP_RUM_SESSION = <<~JS
16
+ if (window.DD_RUM && window.DD_RUM.stopSession) {
17
+ window.DD_RUM.stopSession();
18
+ return true;
19
+ } else {
20
+ return false;
21
+ }
22
+ JS
23
+ end
24
+ end
25
+ end
26
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "pp"
4
4
 
5
+ require "datadog/core/telemetry/logging"
5
6
  require "datadog/core/utils/forking"
6
7
 
7
8
  require_relative "../ext/test"
@@ -224,6 +225,7 @@ module Datadog
224
225
  Datadog.logger.debug("Loaded Datadog code coverage collector, using coverage mode: #{code_coverage_mode}")
225
226
  rescue LoadError => e
226
227
  Datadog.logger.error("Failed to load coverage collector: #{e}. Code coverage will not be collected.")
228
+ Core::Telemetry::Logger.report(e, description: "Failed to load coverage collector")
227
229
 
228
230
  @code_coverage_enabled = false
229
231
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "datadog/core/environment/identity"
4
+ require "datadog/core/telemetry/logging"
5
+ require "datadog/core/utils/only_once"
4
6
 
5
7
  require_relative "serializers/factories/test_level"
6
8
  require_relative "../ext/app_types"
@@ -15,6 +17,10 @@ module Datadog
15
17
  class Transport < Datadog::CI::Transport::EventPlatformTransport
16
18
  attr_reader :serializers_factory, :dd_env
17
19
 
20
+ def self.log_once
21
+ @log_once ||= Datadog::Core::Utils::OnlyOnce.new
22
+ end
23
+
18
24
  def initialize(
19
25
  api:,
20
26
  dd_env:,
@@ -64,8 +70,15 @@ module Datadog
64
70
 
65
71
  encoded
66
72
  else
67
- Datadog.logger.warn("Invalid event skipped: #{serializer} Errors: #{serializer.validation_errors}")
73
+ message = "Invalid event skipped: #{serializer} Errors: #{serializer.validation_errors}"
74
+ Datadog.logger.warn(message)
68
75
  CI::Transport::Telemetry.endpoint_payload_dropped(1, endpoint: telemetry_endpoint_tag)
76
+
77
+ # log invalid message once as error to internal telemetry
78
+ self.class.log_once.run do
79
+ Core::Telemetry::Logger.error(message)
80
+ end
81
+
69
82
  nil
70
83
  end
71
84
  end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../ext/rum"
4
+ require_relative "../ext/test"
5
+ require_relative "parsing"
6
+
7
+ module Datadog
8
+ module CI
9
+ module Utils
10
+ # Provides functionality to interact with Datadog Real User Monitoring product
11
+ # via executing JavaScript code in the browser.
12
+ #
13
+ # Relevant docs: https://docs.datadoghq.com/real_user_monitoring/browser/
14
+ module RUM
15
+ def self.is_rum_active?(script_executor)
16
+ is_rum_active_script_result = script_executor.execute_script(Ext::RUM::SCRIPT_IS_RUM_ACTIVE)
17
+
18
+ Datadog.logger.debug { "[RUM] SCRIPT_IS_RUM_ACTIVE result is #{is_rum_active_script_result.inspect}" }
19
+
20
+ Utils::Parsing.convert_to_bool(is_rum_active_script_result)
21
+ end
22
+
23
+ def self.stop_rum_session(script_executor, rum_flush_wait_millis: 500)
24
+ return unless is_rum_active?(script_executor)
25
+
26
+ Datadog::CI.active_test&.set_tag(
27
+ CI::Ext::Test::TAG_IS_RUM_ACTIVE,
28
+ "true"
29
+ )
30
+
31
+ result = script_executor.execute_script(Ext::RUM::SCRIPT_STOP_RUM_SESSION)
32
+ Datadog.logger.debug { "[RUM] SCRIPT_STOP_RUM_SESSION result is #{result.inspect}" }
33
+
34
+ # introduce a delay to allow the RUM session to be stopped
35
+ delay = rum_flush_wait_millis / 1000.0
36
+ Datadog.logger.debug { "[RUM] Waiting for #{delay} seconds" }
37
+ sleep(delay)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -4,7 +4,7 @@ module Datadog
4
4
  module CI
5
5
  module VERSION
6
6
  MAJOR = 1
7
- MINOR = 11
7
+ MINOR = 12
8
8
  PATCH = 0
9
9
  PRE = nil
10
10
  BUILD = nil
data/lib/datadog/ci.rb CHANGED
@@ -418,6 +418,7 @@ require_relative "ci/contrib/ciqueue/integration"
418
418
 
419
419
  # Additional test libraries (auto instrumented later on test session start)
420
420
  require_relative "ci/contrib/selenium/integration"
421
+ require_relative "ci/contrib/cuprite/integration"
421
422
  require_relative "ci/contrib/simplecov/integration"
422
423
 
423
424
  # Configuration extensions
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog-ci
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-01-02 00:00:00.000000000 Z
10
+ date: 2025-01-23 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: datadog
@@ -83,6 +82,12 @@ files:
83
82
  - lib/datadog/ci/contrib/cucumber/instrumentation.rb
84
83
  - lib/datadog/ci/contrib/cucumber/integration.rb
85
84
  - lib/datadog/ci/contrib/cucumber/patcher.rb
85
+ - lib/datadog/ci/contrib/cuprite/configuration/settings.rb
86
+ - lib/datadog/ci/contrib/cuprite/driver.rb
87
+ - lib/datadog/ci/contrib/cuprite/ext.rb
88
+ - lib/datadog/ci/contrib/cuprite/integration.rb
89
+ - lib/datadog/ci/contrib/cuprite/patcher.rb
90
+ - lib/datadog/ci/contrib/cuprite/script_executor.rb
86
91
  - lib/datadog/ci/contrib/instrumentation.rb
87
92
  - lib/datadog/ci/contrib/integration.rb
88
93
  - lib/datadog/ci/contrib/knapsack/extension.rb
@@ -113,7 +118,6 @@ files:
113
118
  - lib/datadog/ci/contrib/selenium/integration.rb
114
119
  - lib/datadog/ci/contrib/selenium/navigation.rb
115
120
  - lib/datadog/ci/contrib/selenium/patcher.rb
116
- - lib/datadog/ci/contrib/selenium/rum.rb
117
121
  - lib/datadog/ci/contrib/settings.rb
118
122
  - lib/datadog/ci/contrib/simplecov/configuration/settings.rb
119
123
  - lib/datadog/ci/contrib/simplecov/ext.rb
@@ -142,6 +146,7 @@ files:
142
146
  - lib/datadog/ci/ext/environment/providers/travis.rb
143
147
  - lib/datadog/ci/ext/environment/providers/user_defined_tags.rb
144
148
  - lib/datadog/ci/ext/git.rb
149
+ - lib/datadog/ci/ext/rum.rb
145
150
  - lib/datadog/ci/ext/settings.rb
146
151
  - lib/datadog/ci/ext/telemetry.rb
147
152
  - lib/datadog/ci/ext/test.rb
@@ -217,6 +222,7 @@ files:
217
222
  - lib/datadog/ci/utils/configuration.rb
218
223
  - lib/datadog/ci/utils/git.rb
219
224
  - lib/datadog/ci/utils/parsing.rb
225
+ - lib/datadog/ci/utils/rum.rb
220
226
  - lib/datadog/ci/utils/telemetry.rb
221
227
  - lib/datadog/ci/utils/test_run.rb
222
228
  - lib/datadog/ci/version.rb
@@ -229,7 +235,6 @@ metadata:
229
235
  changelog_uri: https://github.com/DataDog/datadog-ci-rb/blob/main/CHANGELOG.md
230
236
  homepage_uri: https://github.com/DataDog/datadog-ci-rb
231
237
  source_code_uri: https://github.com/DataDog/datadog-ci-rb
232
- post_install_message:
233
238
  rdoc_options: []
234
239
  require_paths:
235
240
  - lib
@@ -247,8 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
252
  - !ruby/object:Gem::Version
248
253
  version: 2.0.0
249
254
  requirements: []
250
- rubygems_version: 3.5.22
251
- signing_key:
255
+ rubygems_version: 3.6.2
252
256
  specification_version: 4
253
257
  summary: Datadog CI visibility for your ruby application
254
258
  test_files: []
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "ext"
4
- require_relative "../../ext/test"
5
- require_relative "../../utils/parsing"
6
-
7
- module Datadog
8
- module CI
9
- module Contrib
10
- module Selenium
11
- # Provides functionality to interact with Datadog Real User Monitoring product
12
- # via executing JavaScript code in the browser.
13
- #
14
- # Relevant docs: https://docs.datadoghq.com/real_user_monitoring/browser/
15
- module RUM
16
- def self.is_rum_active?(script_executor)
17
- is_rum_active_script_result = script_executor.execute_script(Ext::SCRIPT_IS_RUM_ACTIVE)
18
- Datadog.logger.debug { "[Selenium] SCRIPT_IS_RUM_ACTIVE result is #{is_rum_active_script_result.inspect}" }
19
- Utils::Parsing.convert_to_bool(is_rum_active_script_result)
20
- end
21
-
22
- def self.stop_rum_session(script_executor)
23
- config = Datadog.configuration.ci[:selenium]
24
- if is_rum_active?(script_executor)
25
- Datadog::CI.active_test&.set_tag(
26
- CI::Ext::Test::TAG_IS_RUM_ACTIVE,
27
- "true"
28
- )
29
-
30
- result = script_executor.execute_script(Ext::SCRIPT_STOP_RUM_SESSION)
31
- Datadog.logger.debug { "[Selenium] SCRIPT_STOP_RUM_SESSION result is #{result.inspect}" }
32
-
33
- # introduce a delay to allow the RUM session to be stopped
34
- delay = config[:rum_flush_wait_millis] / 1000.0
35
- Datadog.logger.debug { "[Selenium] Waiting for #{delay} seconds" }
36
- sleep(delay)
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end