Skip to content

Commit bd829eb

Browse files
authored
chore: roll driver to 1.51.0-beta-1741166263000 (#3116)
1 parent 8af2579 commit bd829eb

39 files changed

+326
-307
lines changed

README.md

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

44
| | Linux | macOS | Windows |
55
| :--- | :---: | :---: | :---: |
6-
| Chromium <!-- GEN:chromium-version -->133.0.6943.16<!-- GEN:stop --> ||||
7-
| WebKit <!-- GEN:webkit-version -->18.2<!-- GEN:stop --> ||||
8-
| Firefox <!-- GEN:firefox-version -->134.0<!-- GEN:stop --> ||||
6+
| Chromium <!-- GEN:chromium-version -->134.0.6998.35<!-- GEN:stop --> ||||
7+
| WebKit <!-- GEN:webkit-version -->18.4<!-- GEN:stop --> ||||
8+
| Firefox <!-- GEN:firefox-version -->135.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.50.0</AssemblyVersion>
44
<PackageVersion>$(AssemblyVersion)</PackageVersion>
5-
<DriverVersion>1.50.1</DriverVersion>
5+
<DriverVersion>1.51.0-beta-1741166263000</DriverVersion>
66
<ReleaseVersion>$(AssemblyVersion)</ReleaseVersion>
77
<FileVersion>$(AssemblyVersion)</FileVersion>
88
<NoDefaultExcludes>true</NoDefaultExcludes>

src/Playwright.TestingHarnessTest/package-lock.json

Lines changed: 23 additions & 27 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.50.1",
5+
"@playwright/test": "1.51.0-beta-1741166263000",
66
"@types/node": "^22.12.0",
77
"fast-xml-parser": "^4.5.0"
88
}

src/Playwright.Tests/Assertions/LocatorAssertionsTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,10 @@ public async Task ShouldSupportToContainText()
452452
await Expect(locator).ToHaveTextAsync(new Regex("Text\\s+content"));
453453
// Should respect ignoreCase.
454454
await Expect(Page.Locator("#node")).ToHaveTextAsync(new Regex("Text\\s+cONtent"), new() { IgnoreCase = true });
455+
// Should support falsy ignoreCase.
456+
await Expect(Page.Locator("#node")).Not.ToHaveTextAsync("TEXT CONTENT", new() { IgnoreCase = false });
457+
// Should normalize soft hyphens.
458+
await Expect(Page.Locator("#node")).ToHaveTextAsync("T\u00ade\u00adxt content");
455459
}
456460
{
457461
await Page.SetContentAsync("<div id=node>Text content</div>");

src/Playwright.Tests/BrowserContextStorageStateTests.cs

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ await page1.EvaluateAsync(@"() =>
4949
string storage = await Context.StorageStateAsync();
5050

5151
// TODO: think about IVT-in the StorageState and serializing
52-
string expected = @"{""cookies"":[],""origins"":[{""origin"":""https://www.domain.com"",""localStorage"":[{""name"":""name2"",""value"":""value2""}]},{""origin"":""https://www.example.com"",""localStorage"":[{""name"":""name1"",""value"":""value1""}]}]}";
52+
string expected = @"{""cookies"":[],""origins"":[{""origin"":""https://www.domain.com"",""localStorage"":[{""name"":""name2"",""value"":""value2""}],""indexedDB"":[]},{""origin"":""https://www.example.com"",""localStorage"":[{""name"":""name1"",""value"":""value1""}],""indexedDB"":[]}]}";
5353
Assert.AreEqual(expected, storage);
5454
}
5555

@@ -82,14 +82,30 @@ await page1.RouteAsync("**/*", (route) =>
8282
});
8383

