Skip to content

Commit fa73492

Browse files
authored
chore: roll driver to 1.31.0-beta-1676584193000 (#2485)
1 parent 146dbce commit fa73492

35 files changed

+296
-94
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
| | Linux | macOS | Windows |
55
| :--- | :---: | :---: | :---: |
6-
| Chromium <!-- GEN:chromium-version -->110.0.5481.38<!-- GEN:stop --> ||||
6+
| Chromium <!-- GEN:chromium-version -->111.0.5563.19<!-- GEN:stop --> ||||
77
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> ||||
8-
| Firefox <!-- GEN:firefox-version -->108.0.2<!-- GEN:stop --> ||||
8+
| Firefox <!-- GEN:firefox-version -->109.0<!-- GEN:stop --> ||||
99

1010
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**.
1111

build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ function roll_driver() {
6969
echo "Generating transport channels..."
7070
rm -rf "src/Playwright/Transport/Protocol/Generated/"
7171
node "$upstream_repo_path/utils/generate_dotnet_channels.js" "src/Playwright"
72+
echo "Formatting source code..."
7273
dotnet format src/Playwright
7374

7475
download_driver

src/Common/Version.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<AssemblyVersion>1.31.0</AssemblyVersion>
44
<PackageVersion>$(AssemblyVersion)-beta-1</PackageVersion>
5-
<DriverVersion>1.30.0</DriverVersion>
5+
<DriverVersion>1.31.0-beta-1676584193000</DriverVersion>
66
<ReleaseVersion>$(AssemblyVersion)</ReleaseVersion>
77
<FileVersion>$(AssemblyVersion)</FileVersion>
88
<NoDefaultExcludes>true</NoDefaultExcludes>

src/Playwright.Tests/Assertions/LocatorAssertionsTests.cs

+30
Original file line numberDiff line numberDiff line change
@@ -506,4 +506,34 @@ await Page.SetContentAsync(@"
506506
StringAssert.Contains("Not a select element with a multiple attribute", exception.Message);
507507
}
508508
}
509+
510+
[PlaywrightTest("page/expect-misc.spec.ts", "toBeInViewport > should work")]
511+
public async Task ToBeInViewportShouldWork()
512+
{
513+
await Page.SetContentAsync(@"
514+
<div id=big style='height: 10000px;'></div>
515+
<div id=small>foo</div>");
516+
await Expect(Page.Locator("#big")).ToBeInViewportAsync();
517+
await Expect(Page.Locator("#small")).Not.ToBeInViewportAsync();
518+
await Page.Locator("#small").ScrollIntoViewIfNeededAsync();
519+
await Expect(Page.Locator("#small")).ToBeInViewportAsync();
520+
}
521+
522+
[PlaywrightTest("page/expect-misc.spec.ts", "toBeInViewport > should respect ratio option")]
523+
public async Task ToBeInViewportShouldRespectRatioOption()
524+
{
525+
await Page.SetContentAsync(@"
526+
<style>body, div, html { padding: 0; margin: 0; }</style>
527+
<div id=big style='height: 400vh;'></div>");
528+
await Expect(Page.Locator("div")).ToBeInViewportAsync();
529+
await Expect(Page.Locator("div")).ToBeInViewportAsync(new() { Ratio = 0.1f });
530+
await Expect(Page.Locator("div")).ToBeInViewportAsync(new() { Ratio = 0.2f });
531+
await Expect(Page.Locator("div")).ToBeInViewportAsync(new() { Ratio = 0.24f });
532+
// In this test, element's ratio is 0.25.
533+
await Expect(Page.Locator("div")).ToBeInViewportAsync(new() { Ratio = 0.25f });
534+
await Expect(Page.Locator("div")).Not.ToBeInViewportAsync(new() { Ratio = 0.26f });
535+
await Expect(Page.Locator("div")).Not.ToBeInViewportAsync(new() { Ratio = 0.3f });
536+
await Expect(Page.Locator("div")).Not.ToBeInViewportAsync(new() { Ratio = 0.7f });
537+
await Expect(Page.Locator("div")).Not.ToBeInViewportAsync(new() { Ratio = 0.8f });
538+
}
509539
}

src/Playwright.Tests/BrowserTypeConnectTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public async Task ShouldBeAbleToConnectTwoBrowsersAtTheSameTime()
113113
public async Task ShouldTimeoutInConnectWhileConnecting()
114114
{
115115
var exception = await PlaywrightAssert.ThrowsAsync<TimeoutException>(async () => await BrowserType.ConnectAsync($"ws://localhost:{Server.Port}/ws", new BrowserTypeConnectOptions { Timeout = 100 }));
116-
StringAssert.Contains("BrowserType.ConnectAsync: Timeout 100ms exceeded", exception.Message);
116+
StringAssert.Contains("Timeout 100ms exceeded", exception.Message);
117117
}
118118

119119
[PlaywrightTest("browsertype-connect.spec.ts", "should support slowmo option")]

src/Playwright.Tests/FrameGoToTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public async Task ShouldRejectWhenFrameDetaches()
5252
await waitForRequestTask;
5353
await Page.EvalOnSelectorAsync("iframe", "frame => frame.remove()");
5454
var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(() => navigationTask);
55-
StringAssert.Contains("frame was detached", exception.Message);
55+
Assert.True(exception.Message.Contains("frame was detached") || exception.Message.Contains("net::ERR_ABORTED"));
5656
}
5757

5858
[PlaywrightTest("frame-goto.spec.ts", "should continue after client redirect")]

src/Playwright.Tests/JSHandleToStringTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,5 @@ public async Task ShouldWorkWithDifferentSubtypes()
7575
Assert.AreEqual("WeakMap", (await Page.EvaluateHandleAsync("new WeakMap()")).ToString());
7676
Assert.AreEqual("WeakSet", (await Page.EvaluateHandleAsync("new WeakSet()")).ToString());
7777
StringAssert.Contains("Error", (await Page.EvaluateHandleAsync("new Error()")).ToString());
78-
Assert.AreEqual("Proxy", (await Page.EvaluateHandleAsync("new Proxy({}, {})")).ToString());
7978
}
8079
}

