Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NET 6.0 Support #1839

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
dotnet-version: 6.0.100
- name: Check formatting
run: dotnet tool update dotnet-format --tool-path ./dotnet-format/ && ./dotnet-format/dotnet-format -f ./src/ --check -v:diag
6 changes: 5 additions & 1 deletion .github/workflows/integrity-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ jobs:
with:
submodules: true
fetch-depth: 0
- name: Setup .NET Core
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Install prerequisites and download drivers
shell: pwsh
run: .\build.ps1 driver -prereqs
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/nuget-package-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ jobs:
with:
submodules: true
fetch-depth: 0
- name: Setup .NET Core
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Install prerequisites and download drivers
shell: pwsh
run: |
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,23 @@ on:
- release-*

jobs:
test_net5:
name: Quick Test Harness Tests using .NET 5
test_net6:
name: Quick Test Harness Tests using .NET 6
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 1
- name: Setup .NET Core
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Install prerequisites and download drivers
shell: pwsh
run: |
Expand All @@ -33,8 +37,8 @@ jobs:
run: dotnet build ./src
- name: Installing Browsers and dependencies...
run: |
dotnet run --project ./src/Playwright/Playwright.csproj -f net5.0 -- install
dotnet run --project ./src/Playwright/Playwright.csproj -f net5.0 -- install-deps
dotnet run --project ./src/Playwright/Playwright.csproj -f net6.0 -- install
dotnet run --project ./src/Playwright/Playwright.csproj -f net6.0 -- install-deps
- name: Running tests...
run: |
xvfb-run dotnet test ./src/Playwright.TestingHarnessTest/Playwright.TestingHarnessTest.csproj -c Debug -f net5.0 --logger "trx"
xvfb-run dotnet test ./src/Playwright.TestingHarnessTest/Playwright.TestingHarnessTest.csproj -c Debug -f net6.0 --logger "trx"
26 changes: 15 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ on:
- release-*

