Skip to content

Commit 5ed9631

Browse files
committed
chore: migrate from TimeoutAttribute to CancelAfterAttribute
1 parent 8af2579 commit 5ed9631

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/Playwright.Tests/Attributes/PlaywrightTestAttribute.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@
2828

2929
// Run all tests in sequence
3030
[assembly: LevelOfParallelism(1)]
31+
[assembly: Parallelizable(ParallelScope.Fixtures)]
3132

3233
namespace Microsoft.Playwright.Tests;
3334

3435
/// <summary>
3536
/// Enables decorating test facts with information about the corresponding test in the upstream repository.
3637
/// </summary>
3738
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
38-
public class PlaywrightTestAttribute : TestAttribute, IWrapSetUpTearDown
39+
public class PlaywrightTestAttribute : CancelAfterAttribute, IWrapSetUpTearDown
3940
{
40-
public PlaywrightTestAttribute()
41+
public PlaywrightTestAttribute() : base(TestConstants.DefaultTestTimeout)
4142
{
4243
}
4344

@@ -46,7 +47,7 @@ public PlaywrightTestAttribute()
4647
/// </summary>
4748
/// <param name="fileName"><see cref="FileName"/></param>
4849
/// <param name="nameOfTest"><see cref="TestName"/></param>
49-
public PlaywrightTestAttribute(string fileName, string nameOfTest)
50+
public PlaywrightTestAttribute(string fileName, string nameOfTest) : base(TestConstants.DefaultTestTimeout)
5051
{
5152
FileName = fileName;
5253
TestName = nameOfTest;

src/Playwright.Tests/PageEvaluateTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,8 @@ private enum TestEnum
709709
Test = 1
710710
}
711711

712-
[PlaywrightTest(Description = "https://github.com/microsoft/playwright-dotnet/issues/1706")]
712+
// See https://github.com/microsoft/playwright-dotnet/issues/1706
713+
[PlaywrightTest]
713714
public async Task ShouldNotReturnDisposedJsonElement()
714715
{
715716
var result = await Page.EvaluateAsync<JsonElement?>("()=> [{a:1,b:2},{a:1,b:2}]");

src/Playwright.Tests/TestConstants.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525

2626
using System.Runtime.InteropServices;
2727

28-
[assembly: NUnit.Framework.Timeout(Microsoft.Playwright.Tests.TestConstants.DefaultTestTimeout)]
29-
[assembly: NUnit.Framework.Parallelizable(NUnit.Framework.ParallelScope.Fixtures)]
30-
3128
namespace Microsoft.Playwright.Tests;
3229

3330
internal static class TestConstants

0 commit comments

Comments
 (0)