src/Playwright.Tests/PageRequestInterceptTests.cs

+17
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,23 @@ await Page.RouteAsync("**/*", async (route) =>
216216
Assert.True(response.Headers["content-type"].Contains("text/html"));
217217
}
218218

219+
[PlaywrightTest("page-request-intercept.spec.ts", "should not follow redirects when maxRedirects is set to 0 in route.fetch")]
220+
public async Task ShouldNotFollowRedirectsInRouteFetch()
221+
{
222+
Server.SetRedirect("/foo", "/empty.html");
223+
await Page.RouteAsync("**/*", async (route) =>
224+
{
225+
var response = await route.FetchAsync(new() { MaxRedirects = 0 });
226+
Assert.AreEqual("/empty.html", response.Headers["location"]);
227+
Assert.AreEqual(302, response.Status);
228+
await route.FulfillAsync(new() { Body = "hello" });
229+
});
230+
231+
await Page.GotoAsync($"{Server.Prefix}/foo");
232+
var content = await Page.ContentAsync();
233+
Assert.True(content.Contains("hello"));
234+
}
235+
219236
[PlaywrightTest("page-request-intercept.spec.ts", "should intercept with url override")]
220237
public async Task ShouldInterceptWithUrlOverride()
221238
{

src/Playwright.Tests/PermissionsTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ await Page.EvaluateAsync(@"() => {
154154

155155
// Note: Chromium 110 stopped triggering "onchange" when clearing permissions.
156156
Assert.AreEqual(
157-
(BrowserName == "chromium" && BrowserMajorVersion >= 110) ?
157+
(BrowserName == "chromium" && BrowserMajorVersion == 110) ?
158158
new[] { "prompt", "denied", "granted" } :
159159
new[] { "prompt", "denied", "granted", "prompt" },
160160
await Page.EvaluateAsync<string[]>("window.events"));

src/Playwright/API/Generated/IAPIResponseAssertions.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ namespace Microsoft.Playwright;
3131
/// <summary>
3232
/// <para>
3333
/// The <see cref="IAPIResponseAssertions"/> class provides assertion methods that can
34-
/// be used to make assertions about the <see cref="IAPIResponse"/> in the tests. A
35-
/// new instance of <see cref="IAPIResponseAssertions"/> is created by calling <see
36-
/// cref="IPlaywrightAssertions.Expect"/>:
34+
/// be used to make assertions about the <see cref="IAPIResponse"/> in the tests.
3735
/// </para>
3836
/// </summary>
3937
public partial interface IAPIResponseAssertions

src/Playwright/API/Generated/IConsoleMessage.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ namespace Microsoft.Playwright;
3535
/// event in the Playwright context.
3636
/// </para>
3737
/// <code>
38-
/// // Listen for all System.out.printlns<br/>
38+
/// // Listen for all console messages and print them to the standard output.<br/>
3939
/// page.Console += (_, msg) =&gt; Console.WriteLine(msg.Text);<br/>
4040
/// <br/>
41-
/// // Listen for all console events and handle errors<br/>
41+
/// // Listen for all console messages and print errors to the standard output.<br/>
4242
/// page.Console += (_, msg) =&gt;<br/>
4343
/// {<br/>
4444
/// if ("error".Equals(msg.Type))<br/>
4545
/// Console.WriteLine("Error text: " + msg.Text);<br/>
4646
/// };<br/>
4747
/// <br/>
48-
/// // Get the next System.out.println<br/>
48+
/// // Get the next console message<br/>
4949
/// var waitForMessageTask = page.WaitForConsoleMessageAsync();<br/>
5050
/// await page.EvaluateAsync("console.log('hello', 42, { foo: 'bar' });");<br/>
5151
/// var message = await waitForMessageTask;<br/>

src/Playwright/API/Generated/ILocator.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public partial interface ILocator
251251
Task DblClickAsync(LocatorDblClickOptions? options = default);
252252

253253
/// <summary>
254-
/// <para>Programmaticaly dispatch an event on the matching element.</para>
254+
/// <para>Programmatically dispatch an event on the matching element.</para>
255255
/// <para>**Usage**</para>
256256
/// <code>await locator.DispatchEventAsync("click");</code>
257257
/// <para>**Details**</para>
@@ -907,7 +907,7 @@ public partial interface ILocator
907907
IPage Page { get; }
908908

909909
/// <summary>
910-
/// <para>Focuses the mathing element and presses a combintation of the keys.</para>
910+
/// <para>Focuses the matching element and presses a combination of the keys.</para>
911911
/// <para>**Usage**</para>
912912
/// <code>await page.GetByRole(AriaRole.Textbox).PressAsync("Backspace");</code>
913913
/// <para>**Details**</para>

src/Playwright/API/Generated/ILocatorAssertions.cs

+21-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ namespace Microsoft.Playwright;
3333
/// <summary>
3434
/// <para>
3535
/// The <see cref="ILocatorAssertions"/> class provides assertion methods that can be
36-
/// used to make assertions about the <see cref="ILocator"/> state in the tests. A new
37-
/// instance of <see cref="ILocatorAssertions"/> is created by calling <see cref="IPlaywrightAssertions.Expect"/>:
36+
/// used to make assertions about the <see cref="ILocator"/> state in the tests.
3837
/// </para>
3938
/// <code>
4039
/// using System.Text.RegularExpressions;<br/>
@@ -159,6 +158,26 @@ public partial interface ILocatorAssertions
159158
/// <param name="options">Call options</param>
160159
Task ToBeHiddenAsync(LocatorAssertionsToBeHiddenOptions? options = default);
161160

161+
/// <summary>
162+
/// <para>
163+
/// Ensures the <see cref="ILocator"/> points to an element that intersects viewport,
164+
/// according to the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">intersection
165+
/// observer API</a>.
166+
/// </para>
167+
/// <para>**Usage**</para>
168+
/// <code>
169+
/// var locator = Page.Locator("button.submit");<br/>
170+
/// // Make sure at least some part of element intersects viewport.<br/>
171+
/// await Expect(locator).ToBeInViewportAsync();<br/>
172+
/// // Make sure element is fully outside of viewport.<br/>
173+
/// await Expect(locator).Not.ToBeInViewportAsync();<br/>
174+
/// // Make sure that at least half of the element intersects viewport.<br/>
175+
/// await Expect(locator).ToBeInViewportAsync(new() { Ratio = 0.5 });
176+
/// </code>
177+
/// </summary>
178+
/// <param name="options">Call options</param>
179+
Task ToBeInViewportAsync(LocatorAssertionsToBeInViewportOptions? options = default);
180+
162181
/// <summary>
163182
/// <para>
164183
/// Ensures that <see cref="ILocator"/> points to an <a href="https://playwright.dev/dotnet/docs/actionability#attached">attached</a>

src/Playwright/API/Generated/IPage.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2416,8 +2416,8 @@ public partial interface IPage
24162416
/// </summary>
24172417
/// <remarks>
24182418
/// <para>
2419-
/// <see cref="IPage.TapAsync"/> requires that the <paramref name="hasTouch"/> option
2420-
/// of the browser context be set to true.
2419+
/// <see cref="IPage.TapAsync"/> the method will throw if <paramref name="hasTouch"/>
2420+
/// option of the browser context is false.
24212421
/// </para>
24222422
/// </remarks>
24232423
/// <param name="selector">

src/Playwright/API/Generated/IPageAssertions.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ namespace Microsoft.Playwright;
3232
/// <summary>
3333
/// <para>
3434
/// The <see cref="IPageAssertions"/> class provides assertion methods that can be used
35-
/// to make assertions about the <see cref="IPage"/> state in the tests. A new instance
36-
/// of <see cref="IPageAssertions"/> is created by calling <see cref="IPlaywrightAssertions.Expect"/>:
35+
/// to make assertions about the <see cref="IPage"/> state in the tests.
3736
/// </para>
3837
/// <code>
3938
/// using System.Text.RegularExpressions;<br/>

src/Playwright/API/Generated/IRequest.cs

+12-12
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ public partial interface IRequest
126126
/// <summary><para>Request's post body in a binary form, if any.</para></summary>
127127
byte[]? PostDataBuffer { get; }
128128

129+
/// <summary>
130+
/// <para>
131+
/// Returns parsed request's body for <c>form-urlencoded</c> and JSON as a fallback
132+
/// if any.
133+
/// </para>
134+
/// <para>
135+
/// When the response is <c>application/x-www-form-urlencoded</c> then a key/value object
136+
/// of the values will be returned. Otherwise it will be parsed as JSON.
137+
/// </para>
138+
/// </summary>
139+
JsonElement? PostDataJSON();
140+
129141
/// <summary>
130142
/// <para>Request that was redirected by the server to this one, if any.</para>
131143
/// <para>
@@ -197,18 +209,6 @@ public partial interface IRequest
197209

198210
/// <summary><para>URL of the request.</para></summary>
199211
string Url { get; }
200-
201-
/// <summary>
202-
/// <para>
203-
/// Returns parsed request's body for <c>form-urlencoded</c> and JSON as a fallback
204-
/// if any.
205-
/// </para>
206-
/// <para>
207-
/// When the response is <c>application/x-www-form-urlencoded</c> then a key/value object
208-
/// of the values will be returned. Otherwise it will be parsed as JSON.
209-
/// </para>
210-
/// </summary>
211-
JsonElement? PostDataJSON();
212212
}
213213

214214
#nullable disable

src/Playwright/API/Generated/IRoute.cs

+15
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ public partial interface IRoute
8383
/// route.ContinueAsync(headers);<br/>
8484
/// });
8585
/// </code>
86+
/// <para>**Details**</para>
87+
/// <para>
88+
/// Note that any overrides such as <paramref name="url"/> or <paramref name="headers"/>
89+
/// only apply to the request being routed. If this request results in a redirect, overrides
90+
/// will not be applied to the new redirected request. If you want to propagate a header
91+
/// through redirects, use the combination of <see cref="IRoute.FetchAsync"/> and <see
92+
/// cref="IRoute.FulfillAsync"/> instead.
93+
/// </para>
8694
/// </summary>
8795
/// <param name="options">Call options</param>
8896
Task ContinueAsync(RouteContinueOptions? options = default);
@@ -169,6 +177,13 @@ public partial interface IRoute
169177
/// await route.FulfillAsync(new() { Response = response, Json = json });<br/>
170178
/// });
171179
/// </code>
180+
/// <para>**Details**</para>
181+
/// <para>
182+
/// Note that <paramref name="headers"/> option will apply to the fetched request as
183+
/// well as any redirects initiated by it. If you want to only apply <paramref name="headers"/>
184+
/// to the original request, but not to redirects, look into <see cref="IRoute.ContinueAsync"/>
185+
/// instead.
186+
/// </para>
172187
/// </summary>
173188
/// <param name="options">Call options</param>
174189
Task<IAPIResponse> FetchAsync(RouteFetchOptions? options = default);

src/Playwright/API/Generated/ISelectors.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ namespace Microsoft.Playwright;
3737
public partial interface ISelectors
3838
{
3939
/// <summary>
40+
/// <para>Selectors must be registered before creating the page.</para>
4041
/// <para>**Usage**</para>
4142
/// <para>An example of registering selector engine that queries elements based on a tag name:</para>
4243
/// <code>
@@ -63,8 +64,8 @@ public partial interface ISelectors
6364
/// await page.SetContentAsync("&lt;div&gt;&lt;button&gt;Click me&lt;/button&gt;&lt;/div&gt;");<br/>
6465
/// // Use the selector prefixed with its name.<br/>
6566
/// var button = page.Locator("tag=button");<br/>
66-
/// // Combine it with other selector engines.<br/>
67-
/// await page.Locator("tag=div &gt;&gt; text=\"Click me\"").ClickAsync();<br/>
67+
/// // Combine it with built-in locators.<br/>
68+
/// await page.Locator("tag=div").GetByText("Click me").ClickAsync();<br/>
6869
/// // Can use it in any methods supporting selectors.<br/>
6970
/// int buttonCount = await page.Locator("tag=button").CountAsync();
7071
/// </code>

src/Playwright/API/Generated/ITouchscreen.cs

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public partial interface ITouchscreen
4343
/// the position (<paramref name="x"/>,<paramref name="y"/>).
4444
/// </para>
4545
/// </summary>
46+
/// <remarks>
47+
/// <para>
48+
/// <see cref="IPage.TapAsync"/> the method will throw if <paramref name="hasTouch"/>
49+
/// option of the browser context is false.
50+
/// </para>
51+
/// </remarks>
4652
/// <param name="x">
4753
/// </param>
4854
/// <param name="y">

src/Playwright/API/Generated/Options/APIRequestContextOptions.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@ public APIRequestContextOptions(APIRequestContextOptions clone)
120120
[JsonPropertyName("form")]
121121
public IFormData? Form { get; set; }
122122

123-
/// <summary><para>Allows to set HTTP headers.</para></summary>
123+
/// <summary>
124+
/// <para>
125+
/// Allows to set HTTP headers. These headers will apply to the fetched request as well
126+
/// as any redirects initiated by it.
127+
/// </para>
128+
/// </summary>
124129
[JsonPropertyName("headers")]
125130
public IEnumerable<KeyValuePair<string, string>>? Headers { get; set; }
126131

src/Playwright/API/Generated/Options/BrowserNewContextOptions.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,16 @@ public BrowserNewContextOptions(BrowserNewContextOptions clone)
363363
/// <summary>
364364
/// <para>
365365
/// Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use
366-
/// <c>ViewportSize.NoViewport</c> to disable the default viewport.
366+
/// <c>ViewportSize.NoViewport</c> to disable the consistent viewport emulation.
367367
/// </para>
368368
/// </summary>
369+
/// <remarks>
370+
/// <para>
371+
/// The <c>ViewportSize.NoViewport</c> value opts out from the default presets, makes
372+
/// viewport depend on the host window size defined by the operating system. It makes
373+
/// the execution of the tests non-deterministic.
374+
/// </para>
375+
/// </remarks>
369376
[JsonPropertyName("viewport")]
370377
public ViewportSize? ViewportSize { get; set; }
371378
}

src/Playwright/API/Generated/Options/BrowserNewPageOptions.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,16 @@ public BrowserNewPageOptions(BrowserNewPageOptions clone)
363363
/// <summary>
364364
/// <para>
365365
/// Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use
366-
/// <c>ViewportSize.NoViewport</c> to disable the default viewport.
366+
/// <c>ViewportSize.NoViewport</c> to disable the consistent viewport emulation.
367367
/// </para>
368368
/// </summary>
369+
/// <remarks>
370+
/// <para>
371+
/// The <c>ViewportSize.NoViewport</c> value opts out from the default presets, makes
372+
/// viewport depend on the host window size defined by the operating system. It makes
373+
/// the execution of the tests non-deterministic.
374+
/// </para>
375+
/// </remarks>
369376
[JsonPropertyName("viewport")]
370377
public ViewportSize? ViewportSize { get; set; }
371378
}

src/Playwright/API/Generated/Options/BrowserTypeLaunchPersistentContextOptions.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,16 @@ public BrowserTypeLaunchPersistentContextOptions(BrowserTypeLaunchPersistentCont
472472
/// <summary>
473473
/// <para>
474474
/// Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use
475-
/// <c>ViewportSize.NoViewport</c> to disable the default viewport.
475+
/// <c>ViewportSize.NoViewport</c> to disable the consistent viewport emulation.
476476
/// </para>
477477
/// </summary>
478+
/// <remarks>
479+
/// <para>
480+
/// The <c>ViewportSize.NoViewport</c> value opts out from the default presets, makes
481+
/// viewport depend on the host window size defined by the operating system. It makes
482+
/// the execution of the tests non-deterministic.
483+
/// </para>
484+
/// </remarks>
478485
[JsonPropertyName("viewport")]
479486
public ViewportSize? ViewportSize { get; set; }
480487
}

0 commit comments

Comments
 (0)