Sha256: 3ef8312b6afae340d4f5418252548166225450974e5beccb7388dee78c1d7dc4

Contents?: true

Size: 1.16 KB

Versions: 13

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require "datadog/tracing/contrib/patcher"

require_relative "ext"
require_relative "rum"
require_relative "../../ext/test"

module Datadog
  module CI
    module Contrib
      module Selenium
        # instruments Selenium::WebDriver::Driver
        module Driver
          def self.included(base)
            base.prepend(InstanceMethods)
          end

          module InstanceMethods
            def quit
              return super unless datadog_configuration[:enabled]

              Datadog.logger.debug("[Selenium] Driver quit event")

              RUM.stop_rum_session(@bridge)

              Datadog.logger.debug("[Selenium] RUM session stopped, deleting cookie")
              @bridge.manage.delete_cookie(Ext::COOKIE_TEST_EXECUTION_ID)
            rescue ::Selenium::WebDriver::Error::WebDriverError => e
              Datadog.logger.debug("[Selenium] Error while quitting Selenium driver: #{e.message}")
            ensure
              super
            end

            private

            def datadog_configuration
              Datadog.configuration.ci[:selenium]
            end
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
datadog-ci-1.8.1 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.8.0 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.7.0 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.6.0 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.5.0 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.4.1 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.4.0 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.3.0 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.2.0 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.1.0 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.0.1 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.0.0 lib/datadog/ci/contrib/selenium/driver.rb
datadog-ci-1.0.0.beta6 lib/datadog/ci/contrib/selenium/driver.rb