Skip to content

Commit ac524d3

Browse files
committed
chore: roll to 1.53.0-alpha-1744741041000
1 parent 8797fe3 commit ac524d3

29 files changed

+437
-82
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
| | Linux | macOS | Windows |
55
| :--- | :---: | :---: | :---: |
6-
| Chromium <!-- GEN:chromium-version -->134.0.6998.35<!-- GEN:stop --> ||||
6+
| Chromium <!-- GEN:chromium-version -->136.0.7103.25<!-- GEN:stop --> ||||
77
| WebKit <!-- GEN:webkit-version -->18.4<!-- GEN:stop --> ||||
8-
| Firefox <!-- GEN:firefox-version -->135.0<!-- GEN:stop --> ||||
8+
| Firefox <!-- GEN:firefox-version -->137.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

src/Common/Version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<AssemblyVersion>1.51.0</AssemblyVersion>
44
<PackageVersion>$(AssemblyVersion)</PackageVersion>
5-
<DriverVersion>1.51.1</DriverVersion>
5+
<DriverVersion>1.53.0-alpha-1744741041000</DriverVersion>
66
<ReleaseVersion>$(AssemblyVersion)</ReleaseVersion>
77
<FileVersion>$(AssemblyVersion)</FileVersion>
88
<NoDefaultExcludes>true</NoDefaultExcludes>

src/Playwright.TestingHarnessTest/package-lock.json

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Playwright.TestingHarnessTest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "playwright.testingharnesstest",
33
"private": true,
44
"devDependencies": {
5-
"@playwright/test": "1.51.0-beta-1741166263000",
5+
"@playwright/test": "1.53.0-alpha-1744741041000",
66
"@types/node": "^22.12.0",
77
"fast-xml-parser": "^4.5.0"
88
}

src/Playwright.Tests/Assertions/LocatorAssertionsTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,31 @@ public async Task ShouldSupportToHaveClass()
553553
}
554554
}
555555

556+
[PlaywrightTest("playwright-test/playwright.expect.spec.ts", "should support toContainClass")]
557+
public async Task ShouldSupportToContainClass()
558+
{
559+
{
560+
await Page.SetContentAsync("<div class=\"foo bar baz\"></div>");
561+
var locator = Page.Locator("div");
562+
await Expect(locator).ToContainClassAsync("");
563+
await Expect(locator).ToContainClassAsync("bar");
564+
await Expect(locator).ToContainClassAsync("baz bar");
565+
await Expect(locator).ToContainClassAsync(" bar foo ");
566+
await Expect(locator).Not.ToContainClassAsync("baz not-matching");
567+
var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(() => Expect(locator).ToContainClassAsync("does-not-exist", new() { Timeout = 300 }));
568+
StringAssert.Contains("Locator expected to contain class names 'does-not-exist'", exception.Message);
569+
StringAssert.Contains("But was: 'foo bar baz'", exception.Message);
570+
StringAssert.Contains("LocatorAssertions.ToContainClassAsync with timeout 300ms", exception.Message);
571+
}
572+
{
573+
await Page.SetContentAsync("<div class=\"foo\"></div><div class=\"hello bar\"></div><div class=\"baz\"></div>");
574+
var locator = Page.Locator("div");
575+
await Expect(locator).ToContainClassAsync(new string[] { "foo", "hello", "baz" });
576+
await Expect(locator).Not.ToContainClassAsync(new string[] { "not-there", "hello", "baz" });
577+
await Expect(locator).Not.ToContainClassAsync(new string[] { "foo", "hello" });
578+
}
579+
}
580+
556581
[PlaywrightTest("playwright-test/playwright.expect.spec.ts", "should support toHaveCount")]
557582
public async Task ShouldSupportToHaveCount()
558583
{

src/Playwright.Tests/GlobalFetchTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,22 @@ public async Task ShouldNotFollowRedirectsWhenMaxRedirectsIsSetTo0()
408408
await request.DisposeAsync();
409409
}
410410

