diff --git a/TUnit.Playwright/ContextTest.cs b/TUnit.Playwright/ContextTest.cs index 8488a869c3..b13214b840 100644 --- a/TUnit.Playwright/ContextTest.cs +++ b/TUnit.Playwright/ContextTest.cs @@ -5,15 +5,19 @@ namespace TUnit.Playwright; public class ContextTest : BrowserTest { + public ContextTest() + { + } + + public ContextTest(BrowserTypeLaunchOptions options) : base(options) + { + } + public IBrowserContext Context { get; private set; } = null!; public virtual BrowserNewContextOptions ContextOptions(TestContext testContext) { - return new() - { - Locale = "en-US", - ColorScheme = ColorScheme.Light, - }; + return new() { Locale = "en-US", ColorScheme = ColorScheme.Light, }; } [Before(HookType.Test, "", 0)] @@ -23,7 +27,7 @@ public async Task ContextSetup(TestContext testContext) { throw new InvalidOperationException($"Browser is not initialized. This may indicate that {nameof(BrowserTest)}.{nameof(BrowserSetup)} did not execute properly."); } - + Context = await NewContext(ContextOptions(testContext)).ConfigureAwait(false); } } diff --git a/TUnit.Playwright/PageTest.cs b/TUnit.Playwright/PageTest.cs index 61ed2aa017..add48b96f3 100644 --- a/TUnit.Playwright/PageTest.cs +++ b/TUnit.Playwright/PageTest.cs @@ -5,6 +5,14 @@ namespace TUnit.Playwright; public class PageTest : ContextTest { + public PageTest() + { + } + + public PageTest(BrowserTypeLaunchOptions options) : base(options) + { + } + public IPage Page { get; private set; } = null!; [Before(HookType.Test, "", 0)] @@ -14,7 +22,7 @@ public async Task PageSetup() { throw new InvalidOperationException($"Browser context is not initialized. This may indicate that {nameof(ContextTest)}.{nameof(ContextSetup)} did not execute properly."); } - + Page = await Context.NewPageAsync().ConfigureAwait(false); } } diff --git a/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet10_0.verified.txt b/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet10_0.verified.txt index 83be6f8f35..bbc3fac63d 100644 --- a/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet10_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet10_0.verified.txt @@ -15,6 +15,7 @@ namespace public class ContextTest : .BrowserTest { public ContextTest() { } + public ContextTest(.BrowserTypeLaunchOptions options) { } public .IBrowserContext Context { get; } public virtual .BrowserNewContextOptions ContextOptions(.TestContext testContext) { } [.Before(., "", 0)] @@ -33,6 +34,7 @@ namespace public class PageTest : .ContextTest { public PageTest() { } + public PageTest(.BrowserTypeLaunchOptions options) { } public .IPage Page { get; } [.Before(., "", 0)] public . PageSetup() { } diff --git a/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet8_0.verified.txt b/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet8_0.verified.txt index ab2d72850c..359fa1d581 100644 --- a/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet8_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet8_0.verified.txt @@ -15,6 +15,7 @@ namespace public class ContextTest : .BrowserTest { public ContextTest() { } + public ContextTest(.BrowserTypeLaunchOptions options) { } public .IBrowserContext Context { get; } public virtual .BrowserNewContextOptions ContextOptions(.TestContext testContext) { } [.Before(., "", 0)] @@ -33,6 +34,7 @@ namespace public class PageTest : .ContextTest { public PageTest() { } + public PageTest(.BrowserTypeLaunchOptions options) { } public .IPage Page { get; } [.Before(., "", 0)] public . PageSetup() { } diff --git a/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet9_0.verified.txt b/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet9_0.verified.txt index 1455bbb755..11aa4b50d2 100644 --- a/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet9_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet9_0.verified.txt @@ -15,6 +15,7 @@ namespace public class ContextTest : .BrowserTest { public ContextTest() { } + public ContextTest(.BrowserTypeLaunchOptions options) { } public .IBrowserContext Context { get; } public virtual .BrowserNewContextOptions ContextOptions(.TestContext testContext) { } [.Before(., "", 0)] @@ -33,6 +34,7 @@ namespace public class PageTest : .ContextTest { public PageTest() { } + public PageTest(.BrowserTypeLaunchOptions options) { } public .IPage Page { get; } [.Before(., "", 0)] public . PageSetup() { }