jobs:
test_net5:
name: ${{ matrix.product }} on ${{ matrix.os }} using .NET 5
test_net6:
name: ${{ matrix.product }} on ${{ matrix.os }} using .NET 6
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
Expand All @@ -25,10 +25,14 @@ jobs:
with:
submodules: true
fetch-depth: 1
- name: Setup .NET Core
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Install prerequisites and download drivers
shell: pwsh
run: |
Expand All @@ -38,20 +42,20 @@ jobs:
run: dotnet build ./src
- name: Installing Browsers and dependencies...
run: |
dotnet run --project ./src/Playwright/Playwright.csproj -f net5.0 -- install
dotnet run --project ./src/Playwright/Playwright.csproj -f net5.0 -- install-deps
dotnet run --project ./src/Playwright/Playwright.csproj -f net6.0 -- install
dotnet run --project ./src/Playwright/Playwright.csproj -f net6.0 -- install-deps
- name: Running tests...
if: ${{ matrix.os != 'ubuntu-latest' }}
env:
BROWSER: ${{ matrix.product }}
run:
dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug -f net5.0 --logger "trx;LogFileName=TestResults.xml" -- NUnit.NumberOfTestWorkers=1
dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug -f net6.0 --logger "trx;LogFileName=TestResults.xml" -- NUnit.NumberOfTestWorkers=1
- name: Running tests... (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
BROWSER: ${{ matrix.product }}
run: |
xvfb-run dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug -f net5.0 --logger "trx" -- NUnit.NumberOfTestWorkers=1
xvfb-run dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug -f net6.0 --logger "trx" -- NUnit.NumberOfTestWorkers=1

test_net31:
name: Chromium on Ubuntu using .NET 3.1
Expand All @@ -65,10 +69,10 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Setup .NET 5.0 # needed for our build steps
- name: Setup .NET 6.0 # needed for our build steps
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: Install prerequisites and download drivers
shell: pwsh
run: |
Expand All @@ -80,8 +84,8 @@ jobs:
dotnet build -f netcoreapp3.1 ./src/Playwright.Tests/Playwright.Tests.csproj
- name: Installing Browsers and dependencies...
run: |
dotnet run --project ./src/Playwright/Playwright.csproj -f net5.0 -- install
dotnet run --project ./src/Playwright/Playwright.csproj -f net5.0 -- install-deps
dotnet run --project ./src/Playwright/Playwright.csproj -f net6.0 -- install
dotnet run --project ./src/Playwright/Playwright.csproj -f net6.0 -- install-deps
- name: Running tests...
env:
BROWSER: CHROMIUM
Expand Down
2 changes: 1 addition & 1 deletion src/Playwright.CLI/Playwright.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PackageId>Microsoft.Playwright.CLI</PackageId>
<Summary>The Playwright CLI dotnet tool.</Summary>
<Description>Playwright enables reliable end-to-end testing for modern web apps. It is built to enable cross-browser web automation that is ever-green, capable, reliable and fast. Learn more at https://playwright.dev/dotnet/.</Description>
<TargetFrameworks>net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<DebugSymbols>true</DebugSymbols>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RunWithWarnings>true</RunWithWarnings>
Expand Down
2 changes: 1 addition & 1 deletion src/Playwright.MSTest/Playwright.MSTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Playwright enables reliable end-to-end testing for modern web apps. This package brings in additional helpers
and fixtures to enable using it within MSTest.
</Description>
<TargetFrameworks>netcoreapp3.1;net5.0;net48</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net6.0;net48</TargetFrameworks>
<DebugSymbols>true</DebugSymbols>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RunWithWarnings>true</RunWithWarnings>
Expand Down
2 changes: 1 addition & 1 deletion src/Playwright.NUnit/Playwright.NUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Playwright enables reliable end-to-end testing for modern web apps. This package brings in additional helpers
and fixtures to enable using it within NUnit.
</Description>
<TargetFrameworks>netcoreapp3.1;net5.0;net48</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net6.0;net48</TargetFrameworks>
<DebugSymbols>true</DebugSymbols>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RunWithWarnings>true</RunWithWarnings>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
<OutputType>Library</OutputType>
<ReleaseVersion>0.0.0</ReleaseVersion>
<RootNamespace>Microsoft.Playwright.Tests.TestServer</RootNamespace>
Expand All @@ -24,4 +24,4 @@
<Target Name="CheckWwwRootExists" BeforeTargets="Build">
<Error Text="wwwroot prerequisites are missing. Ensure you've ran `.\build.ps1 wwwroot` from the root of the solution." Condition="!Exists('$(MSBuildProjectDirectory)\wwwroot\background-color.html')" />
</Target>
</Project>
</Project>
2 changes: 1 addition & 1 deletion src/Playwright.Tests/Helpers/JsonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ internal static JsonSerializerOptions GetNewDefaultSerializerOptions()
=> new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
IgnoreNullValues = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IgnoreNullValues is deprecated and now Warns (Error).

Converters =
{
new JsonStringEnumMemberConverter(JsonNamingPolicy.CamelCase),
Expand Down
2 changes: 1 addition & 1 deletion src/Playwright.Tests/NetworkPostDataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public async Task ShouldReturnCorrectPostdataBufferForUtf8Body()

await Task.WhenAll(task, actualTask);

string expectedJsonValue = JsonSerializer.Serialize(value, new()
string expectedJsonValue = JsonSerializer.Serialize(value, new JsonSerializerOptions
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the new() syntax fails because of a new overload to Serialize with 2 arguments.

{
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
WriteIndented = true
Expand Down
4 changes: 2 additions & 2 deletions src/Playwright.Tests/Playwright.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net6.0;</TargetFrameworks>
<IsTestProject>true</IsTestProject>
<ReleaseVersion>0.0.0</ReleaseVersion>
<NoWarn>1701;1702</NoWarn>
Expand All @@ -17,7 +17,7 @@
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="System.CodeDom" Version="5.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
Expand Down
2 changes: 1 addition & 1 deletion src/Playwright.Tests/TracingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private static IReadOnlyList<TraceEventEntry> ParseTrace(string path)
var line = reader.ReadLine();
if (line == null) break;
results.Add(JsonSerializer.Deserialize<TraceEventEntry>(line,
new()
new JsonSerializerOptions
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the new() syntax fails because of a new overload to Serialize with 2 arguments.

{
PropertyNameCaseInsensitive = true,
}));
Expand Down
2 changes: 1 addition & 1 deletion src/Playwright/Helpers/JsonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ internal static JsonSerializerOptions GetNewDefaultSerializerOptions()
=> new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
IgnoreNullValues = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IgnoreNullValues is deprecated and now Warns (Error).

Converters =
{
new JsonStringEnumMemberConverter(JsonNamingPolicy.CamelCase),
Expand Down
2 changes: 1 addition & 1 deletion src/Playwright/Helpers/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ public static Dictionary<string, string> ParseQueryString(this string query)
query = query.Substring(1, query.Length - 1);
}

foreach (string keyValue in query.Split('&').Where(kv => kv.Contains("=")))
foreach (string keyValue in query.Split('&').Where(kv => kv.Contains('=')))
{
string[] pair = keyValue.Split('=');
result[pair[0]] = pair[1];
Expand Down
2 changes: 1 addition & 1 deletion src/Playwright/Playwright.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PackageId>Microsoft.Playwright</PackageId>
<Summary>The .NET port of Playwright, used to automate Chromium, Firefox and WebKit with a single API.</Summary>
<Description>Playwright enables reliable end-to-end testing for modern web apps. It is built to enable cross-browser web automation that is ever-green, capable, reliable and fast. Learn more at https://playwright.dev/dotnet/.</Description>
<TargetFrameworks>netstandard2.0;net5.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<DebugSymbols>true</DebugSymbols>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<DocumentationFile>Microsoft.Playwright.xml</DocumentationFile>
Expand Down
2 changes: 2 additions & 0 deletions src/Playwright/Transport/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ internal async Task<T> SendMessageToServerAsync<T>(
object obj = propertyDescriptor.GetValue(args);
if (obj != null)
{
#pragma warning disable CA1845
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CA1845 is not in the Playwright.ruleset anywhere so I'm just ignoring.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are probably new built-in default rules from the SDK for the .NET 6 analysis level.

string name = propertyDescriptor.Name.Substring(0, 1).ToLower() + propertyDescriptor.Name.Substring(1);
#pragma warning restore CA1845
sanitizedArgs.Add(name, obj);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Playwright/Transport/WebSocketTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public async Task ConnectAsync()

private async Task DispatchIncomingMessagesAsync()
{
#pragma warning disable VSTHRD103
#pragma warning disable VSTHRD103, CA1849
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CA1849 is not in the Playwright.ruleset anywhere so I'm just ignoring.

var buffer = WebSocket.CreateClientBuffer(DefaultBufferSize, DefaultBufferSize);
var memoryStream = new MemoryStream();
string closeReason = string.Empty;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/Playwright.Tooling/Playwright.Tooling.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<CodeAnalysisRuleSet>../../Playwright.ruleset</CodeAnalysisRuleSet>
<ReleaseVersion>0.0.0</ReleaseVersion>
<IsTool>true</IsTool>
Expand Down