Skip to content

Commit 1fbd40c

Browse files
[dotnet] Remove Newtonsoft.Json test-only dependency (#16639)
* [dotnet] Remove Newtonsoft.Json test-only dependency * [dotnet] Remove source generator, it seems to fail in the non-common test runs
1 parent 03b4c25 commit 1fbd40c

File tree

12 files changed

+13
-48
lines changed

12 files changed

+13
-48
lines changed

dotnet/paket.dependencies

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ nuget Humanizer.Core 2.8.26
1010
nuget Microsoft.Extensions.DependencyInjection 3.1.9
1111
nuget Moq 4.20.72
1212
nuget NETStandard.Library 2.0.3
13-
nuget Newtonsoft.Json 13.0.1
1413
nuget NUnit 3.13.2
1514
nuget NUnitLite 3.13.2
1615
nuget System.Text.Json 8.0.5

dotnet/paket.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ NUGET
2929
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (== net462) (&& (== net8.0) (>= net462)) (&& (== net8.0) (< netstandard2.1)) (== netstandard2.0)
3030
NETStandard.Library (2.0.3)
3131
Microsoft.NETCore.Platforms (>= 1.1)
32-
Newtonsoft.Json (13.0.1)
3332
NUnit (3.13.2)
3433
NETStandard.Library (>= 2.0) - restriction: || (&& (== net462) (< net35) (>= netstandard2.0)) (== net8.0) (== netstandard2.0)
3534
NUnitLite (3.13.2)

dotnet/paket.nuget.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def nuget():
1919
{"name": "Microsoft.NETCore.Platforms", "id": "Microsoft.NETCore.Platforms", "version": "1.1.0", "sha512": "sha512-a/iSwnRZb+LHFk49hQOyThh/ZNC3vsbZsF65XwQIb863qF6msmhdQtxGXFL28Ob2NsCz/drEj28BJd/YPpLRBg==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": [], "net6.0": [], "net7.0": [], "net8.0": [], "net9.0": [], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": [], "netcoreapp2.1": [], "netcoreapp2.2": [], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": [], "netstandard2.1": []}, "targeting_pack_overrides": [], "framework_list": []},
2020
{"name": "Moq", "id": "Moq", "version": "4.20.72", "sha512": "sha512-HeLdAKzFe2G4fUg+tUa1WRf/Mye9zbkiv57jHRSb5IVi7GXVPgWbbEaUP8SaOpt43JJFRlWY9N5Yro32/tgRpQ==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net462": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net47": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net471": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net472": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net48": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net5.0": ["Castle.Core"], "net6.0": ["Castle.Core"], "net7.0": ["Castle.Core"], "net8.0": ["Castle.Core"], "net9.0": ["Castle.Core"], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["Castle.Core", "System.Threading.Tasks.Extensions"], "netcoreapp2.1": ["Castle.Core", "System.Threading.Tasks.Extensions"], "netcoreapp2.2": ["Castle.Core", "System.Threading.Tasks.Extensions"], "netcoreapp3.0": ["Castle.Core"], "netcoreapp3.1": ["Castle.Core"], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["Castle.Core", "System.Threading.Tasks.Extensions"], "netstandard2.1": ["Castle.Core"]}, "targeting_pack_overrides": [], "framework_list": []},
2121
{"name": "NETStandard.Library", "id": "NETStandard.Library", "version": "2.0.3", "sha512": "sha512-548M6mnBSJWxsIlkQHfbzoYxpiYFXZZSL00p4GHYv8PkiqFBnnT68mW5mGEsA/ch9fDO9GkPgkFQpWiXZN7mAQ==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": ["Microsoft.NETCore.Platforms"], "net451": ["Microsoft.NETCore.Platforms"], "net452": ["Microsoft.NETCore.Platforms"], "net46": ["Microsoft.NETCore.Platforms"], "net461": ["Microsoft.NETCore.Platforms"], "net462": ["Microsoft.NETCore.Platforms"], "net47": ["Microsoft.NETCore.Platforms"], "net471": ["Microsoft.NETCore.Platforms"], "net472": ["Microsoft.NETCore.Platforms"], "net48": ["Microsoft.NETCore.Platforms"], "net5.0": ["Microsoft.NETCore.Platforms"], "net6.0": ["Microsoft.NETCore.Platforms"], "net7.0": ["Microsoft.NETCore.Platforms"], "net8.0": ["Microsoft.NETCore.Platforms"], "net9.0": ["Microsoft.NETCore.Platforms"], "netcoreapp1.0": ["Microsoft.NETCore.Platforms"], "netcoreapp1.1": ["Microsoft.NETCore.Platforms"], "netcoreapp2.0": ["Microsoft.NETCore.Platforms"], "netcoreapp2.1": ["Microsoft.NETCore.Platforms"], "netcoreapp2.2": ["Microsoft.NETCore.Platforms"], "netcoreapp3.0": ["Microsoft.NETCore.Platforms"], "netcoreapp3.1": ["Microsoft.NETCore.Platforms"], "netstandard": [], "netstandard1.0": ["Microsoft.NETCore.Platforms"], "netstandard1.1": ["Microsoft.NETCore.Platforms"], "netstandard1.2": ["Microsoft.NETCore.Platforms"], "netstandard1.3": ["Microsoft.NETCore.Platforms"], "netstandard1.4": ["Microsoft.NETCore.Platforms"], "netstandard1.5": ["Microsoft.NETCore.Platforms"], "netstandard1.6": ["Microsoft.NETCore.Platforms"], "netstandard2.0": ["Microsoft.NETCore.Platforms"], "netstandard2.1": ["Microsoft.NETCore.Platforms"]}, "targeting_pack_overrides": [], "framework_list": []},
22-
{"name": "Newtonsoft.Json", "id": "Newtonsoft.Json", "version": "13.0.1", "sha512": "sha512-g3MbZi6vBTeaI/hEbvR7vBETSd1DWLe9i1E4P+nPY34v5i94zqUqDXvdWC3G+7tYN9SnsdU9zzegrnRz4h7nsQ==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": [], "net6.0": [], "net7.0": [], "net8.0": [], "net9.0": [], "netcoreapp1.0": ["Microsoft.CSharp", "NETStandard.Library"], "netcoreapp1.1": ["Microsoft.CSharp", "NETStandard.Library"], "netcoreapp2.0": [], "netcoreapp2.1": [], "netcoreapp2.2": [], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.1": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.2": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.3": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.4": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.5": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.6": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard2.0": [], "netstandard2.1": []}, "targeting_pack_overrides": [], "framework_list": []},
2322
{"name": "NUnit", "id": "NUnit", "version": "3.13.2", "sha512": "sha512-foKGnF2ckq6uRAybnw1PIMDsDxdp1rbuEBJ4t2LYa5HDL80mOcEUjdbVqRDMTsKNiikfkPEBoeyGV42ZXiLLQA==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": ["NETStandard.Library"], "net6.0": ["NETStandard.Library"], "net7.0": ["NETStandard.Library"], "net8.0": ["NETStandard.Library"], "net9.0": ["NETStandard.Library"], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["NETStandard.Library"], "netcoreapp2.1": ["NETStandard.Library"], "netcoreapp2.2": ["NETStandard.Library"], "netcoreapp3.0": ["NETStandard.Library"], "netcoreapp3.1": ["NETStandard.Library"], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["NETStandard.Library"], "netstandard2.1": ["NETStandard.Library"]}, "targeting_pack_overrides": [], "framework_list": []},
2423
{"name": "NUnitLite", "id": "NUnitLite", "version": "3.13.2", "sha512": "sha512-kPGW4B0ycZAqDPLPKU058JR9onD3svLKAYEghQ1Oyy1YC8bIgtniGUKUbjqeNI3i5KnqFMxEdiHTGF0XxDG9hQ==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": ["NUnit"], "net40": ["NUnit"], "net403": ["NUnit"], "net45": ["NUnit"], "net451": ["NUnit"], "net452": ["NUnit"], "net46": ["NUnit"], "net461": ["NUnit"], "net462": ["NUnit"], "net47": ["NUnit"], "net471": ["NUnit"], "net472": ["NUnit"], "net48": ["NUnit"], "net5.0": ["NUnit", "NETStandard.Library"], "net6.0": ["NUnit", "NETStandard.Library"], "net7.0": ["NUnit", "NETStandard.Library"], "net8.0": ["NUnit", "NETStandard.Library"], "net9.0": ["NUnit", "NETStandard.Library"], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["NUnit", "NETStandard.Library"], "netcoreapp2.1": ["NUnit", "NETStandard.Library"], "netcoreapp2.2": ["NUnit", "NETStandard.Library"], "netcoreapp3.0": ["NUnit", "NETStandard.Library"], "netcoreapp3.1": ["NUnit", "NETStandard.Library"], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["NUnit", "NETStandard.Library"], "netstandard2.1": ["NUnit", "NETStandard.Library"]}, "targeting_pack_overrides": [], "framework_list": []},
2524
{"name": "Runfiles", "id": "Runfiles", "version": "0.14.0", "sha512": "sha512-xncDBZgH/5m3QXFXxTOSQiooXZrEhU9hPThejXvnCmFpGrXYKWq5xWzM3Lp8sL33pTWnuWySnrdIyu5W6DZDiQ==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": [], "net6.0": [], "net7.0": [], "net8.0": [], "net9.0": [], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": [], "netcoreapp2.1": [], "netcoreapp2.2": [], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": [], "netstandard2.1": []}, "targeting_pack_overrides": [], "framework_list": []},