8484
await page1.GotoAsync("https://www.example.com");
85-
await page1.EvaluateAsync(@"() =>
85+
await page1.EvaluateAsync(@"async () =>
8686
{
8787
localStorage['name1'] = 'value1';
8888
document.cookie = 'username=John Doe';
89+
90+
await new Promise((resolve, reject) => {
91+
const openRequest = indexedDB.open('db', 42);
92+
openRequest.onupgradeneeded = () => {
93+
openRequest.result.createObjectStore('store');
94+
};
95+
openRequest.onsuccess = () => {
96+
const request = openRequest.result.transaction('store', 'readwrite')
97+
.objectStore('store')
98+
.put('foo', 'bar');
99+
request.addEventListener('success', resolve);
100+
request.addEventListener('error', reject);
101+
};
102+
});
103+
104+
return document.cookie;
89105
}");
90106
using var tempDir = new TempDirectory();
91107
string path = Path.Combine(tempDir.Path, "storage-state.json");
92-
string storage = await Context.StorageStateAsync(new() { Path = path });
108+
string storage = await Context.StorageStateAsync(new() { IndexedDB = true, Path = path });
93109
Assert.AreEqual(storage, File.ReadAllText(path));
94110

95111
await using var context = await Browser.NewContextAsync(new() { StorageStatePath = path });
@@ -102,6 +118,22 @@ await page2.RouteAsync("**/*", (route) =>
102118
await page2.GotoAsync("https://www.example.com");
103119
Assert.AreEqual("value1", await page2.EvaluateAsync<string>("localStorage['name1']"));
104120
Assert.AreEqual("username=John Doe", await page2.EvaluateAsync<string>("document.cookie"));
121+
122+
var idbValue = await page2.EvaluateAsync<string>(@"
123+
() => {
124+
return new Promise((resolve, reject) => {
125+
const openRequest = indexedDB.open('db', 42);
126+
openRequest.addEventListener('success', () => {
127+
const db = openRequest.result;
128+
const transaction = db.transaction('store', 'readonly');
129+
const getRequest = transaction.objectStore('store').get('bar');
130+
getRequest.addEventListener('success', () => resolve(getRequest.result));
131+
getRequest.addEventListener('error', () => reject(getRequest.error));
132+
});
133+
openRequest.addEventListener('error', () => reject(openRequest.error));
134+
});
135+
}");
136+
Assert.AreEqual("foo", idbValue);
105137
}
106138

107139
[PlaywrightTest("browsercontext-storage-state.spec.ts", "should capture cookies")]

src/Playwright.Tests/DefaultBrowsercontext2Tests.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,22 @@ public async Task ShouldSupportReducedMotionOption()
9393
tmp.Dispose();
9494
}
9595

96+
[PlaywrightTest("defaultbrowsercontext-2.spec.ts", "should support contrast option")]
97+
public async Task ShouldSupportContrastOption()
98+
{
99+
var (tmp, context, page) = await LaunchAsync(new()
100+
{
101+
Contrast = Contrast.More
102+
});
103+
104+
105+
Assert.IsTrue(await page.EvaluateAsync<bool>("() => matchMedia('(prefers-contrast: more)').matches"));
106+
Assert.IsFalse(await page.EvaluateAsync<bool>("() => matchMedia('(prefers-contrast: no-preference)').matches"));
107+
108+
await context.DisposeAsync();
109+
tmp.Dispose();
110+
}
111+
96112
[PlaywrightTest("defaultbrowsercontext-2.spec.ts", "should support timezoneId option")]
97113
public async Task ShouldSupportTimezoneIdOption()
98114
{
@@ -195,6 +211,18 @@ public async Task ShouldAcceptUserDataDir()
195211
tmp.Dispose();
196212
}
197213

214+
[PlaywrightTest("defaultbrowsercontext-2.spec.ts", "should accept relative userDataDir")]
215+
public async Task ShouldAcceptRelativeUserDataDir()
216+
{
217+
var tmp = new TempDirectory();
218+
var foobar = System.IO.Path.Combine(tmp.Path, "foobar");
219+
var userDataDir = System.IO.Path.GetRelativePath(Environment.CurrentDirectory, foobar);
220+
var context = await BrowserType.LaunchPersistentContextAsync(userDataDir);
221+
Assert.IsNotEmpty(new DirectoryInfo(foobar).GetDirectories());
222+
await context.CloseAsync();
223+
tmp.Dispose();
224+
}
225+
198226
[PlaywrightTest("defaultbrowsercontext-2.spec.ts", "should restore state from userDataDir")]
199227
public async Task ShouldRestoreStateFromUserDataDir()
200228
{

src/Playwright.Tests/GlobalFetchTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,22 @@ public async Task ShouldSerializeNullValuesInJSON()
465465
await request.DisposeAsync();
466466
}
467467

468+
[PlaywrightTest("global-fetch.spec.ts", "should throw when failOnStatusCode is set to true inside APIRequest context options")]
469+
public async Task ShouldThrowWhenFailOnStatusCodeIsSet()
470+
{
471+
var request = await Playwright.APIRequest.NewContextAsync(new() { FailOnStatusCode = true });
472+
Server.SetRoute("/empty.html", async (ctx) =>
473+
{
474+
ctx.Response.StatusCode = 404;
475+
ctx.Response.Headers.Append("Content-Length", "10");
476+
ctx.Response.Headers.Append("Content-Type", "text/plain");
477+
await ctx.Response.WriteAsync("Not found.");
478+
});
479+
var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(async () => await request.PostAsync(Server.Prefix + "/empty.html"));
480+
StringAssert.Contains("404 Not Found", exception.Message);
481+
await request.DisposeAsync();
482+
}
483+
468484
[PlaywrightTest("global-fetch.spec.ts", "should retry ECONNRESET")]
469485
public async Task ShouldRetryECONNRESET()
470486
{

src/Playwright.Tests/Locator/LocatorMisc2Tests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ public async Task ShouldCombineVisibleWithOtherSelectors()
199199
await Expect(Page.Locator(".item >> visible=true >> text=data3")).ToHaveTextAsync("visible data3");
200200
}
201201

202+
[PlaywrightTest("locator-misc-2.spec.ts", "should support filter(visible)")]
203+
public async Task LocatorShouldSupportFilterVisible()
204+
{
205+
await Page.SetContentAsync("<div><div class='item' style='display: none'>Hidden data0</div><div class='item'>visible data1</div><div class='item' style='display: none'>Hidden data1</div><div class='item'>visible data2</div><div class='item' style='display: none'>Hidden data2</div><div class='item'>visible data3</div></div>");
206+
await Expect(Page.Locator(".item").Filter(new() { Visible = true }).Nth(1)).ToHaveTextAsync("visible data2");
207+
await Expect(Page.Locator(".item").Filter(new() { Visible = true }).GetByText("data3")).ToHaveTextAsync("visible data3");
208+
await Expect(Page.Locator(".item").Filter(new() { Visible = false }).GetByText("data1")).ToHaveTextAsync("Hidden data1");
209+
}
210+
202211
[PlaywrightTest("locator-misc-2.spec.ts", "locator.count should work with deleted Map in main world")]
203212
public async Task LocatorCountShouldWorkWithDeletedMapInMainWorld()
204213
{

src/Playwright.Tests/PageEmulateMediaTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,18 @@ public async Task ShouldEmulateForcedColors()
171171
await Page.EmulateMediaAsync(new() { ForcedColors = ForcedColors.Null });
172172
Assert.IsTrue(await Page.EvaluateAsync<bool>("() => matchMedia('(forced-colors: none)').matches"));
173173
}
174+
175+
[PlaywrightTest("page-emulate-media.spec.ts", "should emulate contrast")]
176+
public async Task ShouldEmulateContrast()
177+
{
178+
Assert.IsTrue(await Page.EvaluateAsync<bool>("() => matchMedia('(prefers-contrast: no-preference)').matches"));
179+
await Page.EmulateMediaAsync(new() { Contrast = Contrast.NoPreference });
180+
Assert.IsTrue(await Page.EvaluateAsync<bool>("() => matchMedia('(prefers-contrast: no-preference)').matches"));
181+
Assert.IsFalse(await Page.EvaluateAsync<bool>("() => matchMedia('(prefers-contrast: more)').matches"));
182+
await Page.EmulateMediaAsync(new() { Contrast = Contrast.More });
183+
Assert.IsFalse(await Page.EvaluateAsync<bool>("() => matchMedia('(prefers-contrast: no-preference)').matches"));
184+
Assert.IsTrue(await Page.EvaluateAsync<bool>("() => matchMedia('(prefers-contrast: more)').matches"));
185+
await Page.EmulateMediaAsync(new() { Contrast = Contrast.Null });
186+
Assert.IsTrue(await Page.EvaluateAsync<bool>("() => matchMedia('(prefers-contrast: no-preference)').matches"));
187+
}
174188
}

0 commit comments

Comments
 (0)