Skip to content

Commit

Permalink
chore: roll driver to 1.41.0-beta (#2821)
Browse files Browse the repository at this point in the history
Reference #2772
  • Loading branch information
yury-s authored Jan 16, 2024
1 parent 0f0726f commit 581450c
Show file tree
Hide file tree
Showing 41 changed files with 1,202 additions and 105 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->120.0.6099.56<!-- GEN:stop --> ||||
| Chromium <!-- GEN:chromium-version -->121.0.6167.57<!-- GEN:stop --> ||||
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->119.0<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->121.0<!-- GEN:stop --> ||||

Playwright for .NET is the official language port of [Playwright](https://playwright.dev), the library to automate [Chromium](https://www.chromium.org/Home), [Firefox](https://www.mozilla.org/en-US/firefox/new/) and [WebKit](https://webkit.org/) with a single API. Playwright is built to enable cross-browser web automation that is **ever-green**, **capable**, **reliable** and **fast**.

Expand Down
2 changes: 1 addition & 1 deletion src/Common/Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyVersion>1.40.0</AssemblyVersion>
<PackageVersion>$(AssemblyVersion)</PackageVersion>
<DriverVersion>1.40.0</DriverVersion>
<DriverVersion>1.41.0-beta-1705092460000</DriverVersion>
<ReleaseVersion>$(AssemblyVersion)</ReleaseVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<NoDefaultExcludes>true</NoDefaultExcludes>
Expand Down
25 changes: 25 additions & 0 deletions src/Playwright.Tests/BrowserContextRouteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,29 @@ await context.RouteAsync("**/empty.html", (route) =>
await page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<int>() { 3, 2, 1 }, interceped);
}

[PlaywrightTest("browsercontext-route.spec.ts", "should work if handler with times parameter was removed from another handler")]
public async Task ShouldWorkIfHandlerWithTimesParameterWasRemovedFromAnotherHandler()
{
await using var context = await Browser.NewContextAsync();
var page = await context.NewPageAsync();
var intercepted = new List<string>();
async Task handler(IRoute route)

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / Test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / Test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 366 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
intercepted.Add("first");
route.ContinueAsync();

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / Test

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / Test

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 369 in src/Playwright.Tests/BrowserContextRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
};
await context.RouteAsync("**/*", handler, new() { Times = 1 });
await context.RouteAsync("**/*", async (route) =>
{
intercepted.Add("second");
await context.UnrouteAsync("**/*", handler);
await route.FallbackAsync();
});
await page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<string>() { "second" }, intercepted);
intercepted.Clear();
await page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<string>() { "second" }, intercepted);
}
}
28 changes: 4 additions & 24 deletions src/Playwright.Tests/PageKeyboardTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ await Page.EvaluateAsync<string>(@"() => {
window.keyPromise = new Promise(resolve => document.addEventListener('keydown', event => resolve(event.key)));
}");
await Page.Keyboard.PressAsync("Meta");
Assert.AreEqual(TestConstants.IsFirefox && !TestConstants.IsMacOSX ? "OS" : "Meta", await Page.EvaluateAsync<string>("keyPromise"));
Assert.AreEqual("Meta", await Page.EvaluateAsync<string>("keyPromise"));
}

[PlaywrightTest("page-keyboard.spec.ts", "should move with the arrow keys")]
Expand Down Expand Up @@ -466,29 +466,9 @@ public async Task ShouldPressTheMetaKey2()
string key = result.key;
string code = result.code;
bool metaKey = result.metaKey;

if (TestConstants.IsFirefox && !TestConstants.IsMacOSX)
{
Assert.AreEqual("OS", key);
}
else
{
Assert.AreEqual("Meta", key);
}

if (TestConstants.IsFirefox)
{
Assert.AreEqual("MetaLeft", code);
}

if (TestConstants.IsFirefox && !TestConstants.IsMacOSX)
{
Assert.False(metaKey);
}
else
{
Assert.True(metaKey);
}
Assert.AreEqual("Meta", key);
Assert.AreEqual("MetaLeft", code);
Assert.True(metaKey);
}

