From b270bd162d0281cb971180c137cd14580a3b5b55 Mon Sep 17 00:00:00 2001 From: Ming Yau Lee Date: Thu, 21 Apr 2022 22:50:28 +0800 Subject: [PATCH] Update nuget packages --- .../Tests/HistoryApiTests.cs | 2 +- .../Tests/WindowsApiTests.cs | 4 ++-- ...ions.Net.BrowserExtensionIntegrationTest.csproj | 4 ++-- .../Runner.cs | 14 +++++++------- ...WebExtensions.Net.IntegrationTestsRunner.csproj | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/WebExtensions.Net.BrowserExtensionIntegrationTest/Tests/HistoryApiTests.cs b/test/WebExtensions.Net.BrowserExtensionIntegrationTest/Tests/HistoryApiTests.cs index bf24da5..439d0f2 100644 --- a/test/WebExtensions.Net.BrowserExtensionIntegrationTest/Tests/HistoryApiTests.cs +++ b/test/WebExtensions.Net.BrowserExtensionIntegrationTest/Tests/HistoryApiTests.cs @@ -47,7 +47,7 @@ public async Task GetVisits() // Assert visits.Should().NotBeNullOrEmpty(); - ((DateTime)visits.Single().VisitTime).Should().BeCloseTo(testHistoryTime, precision: 1000); + ((DateTime)visits.Single().VisitTime).Should().BeCloseTo(testHistoryTime, precision: TimeSpan.FromSeconds(1)); } [Fact(Order = 2)] diff --git a/test/WebExtensions.Net.BrowserExtensionIntegrationTest/Tests/WindowsApiTests.cs b/test/WebExtensions.Net.BrowserExtensionIntegrationTest/Tests/WindowsApiTests.cs index 9e5ef11..b325d07 100644 --- a/test/WebExtensions.Net.BrowserExtensionIntegrationTest/Tests/WindowsApiTests.cs +++ b/test/WebExtensions.Net.BrowserExtensionIntegrationTest/Tests/WindowsApiTests.cs @@ -61,8 +61,8 @@ public async Task Update() // Assert window.Should().NotBeNull(); - window.Top.Should().BeCloseTo(windowTop, 5); - window.Left.Should().BeCloseTo(windowLeft, 5); + window.Top.Should().BeInRange(windowTop - 5, windowTop + 5); + window.Left.Should().BeInRange(windowLeft - 5, windowLeft + 5); } [Fact(Order = 4)] diff --git a/test/WebExtensions.Net.BrowserExtensionIntegrationTest/WebExtensions.Net.BrowserExtensionIntegrationTest.csproj b/test/WebExtensions.Net.BrowserExtensionIntegrationTest/WebExtensions.Net.BrowserExtensionIntegrationTest.csproj index e8472b1..dd9f9d2 100644 --- a/test/WebExtensions.Net.BrowserExtensionIntegrationTest/WebExtensions.Net.BrowserExtensionIntegrationTest.csproj +++ b/test/WebExtensions.Net.BrowserExtensionIntegrationTest/WebExtensions.Net.BrowserExtensionIntegrationTest.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/test/WebExtensions.Net.IntegrationTestsRunner/Runner.cs b/test/WebExtensions.Net.IntegrationTestsRunner/Runner.cs index c45bd82..7685a54 100644 --- a/test/WebExtensions.Net.IntegrationTestsRunner/Runner.cs +++ b/test/WebExtensions.Net.IntegrationTestsRunner/Runner.cs @@ -1,6 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; +using OpenQA.Selenium; using OpenQA.Selenium.Chrome; -using OpenQA.Selenium.Remote; using System; using System.IO; using System.Text.Json; @@ -70,14 +70,14 @@ public async Task RunTests() } } - private static RemoteWebDriver GetWebDriver(string driverPath, string extensionPath) + private static WebDriver GetWebDriver(string driverPath, string extensionPath) { var chromeOptions = new ChromeOptions(); chromeOptions.AddArgument($"load-extension={extensionPath}"); return new ChromeDriver(driverPath, chromeOptions); } - private static async Task WaitForExtensionPageLoaded(RemoteWebDriver webDriver) + private static async Task WaitForExtensionPageLoaded(WebDriver webDriver) { // wait for 10 seconds var waitTime = 10 * 1000; @@ -100,14 +100,14 @@ private static async Task WaitForExtensionPageLoaded(RemoteWebDriver webDriver) } } - private static void LaunchTestPage(RemoteWebDriver webDriver) + private static void LaunchTestPage(WebDriver webDriver) { var extensionUri = new Uri(webDriver.Url); var testPageUrl = $"{extensionUri.Scheme}://{extensionUri.Host}/tests.html?random=false&coverlet"; webDriver.Navigate().GoToUrl(testPageUrl); } - private static async Task WaitForTestToFinish(RemoteWebDriver webDriver) + private static async Task WaitForTestToFinish(WebDriver webDriver) { // wait for 30 seconds var waitTime = 30 * 1000; @@ -132,7 +132,7 @@ private static async Task WaitForTestToFinish(RemoteWebDriver webDriver) } } - private static TestRunInfo GetTestResults(RemoteWebDriver webDriver) + private static TestRunInfo GetTestResults(WebDriver webDriver) { var resultsObject = (string)webDriver.ExecuteScript("return JSON.stringify(TestRunner.GetTestResults());"); var testRunResult = JsonSerializer.Deserialize(resultsObject, new JsonSerializerOptions() @@ -156,7 +156,7 @@ private static TestRunInfo GetTestResults(RemoteWebDriver webDriver) return testRunResult; } - private static async Task GetTestCoverageHits(RemoteWebDriver webDriver) + private static async Task GetTestCoverageHits(WebDriver webDriver) { // wait for 5 seconds var waitTime = 5 * 1000; diff --git a/test/WebExtensions.Net.IntegrationTestsRunner/WebExtensions.Net.IntegrationTestsRunner.csproj b/test/WebExtensions.Net.IntegrationTestsRunner/WebExtensions.Net.IntegrationTestsRunner.csproj index ad63df9..bd008a0 100644 --- a/test/WebExtensions.Net.IntegrationTestsRunner/WebExtensions.Net.IntegrationTestsRunner.csproj +++ b/test/WebExtensions.Net.IntegrationTestsRunner/WebExtensions.Net.IntegrationTestsRunner.csproj @@ -7,10 +7,10 @@ - - - - + + + +