Skip to content

Commit 3129207

Browse files
authored
Upgrade Playwright (#38414)
* Upgrade `playwright-sharp-tool` https://www.nuget.org/packages/playwright-sharp-tool Contributes towards #30882. * Update to latest v1.16.1 from GitHub https://github.com/microsoft/playwright-dotnet/releases/tag/v1.16.1 * Update to use Microsoft.Playwright * Update references to reflect `Microsoft.Playwright` * Update dotnet-tools.json * Upgrade System.CommandLine * Adapt to breaking API changes in Playwright * Upgrade dotnet-serve * Add Microsoft.Playwright.CLI * Revert "Upgrade System.CommandLine" This reverts commit cc46e9c. * Fix build The build failed. Fix the build errors and run again. C:\h\w\AA180980\w\9ED808A4\e\RunTests\RunTests.csproj : warning NU1604: Project dependency Microsoft.Playwright does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. C:\h\w\AA180980\w\9ED808A4\e\RunTests\TestRunner.cs(124,35): error CS7036: There is no argument given that corresponds to the required formal parameter 'arguments' of 'ProcessUtil.RunAsync(string, string, string?, string?, bool, IDictionary<string, string?>?, Action<string>?, Action<string>?, Action<int>?, CancellationToken)' [C:\h\w\AA180980\w\9ED808A4\e\RunTests\RunTests.csproj] * Remove semaphore for websocket events * Update playwrightSettings based on breaking changes * npx based playwright install * npm install playwright * Install node in helix env * Use DOTNET_ROLL_FORWARD with `dotnet` `playwright` tool * Cleanup * Update playwright tool usage * DOTNET_ROLL_FORWARD in TestRunner * Specify project dir * Playwright install without cli * Update TestRunner.cs * Update TestRunner.cs * Re-enable helix playwright tests * Upgrade Playwright to 1.17.3, CLI to 1.2.2 * Fix spacing * Remove DOTNET_ROLL_FORWARD * PR Feedback * Remove temp project workaround. * Fix package lowerbound issue * Update Versions.props * Update BrowserManager.cs * Remove `Installing Microsoft.Playwright.CLI` * Disable playwright tests in helix
1 parent b4dc215 commit 3129207

19 files changed

+158
-181
lines changed

.config/dotnet-tools.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"isRoot": true,
44
"tools": {
55
"dotnet-serve": {
6-
"version": "1.7.139",
6+
"version": "1.8.15",
77
"commands": [
88
"dotnet-serve"
99
]
1010
},
11-
"playwright-sharp-tool": {
12-
"version": "0.170.2",
11+
"Microsoft.Playwright.CLI": {
12+
"version": "1.2.2",
1313
"commands": [
14-
"playwright-sharp"
14+
"playwright"
1515
]
1616
}
1717
}

eng/Dependencies.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ and are generated based on the last package release.
192192
<LatestPackageReference Include="NuGet.Frameworks" />
193193
<LatestPackageReference Include="NuGet.Versioning" />
194194
<LatestPackageReference Include="Photino.NET" />
195-
<LatestPackageReference Include="PlaywrightSharp" />
195+
<LatestPackageReference Include="Microsoft.Playwright" />
196196
<LatestPackageReference Include="Polly" />
197197
<LatestPackageReference Include="Polly.Extensions.Http" />
198198
<LatestPackageReference Include="Selenium.Support" />

eng/Versions.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
<NewtonsoftJsonVersion>13.0.1</NewtonsoftJsonVersion>
261261
<NSwagApiDescriptionClientVersion>13.0.4</NSwagApiDescriptionClientVersion>
262262
<PhotinoNETVersion>1.1.6</PhotinoNETVersion>
263-
<PlaywrightSharpVersion>0.192.0</PlaywrightSharpVersion>
263+
<MicrosoftPlaywrightVersion>1.17.3</MicrosoftPlaywrightVersion>
264264
<PollyExtensionsHttpVersion>3.0.0</PollyExtensionsHttpVersion>
265265
<PollyVersion>7.2.2</PollyVersion>
266266
<SeleniumSupportVersion>4.1.0</SeleniumSupportVersion>

eng/helix/content/RunTests/RunTests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88

99
<ItemGroup>
1010
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20158.1" />
11-
<PackageReference Condition=" '$(InstallPlaywright)' == 'true' " Include="PlaywrightSharp" Version="0.192.0" />
11+
<PackageReference Condition=" '$(InstallPlaywright)' == 'true' " Include="Microsoft.Playwright" Version="1.17.3" />
1212
</ItemGroup>
1313
</Project>

eng/helix/content/RunTests/TestRunner.cs

+5-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using System.Threading;
1010
using System.Threading.Tasks;
1111
#if INSTALLPLAYWRIGHT
12-
using PlaywrightSharp;
12+
using Microsoft.Playwright;
1313
#endif
1414

1515
namespace RunTests
@@ -55,9 +55,6 @@ public bool SetupEnvironment()
5555
var playwrightBrowsers = Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH");
5656
Console.WriteLine($"Setting PLAYWRIGHT_BROWSERS_PATH: {playwrightBrowsers}");
5757
EnvironmentVariables.Add("PLAYWRIGHT_BROWSERS_PATH", playwrightBrowsers);
58-
var playrightDriver = Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH");
59-
Console.WriteLine($"Setting PLAYWRIGHT_DRIVER_PATH: {playrightDriver}");
60-
EnvironmentVariables.Add("PLAYWRIGHT_DRIVER_PATH", playrightDriver);
6158
#else
6259
Console.WriteLine($"Skipping setting PLAYWRIGHT_BROWSERS_PATH");
6360
#endif
@@ -112,8 +109,10 @@ public async Task<bool> InstallPlaywrightAsync()
112109
{
113110
try
114111
{
115-
Console.WriteLine($"Installing Playwright to Browsers: {Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH")} Driver: {Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH")}");
116-
await Playwright.InstallAsync(Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH"), Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH"));
112+
Console.WriteLine($"Installing Playwright Browsers to {Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH")}");
113+
114+
var exitCode = Microsoft.Playwright.Program.Main(new[] { "install" });
115+
117116
DisplayContents(Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH"));
118117
return true;
119118
}

eng/helix/content/runtests.cmd

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
1616
set DOTNET_MULTILEVEL_LOOKUP=0
1717
set InstallPlaywright=%$installPlaywright%
1818
set PLAYWRIGHT_BROWSERS_PATH=%CD%\ms-playwright
19-
set PLAYWRIGHT_DRIVER_PATH=%CD%\.playwright\win-x64\native\playwright.cmd
2019

2120
set "PATH=%HELIX_WORKITEM_ROOT%;%PATH%;%HELIX_WORKITEM_ROOT%\node\bin"
2221
echo Set path to: "%PATH%"

eng/helix/content/runtests.sh

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export PATH="$PATH:$DIR:$DIR/node/bin"
1818
# Set playwright stuff
1919
export PLAYWRIGHT_BROWSERS_PATH="$DIR/ms-playwright"
2020
if [[ "$helixQueue" == *"OSX"* ]]; then
21-
export PLAYWRIGHT_DRIVER_PATH="$DIR/.playwright/osx/native/playwright.sh"
2221
PLAYWRIGHT_NODE_PATH=$DIR/.playwright/osx/native/node
2322
else
2423
export PLAYWRIGHT_DRIVER_PATH="$DIR/.playwright/unix/native/playwright.sh"

src/ProjectTemplates/BlazorTemplates.Tests/BlazorServerTemplateTest.cs

+20-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using System.Threading.Tasks;
99
using Microsoft.AspNetCore.BrowserTesting;
1010
using Microsoft.AspNetCore.Testing;
11-
using PlaywrightSharp;
11+
using Microsoft.Playwright;
1212
using ProjectTemplates.Tests.Infrastructure;
1313
using Templates.Test.Helpers;
1414
using Xunit;
@@ -136,20 +136,31 @@ public async Task BlazorServerTemplateWorks_IndividualAuth(BrowserKind browserKi
136136

137137
private async Task TestBasicNavigation(Project project, IPage page)
138138
{
139-
var socket = BrowserContextInfo.Pages[page].WebSockets.SingleOrDefault() ??
140-
(await page.WaitForEventAsync(PageEvent.WebSocket)).WebSocket;
139+
var socket = await page.WaitForWebSocketAsync();
140+
141+
var framesReceived = 0;
142+
var framesSent = 0;
143+
144+
void FrameReceived(object sender, IWebSocketFrame frame) { framesReceived++; }
145+
void FrameSent(object sender, IWebSocketFrame frame) { framesSent++; }
146+
147+
socket.FrameReceived += FrameReceived;
148+
socket.FrameSent += FrameSent;
141149

142150
// Receive render batch
143-
await socket.WaitForEventAsync(WebSocketEvent.FrameReceived);
144-
await socket.WaitForEventAsync(WebSocketEvent.FrameSent);
151+
await page.WaitForWebSocketAsync(new() { Predicate = (s) => framesReceived == 1 });
152+
await page.WaitForWebSocketAsync(new() { Predicate = (s) => framesSent == 1 });
145153

146154
// JS interop call to intercept navigation
147-
await socket.WaitForEventAsync(WebSocketEvent.FrameReceived);
148-
await socket.WaitForEventAsync(WebSocketEvent.FrameSent);
155+
await page.WaitForWebSocketAsync(new() { Predicate = (s) => framesReceived == 2 });
156+
await page.WaitForWebSocketAsync(new() { Predicate = (s) => framesSent == 2 });
157+
158+
socket.FrameReceived -= FrameReceived;
159+
socket.FrameSent -= FrameSent;
149160

150161
await page.WaitForSelectorAsync("nav");
151162
// <title> element gets project ID injected into it during template execution
152-
Assert.Equal("Index", (await page.GetTitleAsync()).Trim());
163+
Assert.Equal("Index", (await page.TitleAsync()).Trim());
153164

154165
// Initially displays the home page
155166
await page.WaitForSelectorAsync("h1 >> text=Hello, world!");
@@ -168,7 +179,7 @@ private async Task TestBasicNavigation(Project project, IPage page)
168179

169180
// Asynchronously loads and displays the table of weather forecasts
170181
await page.WaitForSelectorAsync("table>tbody>tr");
171-
Assert.Equal(5, (await page.QuerySelectorAllAsync("p+table>tbody>tr")).Count());
182+
Assert.Equal(5, await page.Locator("p+table>tbody>tr").CountAsync());
172183
}
173184

174185
[Theory]

src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<!-- https://github.com/dotnet/aspnetcore/issues/38818 -->
1313
<BuildHelixPayload>false</BuildHelixPayload>
14-
14+
1515
<!-- Properties that affect test runs -->
1616
<!-- TestTemplateCreationFolder is the folder where the templates will be created. Will point out to $(OutputDir)$(TestTemplateCreationFolder) -->
1717
<TestTemplateCreationFolder>TestTemplates\</TestTemplateCreationFolder>
@@ -47,8 +47,8 @@
4747
<Reference Include="Microsoft.Extensions.Configuration.Json" />
4848
<Reference Include="AngleSharp" />
4949
<Reference Include="System.Net.Http" />
50-
<Reference Include="PlaywrightSharp" Condition="'$(IsPlaywrightAvailable)' == 'true'" />
51-
<Reference Include="PlaywrightSharp" ExcludeAssets="build" Condition="'$(IsPlaywrightAvailable)' != 'true'" />
50+
<Reference Include="Microsoft.Playwright" Condition="'$(IsPlaywrightAvailable)' == 'true'" />
51+
<Reference Include="Microsoft.Playwright" ExcludeAssets="build" Condition="'$(IsPlaywrightAvailable)' != 'true'" />
5252
<ProjectReference Include="$(RepoRoot)src\Framework\App.Runtime\src\Microsoft.AspNetCore.App.Runtime.csproj"
5353
Private="false"
5454
ReferenceOutputAssembly="false"

src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs

+16-16
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
using Microsoft.AspNetCore.Testing;
1212
using Microsoft.Extensions.CommandLineUtils;
1313
using Newtonsoft.Json.Linq;
14-
using PlaywrightSharp;
14+
using Microsoft.Playwright;
1515
using Templates.Test.Helpers;
1616

1717
namespace BlazorTemplates.Tests;
@@ -56,7 +56,7 @@ public async Task BlazorWasmStandaloneTemplate_Works(BrowserKind browserKind)
5656
private static async Task<IPage> NavigateToPage(IBrowserContext browser, string listeningUri)
5757
{
5858
var page = await browser.NewPageAsync();
59-
await page.GoToAsync(listeningUri, LifecycleEvent.Networkidle);
59+
await page.GotoAsync(listeningUri, new() { WaitUntil = WaitUntilState.NetworkIdle });
6060
return page;
6161
}
6262

@@ -133,9 +133,9 @@ public async Task BlazorWasmStandalonePwaTemplate_Works(BrowserKind browserKind)
133133

134134
// The PWA template supports offline use. By now, the browser should have cached everything it needs,
135135
// so we can continue working even without the server.
136-
await page.GoToAsync("about:blank");
136+
await page.GotoAsync("about:blank");
137137
await browser.SetOfflineAsync(true);
138-
await page.GoToAsync(listeningUri);
138+
await page.GotoAsync(listeningUri);
139139
await TestBasicNavigation(project.ProjectName, page, skipFetchData: true);
140140
await page.CloseAsync();
141141
}
@@ -181,9 +181,9 @@ public async Task BlazorWasmHostedPwaTemplate_Works(BrowserKind browserKind)
181181
// The PWA template supports offline use. By now, the browser should have cached everything it needs,
182182
// so we can continue working even without the server.
183183
// Since this is the hosted project, backend APIs won't work offline, so we need to skip "fetchdata"
184-
await page.GoToAsync("about:blank");
184+
await page.GotoAsync("about:blank");
185185
await browser.SetOfflineAsync(true);
186-
await page.GoToAsync(listeningUri);
186+
await page.GotoAsync(listeningUri);
187187
await TestBasicNavigation(project.ProjectName, page, skipFetchData: true);
188188
await page.CloseAsync();
189189
}
@@ -416,11 +416,11 @@ private static async Task TestBasicNavigation(string appName, IPage page, bool u
416416
// Initially displays the home page
417417
await page.WaitForSelectorAsync("h1 >> text=Hello, world!");
418418

419-
Assert.Equal("Index", (await page.GetTitleAsync()).Trim());
419+
Assert.Equal("Index", (await page.TitleAsync()).Trim());
420420

421421
// Can navigate to the counter page
422422
await Task.WhenAll(
423-
page.WaitForNavigationAsync("**/counter"),
423+
page.WaitForNavigationAsync(new() { UrlString = "**/counter" }),
424424
page.WaitForSelectorAsync("h1 >> text=Counter"),
425425
page.WaitForSelectorAsync("p >> text=Current count: 0"),
426426
page.ClickAsync("a[href=counter]"));
@@ -433,12 +433,12 @@ await Task.WhenAll(
433433
if (usesAuth)
434434
{
435435
await Task.WhenAll(
436-
page.WaitForNavigationAsync("**/Identity/Account/Login**", LifecycleEvent.Networkidle),
436+
page.WaitForNavigationAsync(new() { UrlString = "**/Identity/Account/Login**", WaitUntil = WaitUntilState.NetworkIdle }),
437437
page.ClickAsync("text=Log in"));
438438

439439
await Task.WhenAll(
440440
page.WaitForSelectorAsync("[name=\"Input.Email\"]"),
441-
page.WaitForNavigationAsync("**/Identity/Account/Register**", LifecycleEvent.Networkidle),
441+
page.WaitForNavigationAsync(new() { UrlString = "**/Identity/Account/Register**", WaitUntil = WaitUntilState.NetworkIdle }),
442442
page.ClickAsync("text=Register as a new user"));
443443

444444
var userName = $"{Guid.NewGuid()}@example.com";
@@ -450,12 +450,12 @@ await Task.WhenAll(
450450

451451
// We will be redirected to the RegisterConfirmation
452452
await Task.WhenAll(
453-
page.WaitForNavigationAsync("**/Identity/Account/RegisterConfirmation**", LifecycleEvent.Networkidle),
453+
page.WaitForNavigationAsync(new() { UrlString = "**/Identity/Account/RegisterConfirmation**", WaitUntil = WaitUntilState.NetworkIdle }),
454454
page.ClickAsync("#registerSubmit"));
455455

456456
// We will be redirected to the ConfirmEmail
457457
await Task.WhenAll(
458-
page.WaitForNavigationAsync("**/Identity/Account/ConfirmEmail**", LifecycleEvent.Networkidle),
458+
page.WaitForNavigationAsync(new() { UrlString = "**/Identity/Account/ConfirmEmail**", WaitUntil = WaitUntilState.NetworkIdle }),
459459
page.ClickAsync("text=Click here to confirm your account"));
460460

461461
// Now we can login
@@ -466,21 +466,21 @@ await Task.WhenAll(
466466
await page.ClickAsync("#login-submit");
467467

468468
// Need to navigate to fetch page
469-
await page.GoToAsync(new Uri(page.Url).GetLeftPart(UriPartial.Authority));
470-
Assert.Equal(appName.Trim(), (await page.GetTitleAsync()).Trim());
469+
await page.GotoAsync(new Uri(page.Url).GetLeftPart(UriPartial.Authority));
470+
Assert.Equal(appName.Trim(), (await page.TitleAsync()).Trim());
471471
}
472472

473473
if (!skipFetchData)
474474
{
475475
// Can navigate to the 'fetch data' page
476476
await Task.WhenAll(
477-
page.WaitForNavigationAsync("**/fetchdata"),
477+
page.WaitForNavigationAsync(new() { UrlString = "**/fetchdata" }),
478478
page.WaitForSelectorAsync("h1 >> text=Weather forecast"),
479479
page.ClickAsync("text=Fetch data"));
480480

481481
// Asynchronously loads and displays the table of weather forecasts
482482
await page.WaitForSelectorAsync("table>tbody>tr");
483-
Assert.Equal(5, (await page.QuerySelectorAllAsync("p+table>tbody>tr")).Count());
483+
Assert.Equal(5, await page.Locator("p+table>tbody>tr").CountAsync());
484484
}
485485
}
486486

src/ProjectTemplates/BlazorTemplates.Tests/playwrightSettings.json

+3-12
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,18 @@
44
"BaseArtifactsFolder": ".",
55
"GlobalBrowserOptions": {
66
"ChromiumSandbox": true,
7-
"DumpIO": true,
8-
"IgnoreHTTPSErrors": true,
97
"Headless": true,
108
"Timeout": 30000
119
},
1210
"GlobalContextOptions": {
13-
"RecordVideo": {
14-
"Dir": "videos"
15-
},
16-
"RecordHar": {
17-
"Path": "har"
18-
},
11+
"RecordVideoDir": "videos",
12+
"RecordHarPath": "har",
1913
"IgnoreHTTPSErrors": true
2014
},
2115
"BrowserOptions": {
2216
"Chromium": {
2317
"BrowserKind": "Chromium",
24-
"IsEnabled": true,
25-
"Args": {
26-
"--ignore-certificate-errors": true
27-
}
18+
"IsEnabled": true
2819
},
2920
"Firefox": {
3021
"BrowserKind": "Firefox",

src/ProjectTemplates/Shared/AspNetProcess.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
using Microsoft.Extensions.CommandLineUtils;
1818
using Microsoft.Extensions.Logging;
1919
using Microsoft.Extensions.Logging.Abstractions;
20-
using PlaywrightSharp;
20+
using Microsoft.Playwright;
2121
using Xunit;
2222
using Xunit.Abstractions;
2323

@@ -109,7 +109,7 @@ public AspNetProcess(
109109
public async Task VisitInBrowserAsync(IPage page)
110110
{
111111
_output.WriteLine($"Opening browser at {ListeningUri}...");
112-
await page.GoToAsync(ListeningUri.AbsoluteUri);
112+
await page.GotoAsync(ListeningUri.AbsoluteUri);
113113
}
114114

115115

src/Shared/BrowserTesting/src/BrowserManager.cs

+7-14
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using System.Threading.Tasks;
1010
using Microsoft.Extensions.Configuration;
1111
using Microsoft.Extensions.Logging;
12-
using PlaywrightSharp;
12+
using Microsoft.Playwright;
1313

1414
namespace Microsoft.AspNetCore.BrowserTesting;
1515

@@ -47,20 +47,12 @@ private async Task InitializeAsync()
4747

4848
async Task InitializeCore()
4949
{
50-
var driverPath = Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH");
51-
if (!string.IsNullOrEmpty(driverPath))
52-
{
53-
Playwright = await PlaywrightSharp.Playwright.CreateAsync(_loggerFactory, driverExecutablePath: driverPath, debug: "pw:api");
54-
}
55-
else
56-
{
57-
Playwright = await PlaywrightSharp.Playwright.CreateAsync(_loggerFactory, debug: "pw:api");
58-
}
50+
Playwright = await Microsoft.Playwright.Playwright.CreateAsync();
5951
foreach (var (browserName, options) in _browserManagerConfiguration.BrowserOptions)
6052
{
6153
if (!_launchBrowsers.ContainsKey(browserName))
6254
{
63-
var effectiveLaunchOptions = _browserManagerConfiguration.GetLaunchOptions(options.BrowserLaunchOptions);
55+
var effectiveLaunchOptions = _browserManagerConfiguration.GetBrowserTypeLaunchOptions(options.BrowserLaunchOptions);
6456

6557
var browser = options.BrowserKind switch
6658
{
@@ -108,10 +100,10 @@ public Task<IBrowserContext> GetBrowserInstance(string browserInstance, string c
108100
contextInfo);
109101
}
110102

111-
public Task<IBrowserContext> GetBrowserInstance(BrowserKind browserInstance, string contextName, BrowserContextOptions options, ContextInformation contextInfo) =>
103+
public Task<IBrowserContext> GetBrowserInstance(BrowserKind browserInstance, string contextName, BrowserNewContextOptions options, ContextInformation contextInfo) =>
112104
GetBrowserInstance(browserInstance.ToString(), contextName, options, contextInfo);
113105

114-
public Task<IBrowserContext> GetBrowserInstance(string browserInstance, string contextName, BrowserContextOptions options, ContextInformation contextInfo)
106+
public Task<IBrowserContext> GetBrowserInstance(string browserInstance, string contextName, BrowserNewContextOptions options, ContextInformation contextInfo)
115107
{
116108
if (_launchBrowsers.TryGetValue(browserInstance, out var browser))
117109
{
@@ -126,9 +118,10 @@ public Task<IBrowserContext> GetBrowserInstance(string browserInstance, string c
126118
private async Task<IBrowserContext> AttachContextInfo(Task<IBrowserContext> browserContextTask, ContextInformation contextInfo)
127119
{
128120
var context = await browserContextTask;
129-
context.DefaultTimeout = HasFailedTests ?
121+
var defaultTimeout = HasFailedTests ?
130122
_browserManagerConfiguration.TimeoutAfterFirstFailureInMilliseconds :
131123
_browserManagerConfiguration.TimeoutInMilliseconds;
124+
context.SetDefaultTimeout(defaultTimeout);
132125

133126
contextInfo.Attach(context);
134127
return context;

0 commit comments

Comments
 (0)