19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/datadog/ci/contrib/selenium/navigation.rb', line 19
def to(url)
result = super
return result unless datadog_configuration[:enabled]
Datadog.logger.debug("[Selenium] Navigation to #{url}")
return result if url == "about:blank"
active_test = Datadog::CI.active_test
Datadog.logger.debug("[Selenium] Active test: #{active_test}")
return result unless active_test
cookie_hash = {name: Ext::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)
active_test.set_tag(CI::Ext::Test::TAG_TYPE, CI::Ext::Test::Type::BROWSER)
active_test.set_tag(CI::Ext::Test::TAG_BROWSER_DRIVER, "selenium")
active_test.set_tag(
CI::Ext::Test::TAG_BROWSER_DRIVER_VERSION,
datadog_integration.version
)
active_test.set_tag(
CI::Ext::Test::TAG_BROWSER_NAME,
@bridge.browser
)
active_test.set_tag(
CI::Ext::Test::TAG_BROWSER_VERSION,
@bridge.capabilities.browser_version
)
result
rescue ::Selenium::WebDriver::Error::WebDriverError => e
Datadog.logger.debug("[Selenium] Error while navigating: #{e.message}")
result
end
|