[PlaywrightTest("page-keyboard.spec.ts", "should work after a cross origin navigation")]
Expand Down
16 changes: 0 additions & 16 deletions src/Playwright.Tests/PageNetworkResponseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,20 +331,4 @@ public async Task ShouldReportIfRequestWasFromServiceWorker()
Assert.True(res.FromServiceWorker);
}
}

[PlaywrightTest("", "should collect stale handles")]
public async Task ShouldCollectStaleHandels()
{
Page.Request += (sender, request) => { };
var response = await Page.GotoAsync(Server.EmptyPage);
for (var i = 0; i < 1000; i++)
{
await Page.EvaluateAsync(@"async () => {
const response = await fetch('/');
await response.text();
}");
}
var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(async () => await response.AllHeadersAsync());
StringAssert.Contains("The object has been collected to prevent unbounded heap growth.", exception.Message);
}
}
23 changes: 23 additions & 0 deletions src/Playwright.Tests/PageRouteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -766,4 +766,27 @@ await page.RouteAsync("**/empty.html", (route) =>
await page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<int>() { 3, 2, 1 }, interceped);
}

[PlaywrightTest("page-route.spec.ts", "should work if handler with times parameter was removed from another handler")]
public async Task ShouldWorkIfHandlerWithTimesParameterWasRemovedFromAnotherHandler()
{
var intercepted = new List<string>();
async Task handler(IRoute route)

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / Test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / Test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/ubuntu-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/windows-latest

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 774 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/macos-12

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
intercepted.Add("first");
route.ContinueAsync();

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / Test

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / Test

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / chromium/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/ubuntu-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/windows-latest

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / webkit/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 777 in src/Playwright.Tests/PageRouteTests.cs

View workflow job for this annotation

GitHub Actions / firefox/macos-12

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
};
await Page.RouteAsync("**/*", handler, new() { Times = 1 });
await Page.RouteAsync("**/*", async (route) =>
{
intercepted.Add("second");
await Page.UnrouteAsync("**/*", handler);
await route.FallbackAsync();
});
await Page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<string>() { "second" }, intercepted);
intercepted.Clear();
await Page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<string>() { "second" }, intercepted);
}
}
28 changes: 28 additions & 0 deletions src/Playwright.Tests/PageScreenshotTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,4 +447,32 @@ public async Task PathOptionShouldThrowForUnsupportedMimeType()
var exception = await PlaywrightAssert.ThrowsAsync<ArgumentException>(() => Page.ScreenshotAsync(new() { Path = "file.txt" }));
StringAssert.Contains("path: unsupported mime type \"text/plain\"", exception.Message);
}

[PlaywrightTest("page-screenshot.spec.ts", "should hide elements based on attr")]
public async Task ShouldHideElementsBasedOnAttr()
{
await Page.SetViewportSizeAsync(500, 500);
await Page.GotoAsync(Server.Prefix + "/grid.html");
await Page.Locator("div").Nth(5).EvaluateAsync("element => element.setAttribute('data-test-screenshot', 'hide')");
var screenshot = await Page.ScreenshotAsync(new() { Style = @"[data-test-screenshot=""hide""] {
visibility: hidden;
}" });
Assert.True(ScreenshotHelper.PixelMatch("hide-should-work.png", screenshot));
var visibility = await Page.Locator("div").Nth(5).EvaluateAsync<string>("element => element.style.visibility");
Assert.AreEqual("", visibility);
}

[PlaywrightTest("page-screenshot.spec.ts", "should remove elements based on attr")]
public async Task ShouldRemoveElementsBasedOnAttr()
{
await Page.SetViewportSizeAsync(500, 500);
await Page.GotoAsync(Server.Prefix + "/grid.html");
await Page.Locator("div").Nth(5).EvaluateAsync("element => element.setAttribute('data-test-screenshot', 'remove')");
var screenshot = await Page.ScreenshotAsync(new() { Style = @"[data-test-screenshot=""remove""] {
visibility: none;
}" });
Assert.True(ScreenshotHelper.PixelMatch("remove-should-work.png", screenshot));
var display = await Page.Locator("div").Nth(5).EvaluateAsync<string>("element => element.style.display");
Assert.AreEqual("", display);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 581450c

Please sign in to comment.