From e11ab24383b58770830a21690da10a1d60126a01 Mon Sep 17 00:00:00 2001 From: Diego Molina Date: Fri, 17 Feb 2023 05:55:46 +0100 Subject: [PATCH] [dotnet] Updating tests to work with v110 --- .../common/DevTools/DevToolsConsoleTest.cs | 4 +- .../test/common/DevTools/DevToolsLogTest.cs | 6 +- .../common/DevTools/DevToolsNetworkTest.cs | 144 +++++++++--------- .../DevTools/DevToolsPerformanceTest.cs | 30 ++-- .../common/DevTools/DevToolsProfilerTest.cs | 18 +-- .../common/DevTools/DevToolsSecurityTest.cs | 10 +- .../common/DevTools/DevToolsTargetTest.cs | 52 +++---- 7 files changed, 132 insertions(+), 132 deletions(-) diff --git a/dotnet/test/common/DevTools/DevToolsConsoleTest.cs b/dotnet/test/common/DevTools/DevToolsConsoleTest.cs index d2b49458e72de..29a990be3f454 100644 --- a/dotnet/test/common/DevTools/DevToolsConsoleTest.cs +++ b/dotnet/test/common/DevTools/DevToolsConsoleTest.cs @@ -18,11 +18,11 @@ public class DevToolsConsoleTest : DevToolsTestFixture [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifyMessageAdded() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); string consoleMessage = "Hello Selenium"; ManualResetEventSlim sync = new ManualResetEventSlim(false); - EventHandler messageAddedHandler = (sender, e) => + EventHandler messageAddedHandler = (sender, e) => { Assert.That(e.Message.Text, Is.EqualTo(consoleMessage)); sync.Set(); diff --git a/dotnet/test/common/DevTools/DevToolsLogTest.cs b/dotnet/test/common/DevTools/DevToolsLogTest.cs index ac883a815c66c..a2821583c3e15 100644 --- a/dotnet/test/common/DevTools/DevToolsLogTest.cs +++ b/dotnet/test/common/DevTools/DevToolsLogTest.cs @@ -19,12 +19,12 @@ public class DevToolsLogTest : DevToolsTestFixture [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifyEntryAddedAndClearLog() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); ManualResetEventSlim sync = new ManualResetEventSlim(false); - EventHandler entryAddedHandler = (sender, e) => + EventHandler entryAddedHandler = (sender, e) => { Assert.That(e.Entry.Text.Contains("404")); - Assert.That(e.Entry.Level == V109.Log.LogEntryLevelValues.Error); + Assert.That(e.Entry.Level == V110.Log.LogEntryLevelValues.Error); sync.Set(); }; diff --git a/dotnet/test/common/DevTools/DevToolsNetworkTest.cs b/dotnet/test/common/DevTools/DevToolsNetworkTest.cs index 45cf07b02d633..29c12ae7d473e 100644 --- a/dotnet/test/common/DevTools/DevToolsNetworkTest.cs +++ b/dotnet/test/common/DevTools/DevToolsNetworkTest.cs @@ -20,8 +20,8 @@ public class DevToolsNetworkTest : DevToolsTestFixture [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public void GetSetDeleteAndClearAllCookies() { - //var domains = session.GetVersionSpecificDomains(); - //await domains.Network.Enable(new V109.Network.EnableCommandSettings()); + //var domains = session.GetVersionSpecificDomains(); + //await domains.Network.Enable(new V110.Network.EnableCommandSettings()); //var allCookieResponse = await domains.Network.GetAllCookies(); //ReadOnlyCollection seleniumCookies = allCookieResponse.Cookies.ToSeleniumCookies(); @@ -36,11 +36,11 @@ public void GetSetDeleteAndClearAllCookies() //seleniumCookies = allCookieResponse.Cookies.ToSeleniumCookies(); //Assert.That(seleniumCookies.Count == 1); - //var cookieResponse = await domains.Network.GetCookies(new V109.Network.GetCookiesCommandSettings()); + //var cookieResponse = await domains.Network.GetCookies(new V110.Network.GetCookiesCommandSettings()); //seleniumCookies = cookieResponse.Cookies.ToSeleniumCookies(); //Assert.That(seleniumCookies.Count == 0); - //await domains.Network.DeleteCookies(new V109.Network.DeleteCookiesCommandSettings() + //await domains.Network.DeleteCookies(new V110.Network.DeleteCookiesCommandSettings() //{ // Name = "name", // Domain = EnvironmentManager.Instance.UrlBuilder.HostName, @@ -67,26 +67,26 @@ public void GetSetDeleteAndClearAllCookies() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task SendRequestWithUrlFiltersAndExtraHeadersAndVerifyRequests() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings()); - await domains.Network.SetBlockedURLs(new V109.Network.SetBlockedURLsCommandSettings() + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings()); + await domains.Network.SetBlockedURLs(new V110.Network.SetBlockedURLsCommandSettings() { Urls = new string[] { "*://*/*.css" } }); - var additionalHeaders = new V109.Network.Headers(); + var additionalHeaders = new V110.Network.Headers(); additionalHeaders.Add("headerName", "headerValue"); - await domains.Network.SetExtraHTTPHeaders(new V109.Network.SetExtraHTTPHeadersCommandSettings() + await domains.Network.SetExtraHTTPHeaders(new V110.Network.SetExtraHTTPHeadersCommandSettings() { Headers = additionalHeaders }); ManualResetEventSlim loadingFailedSync = new ManualResetEventSlim(false); - EventHandler loadingFailedHandler = (sender, e) => + EventHandler loadingFailedHandler = (sender, e) => { - if (e.Type == V109.Network.ResourceType.Stylesheet) + if (e.Type == V110.Network.ResourceType.Stylesheet) { - Assert.That(e.BlockedReason == V109.Network.BlockedReason.Inspector); + Assert.That(e.BlockedReason == V110.Network.BlockedReason.Inspector); } loadingFailedSync.Set(); @@ -94,7 +94,7 @@ await domains.Network.SetExtraHTTPHeaders(new V109.Network.SetExtraHTTPHeadersCo domains.Network.LoadingFailed += loadingFailedHandler; ManualResetEventSlim requestSentSync = new ManualResetEventSlim(false); - EventHandler requestWillBeSentHandler = (sender, e) => + EventHandler requestWillBeSentHandler = (sender, e) => { Assert.That(e.Request.Headers.ContainsKey("headerName")); Assert.That(e.Request.Headers["headerName"] == "headerValue"); @@ -103,7 +103,7 @@ await domains.Network.SetExtraHTTPHeaders(new V109.Network.SetExtraHTTPHeadersCo domains.Network.RequestWillBeSent += requestWillBeSentHandler; ManualResetEventSlim dataSync = new ManualResetEventSlim(false); - EventHandler dataReceivedHandler = (sender, e) => + EventHandler dataReceivedHandler = (sender, e) => { Assert.That(e.RequestId, Is.Not.Null); dataSync.Set(); @@ -122,23 +122,23 @@ await domains.Network.SetExtraHTTPHeaders(new V109.Network.SetExtraHTTPHeadersCo [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task EmulateNetworkConditionOffline() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings() + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings() { MaxTotalBufferSize = 100000000 }); - await domains.Network.EmulateNetworkConditions(new V109.Network.EmulateNetworkConditionsCommandSettings() + await domains.Network.EmulateNetworkConditions(new V110.Network.EmulateNetworkConditionsCommandSettings() { Offline = true, Latency = 100, DownloadThroughput = 1000, UploadThroughput = 2000, - ConnectionType = V109.Network.ConnectionType.Cellular3g + ConnectionType = V110.Network.ConnectionType.Cellular3g }); ManualResetEventSlim loadingFailedSync = new ManualResetEventSlim(false); - EventHandler loadingFailedHandler = (sender, e) => + EventHandler loadingFailedHandler = (sender, e) => { Assert.That(e.ErrorText, Is.EqualTo("net::ERR_INTERNET_DISCONNECTED")); loadingFailedSync.Set(); @@ -164,16 +164,16 @@ await domains.Network.EmulateNetworkConditions(new V109.Network.EmulateNetworkCo [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifyRequestReceivedFromCacheAndResponseBody() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); string[] requestIdFromCache = new string[1]; - await domains.Network.Enable(new V109.Network.EnableCommandSettings() + await domains.Network.Enable(new V110.Network.EnableCommandSettings() { MaxResourceBufferSize = 100000000 }); ManualResetEventSlim servedFromCacheSync = new ManualResetEventSlim(false); - EventHandler requestServedFromCacheHandler = (sender, e) => + EventHandler requestServedFromCacheHandler = (sender, e) => { Assert.That(e.RequestId, Is.Not.Null); requestIdFromCache[0] = e.RequestId; @@ -182,7 +182,7 @@ await domains.Network.Enable(new V109.Network.EnableCommandSettings() domains.Network.RequestServedFromCache += requestServedFromCacheHandler; ManualResetEventSlim loadingFinishedSync = new ManualResetEventSlim(false); - EventHandler loadingFinishedHandler = (sender, e) => + EventHandler loadingFinishedHandler = (sender, e) => { Assert.That(e.RequestId, Is.Not.Null); loadingFinishedSync.Set(); @@ -194,7 +194,7 @@ await domains.Network.Enable(new V109.Network.EnableCommandSettings() loadingFinishedSync.Wait(TimeSpan.FromSeconds(5)); servedFromCacheSync.Wait(TimeSpan.FromSeconds(5)); - var responseBody = await domains.Network.GetResponseBody(new V109.Network.GetResponseBodyCommandSettings() + var responseBody = await domains.Network.GetResponseBody(new V110.Network.GetResponseBodyCommandSettings() { RequestId = requestIdFromCache[0] }); @@ -209,16 +209,16 @@ await domains.Network.Enable(new V109.Network.EnableCommandSettings() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifySearchInResponseBody() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); string[] requestIds = new string[1]; - await domains.Network.Enable(new V109.Network.EnableCommandSettings() + await domains.Network.Enable(new V110.Network.EnableCommandSettings() { MaxResourceBufferSize = 100000000 }); ManualResetEventSlim responseSync = new ManualResetEventSlim(false); - EventHandler responseReceivedHandler = (sender, e) => + EventHandler responseReceivedHandler = (sender, e) => { Assert.That(e, Is.Not.Null); requestIds[0] = e.RequestId; @@ -229,7 +229,7 @@ await domains.Network.Enable(new V109.Network.EnableCommandSettings() driver.Url = simpleTestPage; responseSync.Wait(TimeSpan.FromSeconds(5)); - var searchResponse = await domains.Network.SearchInResponseBody(new V109.Network.SearchInResponseBodyCommandSettings() + var searchResponse = await domains.Network.SearchInResponseBody(new V110.Network.SearchInResponseBodyCommandSettings() { RequestId = requestIds[0], Query = "/", @@ -244,14 +244,14 @@ await domains.Network.Enable(new V109.Network.EnableCommandSettings() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifyCacheDisabledAndClearCache() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings() + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings() { MaxPostDataSize = 100000000 }); ManualResetEventSlim responseSync = new ManualResetEventSlim(false); - EventHandler responseReceivedHandler = (sender, e) => + EventHandler responseReceivedHandler = (sender, e) => { Assert.That(e.Response.FromDiskCache, Is.False); responseSync.Set(); @@ -261,7 +261,7 @@ await domains.Network.Enable(new V109.Network.EnableCommandSettings() driver.Url = simpleTestPage; responseSync.Wait(TimeSpan.FromSeconds(5)); - await domains.Network.SetCacheDisabled(new V109.Network.SetCacheDisabledCommandSettings() + await domains.Network.SetCacheDisabled(new V110.Network.SetCacheDisabledCommandSettings() { CacheDisabled = true }); @@ -277,16 +277,16 @@ await domains.Network.SetCacheDisabled(new V109.Network.SetCacheDisabledCommandS [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifyCertificatesAndOverrideUserAgent() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings()); + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings()); - await domains.Network.SetUserAgentOverride(new V109.Network.SetUserAgentOverrideCommandSettings() + await domains.Network.SetUserAgentOverride(new V110.Network.SetUserAgentOverrideCommandSettings() { UserAgent = "userAgent" }); ManualResetEventSlim requestSync = new ManualResetEventSlim(false); - EventHandler requestWillBeSentHandler = (sender, e) => + EventHandler requestWillBeSentHandler = (sender, e) => { Assert.That(e.Request.Headers["User-Agent"], Is.EqualTo("userAgent")); requestSync.Set(); @@ -297,7 +297,7 @@ await domains.Network.SetUserAgentOverride(new V109.Network.SetUserAgentOverride driver.Url = origin; requestSync.Wait(TimeSpan.FromSeconds(5)); - var result = await domains.Network.GetCertificate(new V109.Network.GetCertificateCommandSettings() + var result = await domains.Network.GetCertificate(new V110.Network.GetCertificateCommandSettings() { Origin = origin }); @@ -311,10 +311,10 @@ await domains.Network.SetUserAgentOverride(new V109.Network.SetUserAgentOverride [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifyResponseReceivedEventAndNetworkDisable() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings()); + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings()); ManualResetEventSlim responseSync = new ManualResetEventSlim(false); - EventHandler responseReceivedHandler = (sender, e) => + EventHandler responseReceivedHandler = (sender, e) => { Assert.That(e, Is.Not.Null); responseSync.Set(); @@ -332,34 +332,34 @@ public async Task VerifyResponseReceivedEventAndNetworkDisable() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifyWebSocketOperations() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings()); + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings()); - EventHandler webSocketCreatedHandler = (sender, e) => + EventHandler webSocketCreatedHandler = (sender, e) => { Assert.That(e, Is.Not.Null); }; domains.Network.WebSocketCreated += webSocketCreatedHandler; - EventHandler webSocketFrameReceivedHandler = (sender, e) => + EventHandler webSocketFrameReceivedHandler = (sender, e) => { Assert.That(e, Is.Not.Null); }; domains.Network.WebSocketFrameReceived += webSocketFrameReceivedHandler; - EventHandlerwebSocketFrameErrorHandler = (sender, e) => + EventHandlerwebSocketFrameErrorHandler = (sender, e) => { Assert.That(e, Is.Not.Null); }; domains.Network.WebSocketFrameError += webSocketFrameErrorHandler; - EventHandler webSocketFrameSentHandler = (sender, e) => + EventHandler webSocketFrameSentHandler = (sender, e) => { Assert.That(e, Is.Not.Null); }; domains.Network.WebSocketFrameSent += webSocketFrameSentHandler; - EventHandler webSocketClosedHandler = (sender, e) => + EventHandler webSocketClosedHandler = (sender, e) => { Assert.That(e, Is.Not.Null); }; @@ -374,13 +374,13 @@ public async Task VerifyWebSocketOperations() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifyRequestPostData() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings()); + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings()); string[] requestIds = new string[1]; ManualResetEventSlim requestSync = new ManualResetEventSlim(false); - EventHandler requestWillBeSentHandler = (sender, e) => + EventHandler requestWillBeSentHandler = (sender, e) => { Assert.That(e, Is.Not.Null); if (string.Compare(e.Request.Method, "post", StringComparison.OrdinalIgnoreCase) == 0) @@ -395,7 +395,7 @@ public async Task VerifyRequestPostData() driver.FindElement(By.XPath("//form/input")).Click(); requestSync.Wait(TimeSpan.FromSeconds(5)); - var response = await domains.Network.GetRequestPostData(new V109.Network.GetRequestPostDataCommandSettings() + var response = await domains.Network.GetRequestPostData(new V110.Network.GetRequestPostDataCommandSettings() { RequestId = requestIds[0] }); @@ -409,9 +409,9 @@ public async Task VerifyRequestPostData() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task ByPassServiceWorker() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings()); - await domains.Network.SetBypassServiceWorker(new V109.Network.SetBypassServiceWorkerCommandSettings() + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings()); + await domains.Network.SetBypassServiceWorker(new V110.Network.SetBypassServiceWorkerCommandSettings() { Bypass = true }); @@ -423,11 +423,11 @@ await domains.Network.SetBypassServiceWorker(new V109.Network.SetBypassServiceWo [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifyEventSourceMessage() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings()); + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings()); ManualResetEventSlim requestSync = new ManualResetEventSlim(false); - EventHandler eventSourceMessageReceivedHandler = (sender, e) => + EventHandler eventSourceMessageReceivedHandler = (sender, e) => { Assert.That(e, Is.Not.Null); requestSync.Set(); @@ -445,11 +445,11 @@ public async Task VerifyEventSourceMessage() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifySignedExchangeReceived() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings()); + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings()); ManualResetEventSlim requestSync = new ManualResetEventSlim(false); - EventHandler signedExchangeReceivedHandler = (sender, e) => + EventHandler signedExchangeReceivedHandler = (sender, e) => { Assert.That(e, Is.Not.Null); requestSync.Set(); @@ -466,11 +466,11 @@ public async Task VerifySignedExchangeReceived() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task VerifyResourceChangedPriority() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings()); + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings()); ManualResetEventSlim requestSync = new ManualResetEventSlim(false); - EventHandler resourceChangedPriorityHandler = (sender, e) => + EventHandler resourceChangedPriorityHandler = (sender, e) => { Assert.That(e, Is.Not.Null); requestSync.Set(); @@ -487,13 +487,13 @@ public async Task VerifyResourceChangedPriority() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task InterceptRequestAndContinue() { - var domains = session.GetVersionSpecificDomains(); - await domains.Network.Enable(new V109.Network.EnableCommandSettings()); + var domains = session.GetVersionSpecificDomains(); + await domains.Network.Enable(new V110.Network.EnableCommandSettings()); ManualResetEventSlim requestSync = new ManualResetEventSlim(false); - EventHandler requestInterceptedHandler = (async (sender, e) => + EventHandler requestInterceptedHandler = (async (sender, e) => { - await domains.Network.ContinueInterceptedRequest(new V109.Network.ContinueInterceptedRequestCommandSettings() + await domains.Network.ContinueInterceptedRequest(new V110.Network.ContinueInterceptedRequestCommandSettings() { InterceptionId = e.InterceptionId }); @@ -501,16 +501,16 @@ await domains.Network.ContinueInterceptedRequest(new V109.Network.ContinueInterc }); domains.Network.RequestIntercepted += requestInterceptedHandler; - var pattern = new V109.Network.RequestPattern() + var pattern = new V110.Network.RequestPattern() { UrlPattern = "*.css", - ResourceType = V109.Network.ResourceType.Stylesheet, - InterceptionStage = V109.Network.InterceptionStage.HeadersReceived + ResourceType = V110.Network.ResourceType.Stylesheet, + InterceptionStage = V110.Network.InterceptionStage.HeadersReceived }; - await domains.Network.SetRequestInterception(new V109.Network.SetRequestInterceptionCommandSettings() + await domains.Network.SetRequestInterception(new V110.Network.SetRequestInterceptionCommandSettings() { - Patterns = new V109.Network.RequestPattern[] { pattern } + Patterns = new V110.Network.RequestPattern[] { pattern } }); driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("js/skins/lightgray/content.min.css"); diff --git a/dotnet/test/common/DevTools/DevToolsPerformanceTest.cs b/dotnet/test/common/DevTools/DevToolsPerformanceTest.cs index 9477561689b5f..e00f05b4989f0 100644 --- a/dotnet/test/common/DevTools/DevToolsPerformanceTest.cs +++ b/dotnet/test/common/DevTools/DevToolsPerformanceTest.cs @@ -12,8 +12,8 @@ public class DevToolsPerformanceTest : DevToolsTestFixture [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task EnableAndDisablePerformance() { - var domains = session.GetVersionSpecificDomains(); - await domains.Performance.Enable(new V109.Performance.EnableCommandSettings()); + var domains = session.GetVersionSpecificDomains(); + await domains.Performance.Enable(new V110.Performance.EnableCommandSettings()); driver.Url = simpleTestPage; await domains.Performance.Disable(); } @@ -24,7 +24,7 @@ public async Task EnableAndDisablePerformance() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task DisablePerformance() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); await domains.Performance.Disable(); driver.Url = simpleTestPage; await domains.Performance.Disable(); @@ -36,13 +36,13 @@ public async Task DisablePerformance() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task SetTimeDomainTimeTickPerformance() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); await domains.Performance.Disable(); - await domains.Performance.SetTimeDomain(new V109.Performance.SetTimeDomainCommandSettings() + await domains.Performance.SetTimeDomain(new V110.Performance.SetTimeDomainCommandSettings() { TimeDomain = "timeTicks" }); - await domains.Performance.Enable(new V109.Performance.EnableCommandSettings()); + await domains.Performance.Enable(new V110.Performance.EnableCommandSettings()); driver.Url = simpleTestPage; await domains.Performance.Disable(); } @@ -54,13 +54,13 @@ await domains.Performance.SetTimeDomain(new V109.Performance.SetTimeDomainComman [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task SetTimeDomainsThreadTicksPerformance() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); await domains.Performance.Disable(); - await domains.Performance.SetTimeDomain(new V109.Performance.SetTimeDomainCommandSettings() + await domains.Performance.SetTimeDomain(new V110.Performance.SetTimeDomainCommandSettings() { TimeDomain = "threadTicks" }); - await domains.Performance.Enable(new V109.Performance.EnableCommandSettings()); + await domains.Performance.Enable(new V110.Performance.EnableCommandSettings()); driver.Url = simpleTestPage; await domains.Performance.Disable(); } @@ -71,12 +71,12 @@ await domains.Performance.SetTimeDomain(new V109.Performance.SetTimeDomainComman [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task GetMetricsByTimeTicks() { - var domains = session.GetVersionSpecificDomains(); - await domains.Performance.SetTimeDomain(new V109.Performance.SetTimeDomainCommandSettings() + var domains = session.GetVersionSpecificDomains(); + await domains.Performance.SetTimeDomain(new V110.Performance.SetTimeDomainCommandSettings() { TimeDomain = "timeTicks" }); - await domains.Performance.Enable(new V109.Performance.EnableCommandSettings()); + await domains.Performance.Enable(new V110.Performance.EnableCommandSettings()); driver.Url = simpleTestPage; var response = await domains.Performance.GetMetrics(); var metrics = response.Metrics; @@ -92,12 +92,12 @@ await domains.Performance.SetTimeDomain(new V109.Performance.SetTimeDomainComman [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task GetMetricsByThreadTicks() { - var domains = session.GetVersionSpecificDomains(); - await domains.Performance.SetTimeDomain(new V109.Performance.SetTimeDomainCommandSettings() + var domains = session.GetVersionSpecificDomains(); + await domains.Performance.SetTimeDomain(new V110.Performance.SetTimeDomainCommandSettings() { TimeDomain = "threadTicks" }); - await domains.Performance.Enable(new V109.Performance.EnableCommandSettings()); + await domains.Performance.Enable(new V110.Performance.EnableCommandSettings()); driver.Url = simpleTestPage; var response = await domains.Performance.GetMetrics(); var metrics = response.Metrics; diff --git a/dotnet/test/common/DevTools/DevToolsProfilerTest.cs b/dotnet/test/common/DevTools/DevToolsProfilerTest.cs index 91b26fa63d74c..5512243e10efb 100644 --- a/dotnet/test/common/DevTools/DevToolsProfilerTest.cs +++ b/dotnet/test/common/DevTools/DevToolsProfilerTest.cs @@ -17,7 +17,7 @@ public class DevToolsProfilerTest : DevToolsTestFixture [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task SimpleStartStopAndGetProfilerTest() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); await domains.Profiler.Enable(); await domains.Profiler.Start(); var response = await domains.Profiler.Stop(); @@ -32,10 +32,10 @@ public async Task SimpleStartStopAndGetProfilerTest() [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task SampleGetBestEffortProfilerTest() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); await domains.Profiler.Enable(); driver.Url = simpleTestPage; - await domains.Profiler.SetSamplingInterval(new V109.Profiler.SetSamplingIntervalCommandSettings() + await domains.Profiler.SetSamplingInterval(new V110.Profiler.SetSamplingIntervalCommandSettings() { Interval = 30 }); @@ -53,10 +53,10 @@ await domains.Profiler.SetSamplingInterval(new V109.Profiler.SetSamplingInterval [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task SampleSetStartPreciseCoverageTest() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); await domains.Profiler.Enable(); driver.Url = simpleTestPage; - await domains.Profiler.StartPreciseCoverage(new V109.Profiler.StartPreciseCoverageCommandSettings() + await domains.Profiler.StartPreciseCoverage(new V110.Profiler.StartPreciseCoverageCommandSettings() { CallCount = true, Detailed = true @@ -78,11 +78,11 @@ await domains.Profiler.StartPreciseCoverage(new V109.Profiler.StartPreciseCovera [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task SampleProfileEvents() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); await domains.Profiler.Enable(); driver.Url = simpleTestPage; ManualResetEventSlim startSync = new ManualResetEventSlim(false); - EventHandler consoleProfileStartedHandler = (sender, e) => + EventHandler consoleProfileStartedHandler = (sender, e) => { Assert.That(e, Is.Not.Null); startSync.Set(); @@ -94,7 +94,7 @@ public async Task SampleProfileEvents() driver.Navigate().Refresh(); ManualResetEventSlim finishSync = new ManualResetEventSlim(false); - EventHandler consoleProfileFinishedHandler = (sender, e) => + EventHandler consoleProfileFinishedHandler = (sender, e) => { Assert.That(e, Is.Not.Null); finishSync.Set(); @@ -109,7 +109,7 @@ public async Task SampleProfileEvents() await domains.Profiler.Disable(); } - private void ValidateProfile(V109.Profiler.Profile profiler) + private void ValidateProfile(V110.Profiler.Profile profiler) { Assert.That(profiler, Is.Not.Null); Assert.That(profiler.Nodes, Is.Not.Null); diff --git a/dotnet/test/common/DevTools/DevToolsSecurityTest.cs b/dotnet/test/common/DevTools/DevToolsSecurityTest.cs index 2292ca62268e7..b902ccd4e2414 100644 --- a/dotnet/test/common/DevTools/DevToolsSecurityTest.cs +++ b/dotnet/test/common/DevTools/DevToolsSecurityTest.cs @@ -18,17 +18,17 @@ public class DevToolsSecurityTest : DevToolsTestFixture [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task LoadInsecureWebsite() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); await domains.Security.Enable(); - await domains.Security.SetIgnoreCertificateErrors(new V109.Security.SetIgnoreCertificateErrorsCommandSettings() + await domains.Security.SetIgnoreCertificateErrors(new V110.Security.SetIgnoreCertificateErrorsCommandSettings() { Ignore = false }); string summary = null; ManualResetEventSlim sync = new ManualResetEventSlim(false); - EventHandler securityStateChangedHandler = (sender, e) => + EventHandler securityStateChangedHandler = (sender, e) => { summary = e.Summary; sync.Set(); @@ -50,10 +50,10 @@ await domains.Security.SetIgnoreCertificateErrors(new V109.Security.SetIgnoreCer [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task LoadSecureWebsite() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); await domains.Security.Enable(); - await domains.Security.SetIgnoreCertificateErrors(new V109.Security.SetIgnoreCertificateErrorsCommandSettings() + await domains.Security.SetIgnoreCertificateErrors(new V110.Security.SetIgnoreCertificateErrorsCommandSettings() { Ignore = true }); diff --git a/dotnet/test/common/DevTools/DevToolsTargetTest.cs b/dotnet/test/common/DevTools/DevToolsTargetTest.cs index 96d486acdcd6d..b8ca196f5089b 100644 --- a/dotnet/test/common/DevTools/DevToolsTargetTest.cs +++ b/dotnet/test/common/DevTools/DevToolsTargetTest.cs @@ -2,7 +2,7 @@ using System.Threading; using System.Threading.Tasks; using NUnit.Framework; -using OpenQA.Selenium.DevTools.V109.Target; +using OpenQA.Selenium.DevTools.V110.Target; using OpenQA.Selenium.Environment; namespace OpenQA.Selenium.DevTools @@ -18,24 +18,24 @@ public class DevToolsTargetTest : DevToolsTestFixture [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task GetTargetActivateAndAttach() { - var domains = session.GetVersionSpecificDomains(); + var domains = session.GetVersionSpecificDomains(); driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("devToolsConsoleTest.html"); var response = await domains.Target.GetTargets(new GetTargetsCommandSettings()); - V109.Target.TargetInfo[] allTargets = response.TargetInfos; - foreach (V109.Target.TargetInfo targetInfo in allTargets) + V110.Target.TargetInfo[] allTargets = response.TargetInfos; + foreach (V110.Target.TargetInfo targetInfo in allTargets) { ValidateTarget(targetInfo); - await domains.Target.ActivateTarget(new V109.Target.ActivateTargetCommandSettings() + await domains.Target.ActivateTarget(new V110.Target.ActivateTargetCommandSettings() { TargetId = targetInfo.TargetId }); - var attachResponse = await domains.Target.AttachToTarget(new V109.Target.AttachToTargetCommandSettings() + var attachResponse = await domains.Target.AttachToTarget(new V110.Target.AttachToTargetCommandSettings() { TargetId = targetInfo.TargetId, Flatten = true }); ValidateSession(attachResponse.SessionId); - var getInfoResponse = await domains.Target.GetTargetInfo(new V109.Target.GetTargetInfoCommandSettings() + var getInfoResponse = await domains.Target.GetTargetInfo(new V110.Target.GetTargetInfoCommandSettings() { TargetId = targetInfo.TargetId }); @@ -49,10 +49,10 @@ await domains.Target.ActivateTarget(new V109.Target.ActivateTargetCommandSetting [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task GetTargetAndSendMessageToTarget() { - var domains = session.GetVersionSpecificDomains(); - V109.Target.TargetInfo[] allTargets = null; + var domains = session.GetVersionSpecificDomains(); + V110.Target.TargetInfo[] allTargets = null; string sessionId = null; - V109.Target.TargetInfo targetInfo = null; + V110.Target.TargetInfo targetInfo = null; driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("devToolsConsoleTest.html"); ManualResetEventSlim sync = new ManualResetEventSlim(false); domains.Target.ReceivedMessageFromTarget += (sender, e) => @@ -65,19 +65,19 @@ public async Task GetTargetAndSendMessageToTarget() ValidateTargetsInfos(allTargets); ValidateTarget(allTargets[0]); targetInfo = allTargets[0]; - await domains.Target.ActivateTarget(new V109.Target.ActivateTargetCommandSettings() + await domains.Target.ActivateTarget(new V110.Target.ActivateTargetCommandSettings() { TargetId = targetInfo.TargetId }); - var attachResponse = await domains.Target.AttachToTarget(new V109.Target.AttachToTargetCommandSettings() + var attachResponse = await domains.Target.AttachToTarget(new V110.Target.AttachToTargetCommandSettings() { TargetId = targetInfo.TargetId, Flatten = false }); sessionId = attachResponse.SessionId; ValidateSession(sessionId); - await domains.Target.SendMessageToTarget(new V109.Target.SendMessageToTargetCommandSettings() + await domains.Target.SendMessageToTarget(new V110.Target.SendMessageToTargetCommandSettings() { Message = "{\"id\":" + id + ",\"method\":\"Page.bringToFront\"}", SessionId = sessionId, @@ -92,32 +92,32 @@ await domains.Target.SendMessageToTarget(new V109.Target.SendMessageToTargetComm [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")] public async Task CreateAndContentLifeCycle() { - var domains = session.GetVersionSpecificDomains(); - EventHandler targetCreatedHandler = (sender, e) => + var domains = session.GetVersionSpecificDomains(); + EventHandler targetCreatedHandler = (sender, e) => { ValidateTargetInfo(e.TargetInfo); }; domains.Target.TargetCreated += targetCreatedHandler; - EventHandler targetCrashedHandler = (sender, e) => + EventHandler targetCrashedHandler = (sender, e) => { ValidateTargetCrashed(e); }; domains.Target.TargetCrashed += targetCrashedHandler; - EventHandler targetDestroyedHandler = (sender, e) => + EventHandler targetDestroyedHandler = (sender, e) => { ValidateTargetId(e.TargetId); }; domains.Target.TargetDestroyed += targetDestroyedHandler; - EventHandler targetInfoChangedHandler = (sender, e) => + EventHandler targetInfoChangedHandler = (sender, e) => { ValidateTargetInfo(e.TargetInfo); }; domains.Target.TargetInfoChanged += targetInfoChangedHandler; - var response = await domains.Target.CreateTarget(new V109.Target.CreateTargetCommandSettings() + var response = await domains.Target.CreateTarget(new V110.Target.CreateTargetCommandSettings() { Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("devToolsConsoleTest.html"), NewWindow = true, @@ -125,12 +125,12 @@ public async Task CreateAndContentLifeCycle() }); ValidateTargetId(response.TargetId); - await domains.Target.SetDiscoverTargets(new V109.Target.SetDiscoverTargetsCommandSettings() + await domains.Target.SetDiscoverTargets(new V110.Target.SetDiscoverTargetsCommandSettings() { Discover = true }); - var closeResponse = await domains.Target.CloseTarget(new V109.Target.CloseTargetCommandSettings() + var closeResponse = await domains.Target.CloseTarget(new V110.Target.CloseTargetCommandSettings() { TargetId = response.TargetId }); @@ -139,7 +139,7 @@ await domains.Target.SetDiscoverTargets(new V109.Target.SetDiscoverTargetsComman Assert.That(closeResponse.Success, Is.True); } - private void ValidateTargetCrashed(V109.Target.TargetCrashedEventArgs targetCrashed) + private void ValidateTargetCrashed(V110.Target.TargetCrashedEventArgs targetCrashed) { Assert.That(targetCrashed, Is.Not.Null); Assert.That(targetCrashed.ErrorCode, Is.Not.Null); @@ -152,7 +152,7 @@ private void ValidateTargetId(string targetId) Assert.That(targetId, Is.Not.Null); } - private void ValidateMessage(V109.Target.ReceivedMessageFromTargetEventArgs messageFromTarget) + private void ValidateMessage(V110.Target.ReceivedMessageFromTargetEventArgs messageFromTarget) { Assert.That(messageFromTarget, Is.Not.Null); Assert.That(messageFromTarget.Message, Is.Not.Null); @@ -160,7 +160,7 @@ private void ValidateMessage(V109.Target.ReceivedMessageFromTargetEventArgs mess Assert.That(messageFromTarget.Message, Is.EqualTo("{\"id\":" + id + ",\"result\":{}}")); } - private void ValidateTargetInfo(V109.Target.TargetInfo targetInfo) + private void ValidateTargetInfo(V110.Target.TargetInfo targetInfo) { Assert.That(targetInfo, Is.Not.Null); Assert.That(targetInfo.TargetId, Is.Not.Null); @@ -169,13 +169,13 @@ private void ValidateTargetInfo(V109.Target.TargetInfo targetInfo) Assert.That(targetInfo.Url, Is.Not.Null); } - private void ValidateTargetsInfos(V109.Target.TargetInfo[] targets) + private void ValidateTargetsInfos(V110.Target.TargetInfo[] targets) { Assert.That(targets, Is.Not.Null); Assert.That(targets.Length, Is.GreaterThan(0)); } - private void ValidateTarget(V109.Target.TargetInfo targetInfo) + private void ValidateTarget(V110.Target.TargetInfo targetInfo) { Assert.That(targetInfo, Is.Not.Null); Assert.That(targetInfo.TargetId, Is.Not.Null);