Skip to content

Commit

Permalink
update the sample code in playwrighttesting (#47135)
Browse files Browse the repository at this point in the history
* update the sample code

* changes something in mpg to trigger the mgmt ci

* update snippets
  • Loading branch information
ArcturusZhang authored Nov 13, 2024
1 parent ddfca56 commit ea3e3d3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Create a file `PlaywrightServiceSetup.cs` in the root directory with the below c
```C# Snippet:Sample2_SetDefaultAuthenticationMechanism
using Azure.Developer.MicrosoftPlaywrightTesting.NUnit;

namespace PlaywrightTests; // Remember to change this as per your project namespace
namespace PlaywrightTests.Sample2; // Remember to change this as per your project namespace
[SetUpFixture]
public class PlaywrightServiceSetup : PlaywrightServiceNUnit {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dotnet test --settings .runsettings

This issue only impacts the reporting feature. Currently, the service provides minimal support for the following [Azure Credential types.](https://learn.microsoft.com/dotnet/api/overview/azure/identity-readme?view=azure-dotnet#credential-classes)

Along with this, we also support passing a Managed Identity ClientId to be used along with `DefaultAzureCredential` and `ManagedIdentityCredential`.
Along with this, we also support passing a Managed Identity ClientId to be used along with `DefaultAzureCredential` and `ManagedIdentityCredential`.

If you only want to use cloud-hosted browsers along with your tests, you can disable the reporting feature by removing the logger from the runsettings file and then modify the `PlaywrightServiceSetup.cs` file as per the following.

Expand All @@ -51,7 +51,7 @@ using Azure.Core;
using Azure.Developer.MicrosoftPlaywrightTesting.NUnit;
using Azure.Identity;

namespace PlaywrightTests;
namespace PlaywrightTests.Sample1; // Remember to change this as per your project namespace
[SetUpFixture]
public class PlaywrightServiceSetup : PlaywrightServiceNUnit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This guide will walk you through the steps to integrate your Playwright project
```C# Snippet:Sample2_SetDefaultAuthenticationMechanism
using Azure.Developer.MicrosoftPlaywrightTesting.NUnit;

namespace PlaywrightTests; // Remember to change this as per your project namespace
namespace PlaywrightTests.Sample2; // Remember to change this as per your project namespace
[SetUpFixture]
public class PlaywrightServiceSetup : PlaywrightServiceNUnit {};
Expand Down Expand Up @@ -54,4 +54,4 @@ Run Playwright tests against browsers managed by the service using the configura

```dotnetcli
dotnet test --settings .runsettings
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Azure.Developer.MicrosoftPlaywrightTesting.NUnit;
using Azure.Identity;

namespace PlaywrightTests;
namespace PlaywrightTests.Sample1; // Remember to change this as per your project namespace

[SetUpFixture]
#if SNIPPET
Expand All @@ -23,4 +23,4 @@ public PlaywrightServiceSetup() : base(managedIdentityCredential) {}
public Sample1ServiceSetup() : base(managedIdentityCredential) {}
#endif
}
#endregion
#endregion
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#region Snippet:Sample2_SetDefaultAuthenticationMechanism
using Azure.Developer.MicrosoftPlaywrightTesting.NUnit;

namespace PlaywrightTests; // Remember to change this as per your project namespace
namespace PlaywrightTests.Sample2; // Remember to change this as per your project namespace

[SetUpFixture]
#if SNIPPET
public class PlaywrightServiceSetup : PlaywrightServiceNUnit {};
#else
public class Sample2ServiceSetup : PlaywrightServiceNUnit { };
#endif
#endregion
#endregion
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ skip-csproj: true
modelerfour:
flatten-payloads: false
use-model-reader-writer: true
use-write-core: true

#mgmt-debug:
# show-serialized-names: true
Expand Down

0 comments on commit ea3e3d3

Please sign in to comment.