-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
chore(playwrighttesting): update public classes, methods and constants as per APIView review #47652
base: main
Are you sure you want to change the base?
Changes from 6 commits
ab6765f
cafb573
3b862e9
a883f49
4b8b31f
47aa940
41d1a1a
b66cddd
dc8b580
1c4e6f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -192,6 +192,7 @@ | |||
<ItemGroup Condition="$(MSBuildProjectName.StartsWith('Azure.Developer.MicrosoftPlaywrightTesting'))"> | ||||
<PackageReference Update="Microsoft.TestPlatform.ObjectModel" Version="17.10.0" /> | ||||
<PackageReference Update="NUnit" Version="3.13.2" /> | ||||
<PackageReference Update="Microsoft.Extensions.Logging" Version="2.0.0" /> | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be 8.x unless there's a reason to not do so. We're in the process of bumping all of the Azure SDK dependencies to the 8.x line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
azure-sdk-for-net/eng/Packages.Data.props Line 104 in f97d3dd
This causes a version mismatch in net6.0
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Async Interfaces package is in the process of being bumped to the 8.x line centrally, along with the remainder of our dependencies. Please either wait for that to complete or bump the necessary dependencies for Playwright. I'd rather not see us use an older set here that will need to be migrated separately. A direct reference to the Async Interfaces packages locally should resolve the conflict in the interim. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
.NET 6 reached end-of-life and is no longer a supported platform. Our test matrices are also in the process of being upgraded to remove 6 and include 9. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Do we add Microsoft.Bcl.AsyncInterfaces in the csproj with version as 8.x? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just rechecked the dotnet build logs, the above were warnings rather than errors. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
You would add the package reference in your .csproj and add a version of 8.x in your Playwright section of the central packages file. That central version will get cleaned up when we complete the repo-wide central version bumps. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To resolve the issue with net6.0, have added the below dependencies in the central package file under the Playwright section.
Also added reference to these packages in our base SDK's .csproj. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. //fyi: @m-redding |
||||
</ItemGroup> | ||||
|
||||
<ItemGroup Condition="$(MSBuildProjectName.Contains('CloudMachine'))"> | ||||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using Microsoft.Extensions.Logging; | ||
using NUnit.Framework; | ||
|
||
namespace Azure.Developer.MicrosoftPlaywrightTesting.NUnit; | ||
|
||
internal class NUnitLogger : ILogger | ||
{ | ||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter) | ||
{ | ||
if (!IsEnabled(logLevel)) | ||
{ | ||
return; | ||
} | ||
if (formatter == null) | ||
{ | ||
throw new ArgumentNullException(nameof(formatter)); | ||
} | ||
string message = formatter(state, exception); | ||
if (exception != null) | ||
{ | ||
message += $"\nException: {exception}"; | ||
} | ||
Log(logLevel, message); | ||
} | ||
|
||
public bool IsEnabled(LogLevel logLevel) | ||
{ | ||
return true; | ||
} | ||
|
||
IDisposable? ILogger.BeginScope<TState>(TState state) | ||
{ | ||
return NullScope.Instance; | ||
} | ||
|
||
private static void Log(LogLevel level, string message) | ||
{ | ||
System.IO.TextWriter writer = (level == LogLevel.Error || level == LogLevel.Warning || level == LogLevel.Critical) ? Console.Error : Console.Out; | ||
writer.WriteLine($"{DateTime.Now} [{level}]: {message}"); | ||
|
||
if (level == LogLevel.Debug) | ||
{ | ||
TestContext.WriteLine($"[MPT-NUnit]: {message}"); | ||
} | ||
else if (level == LogLevel.Error || level == LogLevel.Critical) | ||
{ | ||
TestContext.Error.WriteLine($"[MPT-NUnit]: {message}"); | ||
} | ||
else | ||
{ | ||
TestContext.Progress.WriteLine($"[MPT-NUnit]: {message}"); | ||
} | ||
} | ||
}; | ||
|
||
internal class NullScope : IDisposable | ||
{ | ||
public static readonly NullScope Instance = new(); | ||
|
||
private NullScope() { } | ||
|
||
public void Dispose() | ||
{ | ||
// No operation | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added as per recommendation in APIView review to use Microsoft.Extensions.Logging's ILogger interface. Added the dependency under this condition since it's used only in Extension libraries.