From e964457aa770c39ecb8f3605da512791b6f527a9 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Wed, 17 Jan 2024 09:51:42 +0100 Subject: [PATCH] chore: get rid of build warnings (#2824) --- src/Common/Dependencies.props | 2 +- src/Playwright.Tests/BrowserContextRouteTests.cs | 10 +++++----- src/Playwright.Tests/PageRouteTests.cs | 6 +++--- src/Playwright/Core/Locator.cs | 3 ++- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Common/Dependencies.props b/src/Common/Dependencies.props index 61f3c0b570..cdd871f086 100644 --- a/src/Common/Dependencies.props +++ b/src/Common/Dependencies.props @@ -18,7 +18,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Playwright.Tests/BrowserContextRouteTests.cs b/src/Playwright.Tests/BrowserContextRouteTests.cs index d4df032bde..bb83b8620a 100644 --- a/src/Playwright.Tests/BrowserContextRouteTests.cs +++ b/src/Playwright.Tests/BrowserContextRouteTests.cs @@ -88,11 +88,11 @@ await context.RouteAsync("**/empty.html", (route) => route.ContinueAsync(); }); - Action handler4 = (route) => + void handler4(IRoute route) { intercepted.Add(4); route.ContinueAsync(); - }; + } await context.RouteAsync(new Regex("/empty.html"), handler4); await page.GotoAsync(Server.EmptyPage); @@ -125,11 +125,11 @@ await page.RouteAsync("/empty.html", (route) => route.ContinueAsync(); }); - Action handler2 = (route) => + void handler2(IRoute route) { intercepted.Add(2); route.ContinueAsync(); - }; + } await page.RouteAsync("/empty.html", handler2); await page.GotoAsync(Server.EmptyPage); @@ -363,7 +363,7 @@ public async Task ShouldWorkIfHandlerWithTimesParameterWasRemovedFromAnotherHand await using var context = await Browser.NewContextAsync(); var page = await context.NewPageAsync(); var intercepted = new List(); - async Task handler(IRoute route) + void handler(IRoute route) { intercepted.Add("first"); route.ContinueAsync(); diff --git a/src/Playwright.Tests/PageRouteTests.cs b/src/Playwright.Tests/PageRouteTests.cs index 93f6542935..f1ca094b9c 100644 --- a/src/Playwright.Tests/PageRouteTests.cs +++ b/src/Playwright.Tests/PageRouteTests.cs @@ -81,11 +81,11 @@ await Page.RouteAsync("**/empty.html", (route) => }); - Action handler4 = (route) => + void handler4(IRoute route) { intercepted.Add(4); route.FallbackAsync(); - }; + } await Page.RouteAsync(new Regex("/empty.html"), handler4); await Page.GotoAsync(Server.EmptyPage); @@ -771,7 +771,7 @@ await page.RouteAsync("**/empty.html", (route) => public async Task ShouldWorkIfHandlerWithTimesParameterWasRemovedFromAnotherHandler() { var intercepted = new List(); - async Task handler(IRoute route) + void handler(IRoute route) { intercepted.Add("first"); route.ContinueAsync(); diff --git a/src/Playwright/Core/Locator.cs b/src/Playwright/Core/Locator.cs index 77ebef0893..a1c2f427d6 100644 --- a/src/Playwright/Core/Locator.cs +++ b/src/Playwright/Core/Locator.cs @@ -26,6 +26,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.Linq; using System.Text.Encodings.Web; using System.Text.Json; @@ -534,7 +535,7 @@ internal static string GetByRoleSelector(AriaRole role, ByRoleOptions options) } if (options.Level != null) { - props.Add(new List { "level", options.Level.ToString() }); + props.Add(new List { "level", options.Level?.ToString(CultureInfo.InvariantCulture) }); } if (options.Name != null) {