dotnet/test/common/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ csharp_library(
5252
],
5353
deps = [
5454
"//dotnet/src/webdriver:webdriver-net8.0",
55-
nuget_package("Newtonsoft.Json"),
5655
nuget_package("NUnit"),
5756
nuget_package("Runfiles"),
5857
],
@@ -91,7 +90,6 @@ dotnet_nunit_test_suite(
9190
":fixtures",
9291
"//dotnet/src/webdriver:webdriver-net8.0",
9392
nuget_package("BenderProxy"),
94-
nuget_package("Newtonsoft.Json"),
9593
nuget_package("NUnit"),
9694
nuget_package("Runfiles"),
9795
],

dotnet/test/common/Environment/DriverConfig.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,20 @@
1717
// under the License.
1818
// </copyright>
1919

20-
using Newtonsoft.Json;
21-
using Newtonsoft.Json.Converters;
20+
using System.Text.Json.Serialization;
2221

2322
namespace OpenQA.Selenium.Environment;
2423

25-
[JsonObject]
2624
public class DriverConfig
2725
{
28-
[JsonProperty]
2926
public string DriverTypeName { get; set; }
3027

31-
[JsonProperty]
32-
[JsonConverter(typeof(StringEnumConverter))]
28+
[JsonConverter(typeof(JsonStringEnumConverter<Browser>))]
3329
public Browser BrowserValue { get; set; }
3430

35-
[JsonProperty]
3631
public string RemoteCapabilities { get; set; }
3732

38-
[JsonProperty]
3933
public bool AutoStartRemoteServer { get; set; }
4034

41-
[JsonProperty]
4235
public bool Logging { get; set; }
4336
}