411+
[PlaywrightTest("global-fetch.spec.ts", "should not follow redirects when maxRedirects is set to 0 in newContext")]
412+
public async Task ShouldNotFollowRedirectsWhenMaxRedirectsIsSetTo0InNewContext()
413+
{
414+
Server.SetRedirect("/a/redirect1", "/b/c/redirect2");
415+
Server.SetRedirect("/b/c/redirect2", "/simple.json");
416+
417+
var request = await Playwright.APIRequest.NewContextAsync(new() { MaxRedirects = 0 });
418+
foreach (var method in new[] { "GET", "PUT", "POST", "OPTIONS", "HEAD", "PATCH" })
419+
{
420+
var response = await request.FetchAsync($"{Server.Prefix}/a/redirect1", new() { Method = method });
421+
Assert.AreEqual("/b/c/redirect2", response.Headers["location"]);
422+
Assert.AreEqual(302, response.Status);
423+
}
424+
await request.DisposeAsync();
425+
}
426+
411427
[PlaywrightTest("global-fetch.spec.ts", "should throw an error when maxRedirects is less than 0")]
412428
public async Task ShouldThrowAnErrorWhenMaxRedirectsIsLessThan0()
413429
{

src/Playwright.Tests/PageAriaSnapshotTests.cs

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,63 @@ await Page.SetContentAsync(@"
9999
await CheckAndMatchSnapshot(Page.Locator("body"), @"
100100
- list:
101101
- listitem:
102-
- link ""link""
102+
- link ""link"":
103+
- /url: about:blank
104+
");
105+
}
106+
107+
[PlaywrightTest("to-match-aria-snapshot.spec.ts", "should detect unexpected children: equal")]
108+
public async Task ShouldDetectUnexpectedChildrenEqual()
109+
{
110+
await Page.SetContentAsync(@"
111+
<ul>
112+
<li>One</li>
113+
<li>Two</li>
114+
<li>Three</li>
115+
</ul>
116+
");
117+
await Expect(Page.Locator("body")).ToMatchAriaSnapshotAsync(@"
118+
- list:
119+
- listitem: ""One""
120+
- listitem: ""Three""
121+
");
122+
var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(() => {
123+
return Expect(Page.Locator("body")).ToMatchAriaSnapshotAsync(@"
124+
- list:
125+
- /children: equal
126+
- listitem: ""One""
127+
- listitem: ""Three""
128+
", new() { Timeout = 300 });
129+
});
130+
StringAssert.Contains("+ - listitem: Two", exception.Message);
131+
StringAssert.Contains("Timed out 300ms waiting", exception.Message);
132+
}
133+
134+
[PlaywrightTest("page-aria-snapshot.spec.ts", "should generate refs")]
135+
public async Task ShouldGenerateRefs()
136+
{
137+
await Page.SetContentAsync(@"
138+
<button>One</button>
139+
<button>Two</button>
140+
<button>Three</button>
141+
");
142+
var snapshot = await Page.Locator("body").AriaSnapshotAsync(new() { Ref = true });
143+
Assert.AreEqual(_unshift(@"
144+
- button ""One"" [ref=s1e3]
145+
- button ""Two"" [ref=s1e4]
146+
- button ""Three"" [ref=s1e5]
147+
"), snapshot);
148+
}
149+
150+
[PlaywrightTest("to-match-aria-snapshot.spec.ts", "should match url")]
151+
public async Task ShouldMatchUrl()
152+
{
153+
await Page.SetContentAsync(@"
154+
<a href='https://example.com'>Link</a>
155+
");
156+
await Expect(Page.Locator("body")).ToMatchAriaSnapshotAsync(@"
157+
- link:
158+
- /url: /.*example.com/
103159
");
104160
}
105161
}

src/Playwright.Tests/PageEvaluateTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ public async Task ShouldTransferNegativeInfinity()
7474
Assert.AreEqual(double.NegativeInfinity, result);
7575
}
7676

77+
[PlaywrightTest("page-evaluate.spec.ts", "should transfer typed arrays")]
78+
public async Task ShouldTransferTypedArrays()
79+
{
80+
Assert.AreEqual(new sbyte[] { 1, 2, 3 }, await Page.EvaluateAsync<sbyte[]>("() => new Int8Array([1, 2, 3])"));
81+
Assert.AreEqual(new byte[] { 1, 2, 3 }, await Page.EvaluateAsync<byte[]>("() => new Uint8Array([1, 2, 3])"));
82+
Assert.AreEqual(new byte[] { 1, 2, 3 }, await Page.EvaluateAsync<byte[]>("() => new Uint8ClampedArray([1, 2, 3])"));
83+
Assert.AreEqual(new short[] { 1, 2, 3 }, await Page.EvaluateAsync<short[]>("() => new Int16Array([1, 2, 3])"));
84+
Assert.AreEqual(new ushort[] { 1, 2, 3 }, await Page.EvaluateAsync<ushort[]>("() => new Uint16Array([1, 2, 3])"));
85+
Assert.AreEqual(new int[] { 1, 2, 3 }, await Page.EvaluateAsync<int[]>("() => new Int32Array([1, 2, 3])"));
86+
Assert.AreEqual(new uint[] { 1, 2, 3 }, await Page.EvaluateAsync<uint[]>("() => new Uint32Array([1, 2, 3])"));
87+
Assert.AreEqual(new float[] { 1.5F, 2.5F, 3.5F }, await Page.EvaluateAsync<float[]>("() => new Float32Array([1.5, 2.5, 3.5])"));
88+
Assert.AreEqual(new double[] { 1.5, 2.5, 3.5 }, await Page.EvaluateAsync<double[]>("() => new Float64Array([1.5, 2.5, 3.5])"));
89+
Assert.AreEqual(new long[] { 1, 2, 3 }, await Page.EvaluateAsync<long[]>("() => new BigInt64Array([1n, 2n, 3n])"));
90+
Assert.AreEqual(new ulong[] { 1, 2, 3 }, await Page.EvaluateAsync<ulong[]>("() => new BigUint64Array([1n, 2n, 3n])"));
91+
}
92+
7793
[PlaywrightTest("page-evaluate.spec.ts", "should transfer bigint")]
7894
public async Task ShouldTransferBigInt()
7995
{

src/Playwright.Tests/PageRouteTests.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,13 @@ void handler4(IRoute route)
9999
Assert.AreEqual(new[] { 1 }, intercepted.ToArray());
100100
}
101101

102-
[PlaywrightTest("page-route.spec.ts", "should support ? in glob pattern")]
103-
public async Task ShouldSupportInGlobPattern()
102+
[PlaywrightTest("page-route.spec.ts", "should not support ? in glob pattern")]
103+
public async Task ShouldNotSupportQuestionMarkInGlobPattern()
104104
{
105105
Server.SetRoute("/index", context => context.Response.WriteAsync("index-no-hello"));
106106
Server.SetRoute("/index123hello", context => context.Response.WriteAsync("index123hello"));
107107
Server.SetRoute("/index?hello", context => context.Response.WriteAsync("index?hello"));
108+
Server.SetRoute("/index1hello", context => context.Response.WriteAsync("index1hello"));
108109

109110
await Page.RouteAsync("**/index?hello", (route) => route.FulfillAsync(new() { Body = "intercepted any character" }));
110111
await Page.RouteAsync("**/index\\?hello", (route) => route.FulfillAsync(new() { Body = "intercepted question mark" }));
@@ -116,7 +117,7 @@ public async Task ShouldSupportInGlobPattern()
116117
StringAssert.Contains("index-no-hello", await Page.ContentAsync());
117118

118119
await Page.GotoAsync(Server.Prefix + "/index1hello");
119-
StringAssert.Contains("intercepted any character", await Page.ContentAsync());
120+
StringAssert.Contains("index1hello", await Page.ContentAsync());
120121

121122
await Page.GotoAsync(Server.Prefix + "/index123hello");
122123
StringAssert.Contains("index123hello", await Page.ContentAsync());
@@ -642,7 +643,7 @@ await Page.RouteAsync("**/cars*", (route) =>
642643
method: 'POST',
643644
headers: { 'Content-Type': 'application/json' },
644645
mode: 'cors',
645-
body: JSON.stringify({ 'number': 1 })
646+
body: JSON.stringify({ 'number': 1 })
646647
});
647648
return response.json();
648649
}");
@@ -670,7 +671,7 @@ await Page.RouteAsync("**/cars*", (route) =>
670671
method: 'POST',
671672
headers: { 'Content-Type': 'application/json' },
672673
mode: 'cors',
673-
body: JSON.stringify({ 'number': 1 })
674+
body: JSON.stringify({ 'number': 1 })
674675
});
675676
return response.json();
676677
}");
@@ -682,7 +683,7 @@ await Page.RouteAsync("**/cars*", (route) =>
682683
method: 'DELETE',
683684
headers: { 'Content-Type': 'application/json' },
684685
mode: 'cors',
685-
body: JSON.stringify({ 'number': 1 })
686+
body: JSON.stringify({ 'number': 1 })
686687
});
687688
return response.json();
688689
}");

src/Playwright/API/Generated/IBrowserContext.cs

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,24 @@ public partial interface IBrowserContext
333333
/// </para>
334334
/// </summary>
335335
/// <param name="urls">Optional list of URLs.</param>
336-
Task<IReadOnlyList<BrowserContextCookiesResult>> CookiesAsync(IEnumerable<string>? urls = default);
336+
Task<IReadOnlyList<BrowserContextCookiesResult>> CookiesAsync(string urls);
337+
338+
/// <summary>
339+
/// <para>
340+
/// If no URLs are specified, this method returns all cookies. If URLs are specified,
341+
/// only cookies that affect those URLs are returned.
342+
/// </para>
343+
/// </summary>
344+
/// <param name="urls">Optional list of URLs.</param>
345+
Task<IReadOnlyList<BrowserContextCookiesResult>> CookiesAsync(IEnumerable<string> urls);
346+
347+
/// <summary>
348+
/// <para>
349+
/// If no URLs are specified, this method returns all cookies. If URLs are specified,
350+
/// only cookies that affect those URLs are returned.
351+
/// </para>
352+
/// </summary>
353+
Task<IReadOnlyList<BrowserContextCookiesResult>> CookiesAsync();
337354

338355
/// <summary>
339356
/// <para>
@@ -556,9 +573,10 @@ public partial interface IBrowserContext
556573
/// <para>Enabling routing disables http cache.</para>
557574
/// </remarks>
558575
/// <param name="url">
559-
/// A glob pattern, regex pattern or predicate receiving <see cref="URL"/> to match
560-
/// while routing. When a <see cref="IBrowser.NewContextAsync"/> via the context options
561-
/// was provided and the passed URL is a path, it gets merged via the <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL"><c>new
576+
/// A glob pattern, regex pattern, or predicate that receives a <see cref="URL"/> to
577+
/// match during routing. If <see cref="IBrowser.NewContextAsync"/> is set in the context
578+
/// options and the provided URL is a string that does not start with <c>*</c>, it is
579+
/// resolved using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL"><c>new
562580
/// URL()</c></a> constructor.
563581
/// </param>
564582
/// <param name="handler">handler function to route the request.</param>
@@ -624,9 +642,10 @@ public partial interface IBrowserContext
624642
/// <para>Enabling routing disables http cache.</para>
625643
/// </remarks>
626644
/// <param name="url">
627-
/// A glob pattern, regex pattern or predicate receiving <see cref="URL"/> to match
628-
/// while routing. When a <see cref="IBrowser.NewContextAsync"/> via the context options
629-
/// was provided and the passed URL is a path, it gets merged via the <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL"><c>new
645+
/// A glob pattern, regex pattern, or predicate that receives a <see cref="URL"/> to
646+
/// match during routing. If <see cref="IBrowser.NewContextAsync"/> is set in the context
647+
/// options and the provided URL is a string that does not start with <c>*</c>, it is
648+
/// resolved using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL"><c>new
630649
/// URL()</c></a> constructor.
631650
/// </param>
632651
/// <param name="handler">handler function to route the request.</param>
@@ -692,9 +711,10 @@ public partial interface IBrowserContext
692711
/// <para>Enabling routing disables http cache.</para>
693712
/// </remarks>
694713
/// <param name="url">
695-
/// A glob pattern, regex pattern or predicate receiving <see cref="URL"/> to match
696-
/// while routing. When a <see cref="IBrowser.NewContextAsync"/> via the context options
697-
/// was provided and the passed URL is a path, it gets merged via the <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL"><c>new
714+
/// A glob pattern, regex pattern, or predicate that receives a <see cref="URL"/> to
715+
/// match during routing. If <see cref="IBrowser.NewContextAsync"/> is set in the context
716+
/// options and the provided URL is a string that does not start with <c>*</c>, it is
717+
/// resolved using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL"><c>new
698718
/// URL()</c></a> constructor.
699719
/// </param>
700720
/// <param name="handler">handler function to route the request.</param>

0 commit comments

Comments
 (0)