dotnet/test/common/Environment/EnvironmentManager.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
// </copyright>
1919

2020
using Bazel;
21-
using Newtonsoft.Json;
2221
using NUnit.Framework;
2322
using OpenQA.Selenium.Internal;
2423
using System;
2524
using System.IO;
2625
using System.Linq;
2726
using System.Runtime.InteropServices;
27+
using System.Text.Json;
2828

2929
namespace OpenQA.Selenium.Environment;
3030

@@ -56,7 +56,10 @@ private EnvironmentManager()
5656
string currentDirectory = this.CurrentDirectory;
5757

5858
string content = File.ReadAllText(dataFilePath);
59-
TestEnvironment env = JsonConvert.DeserializeObject<TestEnvironment>(content);
59+
TestEnvironment env = JsonSerializer.Deserialize<TestEnvironment>(content, new JsonSerializerOptions
60+
{
61+
PropertyNameCaseInsensitive = true
62+
});
6063

6164
string activeDriverConfig = System.Environment.GetEnvironmentVariable("ACTIVE_DRIVER_CONFIG") ?? TestContext.Parameters.Get("ActiveDriverConfig", env.ActiveDriverConfig);
6265
string driverServiceLocation = System.Environment.GetEnvironmentVariable("DRIVER_SERVICE_LOCATION") ?? TestContext.Parameters.Get("DriverServiceLocation", env.DriverServiceLocation);

dotnet/test/common/Environment/TestEnvironment.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,25 @@
1717
// under the License.
1818
// </copyright>
1919

20-
using Newtonsoft.Json;
2120
using System.Collections.Generic;
2221

2322
namespace OpenQA.Selenium.Environment;
2423

25-
[JsonObject]
2624
class TestEnvironment
2725
{
28-
[JsonProperty]
2926
public bool CaptureWebServerOutput { get; set; }
3027

31-
[JsonProperty]
3228
public string DriverServiceLocation { get; set; }
3329

34-
[JsonProperty]
3530
public bool HideWebServerCommandPrompt { get; set; }
3631

37-
[JsonProperty]
3832
public string ActiveDriverConfig { get; set; }
3933

40-
[JsonProperty]
4134
public string ActiveWebsiteConfig { get; set; }
4235

43-
[JsonProperty]
4436
public Dictionary<string, WebsiteConfig> WebSiteConfigs { get; set; }
4537

46-
[JsonProperty]
4738
public Dictionary<string, DriverConfig> DriverConfigs { get; set; }
4839

49-
[JsonProperty]
5040
public TestWebServerConfig TestWebServerConfig { get; set; }
5141
}

dotnet/test/common/Environment/TestWebServerConfig.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,18 @@
1717
// under the License.
1818
// </copyright>
1919

20-
using Newtonsoft.Json;
20+
using System.Text.Json.Serialization;
2121

2222
namespace OpenQA.Selenium.Environment;
2323

24-
[JsonObject]
2524
public class TestWebServerConfig
2625
{
27-
[JsonProperty]
2826
public bool CaptureConsoleOutput { get; set; }
2927

30-
[JsonProperty]
3128
public bool HideCommandPromptWindow { get; set; }
3229

33-
[JsonProperty]
3430
public string JavaHomeDirectory { get; set; }
3531

32+
[JsonIgnore]
3633
public string Port { get; set; }
3734
}

dotnet/test/common/Environment/UrlBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
// under the License.
1818
// </copyright>
1919

20-
using Newtonsoft.Json;
2120
using System;
2221
using System.Collections.Generic;
2322
using System.Net;
2423
using System.Net.Http;
2524
using System.Net.Sockets;
2625
using System.Text;
26+
using System.Text.Json.Nodes;
2727

2828
namespace OpenQA.Selenium.Environment;
2929

@@ -125,12 +125,12 @@ public string CreateInlinePage(InlinePage page)
125125
{
126126
Uri createPageUri = new Uri(new Uri(WhereIs(string.Empty)), "createPage");
127127

128-
Dictionary<string, object> payloadDictionary = new Dictionary<string, object>
128+
var payloadDictionary = new JsonObject
129129
{
130130
["content"] = page.ToString()
131131
};
132132

133-
string commandPayload = JsonConvert.SerializeObject(payloadDictionary);
133+
string commandPayload = payloadDictionary.ToJsonString();
134134

135135
using var httpClient = new HttpClient();
136136

dotnet/test/common/Environment/WebsiteConfig.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,17 @@
1717
// under the License.
1818
// </copyright>
1919

20-
using Newtonsoft.Json;
21-
2220
namespace OpenQA.Selenium.Environment;
2321

24-
[JsonObject]
2522
public class WebsiteConfig
2623
{
27-
[JsonProperty]
2824
public string Protocol { get; set; }
2925

30-
[JsonProperty]
3126
public string HostName { get; set; }
3227

33-
[JsonProperty]
3428
public string Port { get; set; }
3529

36-
[JsonProperty]
3730
public string SecurePort { get; set; }
3831

39-
[JsonProperty]
4032
public string Folder { get; set; }
4133
}

0 commit comments

Comments
 (0)