Skip to content

Commit 85ec3cd

Browse files
authored
chore: roll driver to 1.56.1 (#3250)
1 parent 183c465 commit 85ec3cd

File tree

20 files changed

+247
-81
lines changed

20 files changed

+247
-81
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 -->140.0.7339.16<!-- GEN:stop --> ||||
6+
| Chromium <!-- GEN:chromium-version -->141.0.7390.37<!-- GEN:stop --> ||||
77
| WebKit <!-- GEN:webkit-version -->26.0<!-- GEN:stop --> ||||
8-
| Firefox <!-- GEN:firefox-version -->141.0<!-- GEN:stop --> ||||
8+
| Firefox <!-- GEN:firefox-version -->142.0.1<!-- 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.55.0</AssemblyVersion>
44
<PackageVersion>$(AssemblyVersion)</PackageVersion>
5-
<DriverVersion>1.55.0-beta-1756314050000</DriverVersion>
5+
<DriverVersion>1.56.1</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.55.0-beta-1756314050000",
5+
"@playwright/test": "1.56.1",
66
"@types/node": "^22.12.0",
77
"fast-xml-parser": "^4.5.0"
88
}

src/Playwright.Tests/Assertions/LocatorAssertionsTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,4 +819,23 @@ public async Task ToHaveRole()
819819
await Expect(Page.Locator("div")).ToHaveRoleAsync(AriaRole.Button);
820820
await Expect(Page.Locator("div")).Not.ToHaveRoleAsync(AriaRole.Checkbox);
821821
}
822+
823+
[PlaywrightTest("page/expect-misc.spec.ts", "strict mode violation error format")]
824+
public async Task StrictModeViolationErrorFormat()
825+
{
826+
await Page.SetContentAsync(@"<div>hello</div><div>hi</div>");
827+
var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(() => Expect(Page.Locator("div")).ToBeVisibleAsync());
828+
StringAssert.Contains("Locator expected to be visible", exception.Message);
829+
StringAssert.Contains("Error: strict mode violation: Locator(\"div\") resolved to 2 elements:", exception.Message);
830+
}
831+
832+
833+
[PlaywrightTest("page/expect-misc.spec.ts", "invalid selector error format")]
834+
public async Task InvalidSelectorErrorFormat()
835+
{
836+
await Page.SetContentAsync(@"<div>a</div><div>b</div>");
837+
var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(() => Expect(Page.Locator("##")).ToBeVisibleAsync());
838+
StringAssert.Contains("Locator expected to be visible", exception.Message);
839+
StringAssert.Contains("Error: Unexpected token \"#\" while parsing css selector \"##\".", exception.Message);
840+
}
822841
}

src/Playwright.Tests/InterceptionTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ bool URLMatches(string baseURL, string url, string glob)
9595
Assert.False(URLMatches(null, "https://playwright.dev/foobar", "https://playwright.dev/fooBAR"));
9696
Assert.False(URLMatches(null, "https://playwright.dev/foobar?a=b", "https://playwright.dev/foobar?A=B"));
9797

98+
Assert.True(URLMatches(null, "https://localhost:3000/?a=b", "**/?a=b"));
99+
Assert.True(URLMatches(null, "https://localhost:3000/?a=b", "**?a=b"));
100+
Assert.True(URLMatches(null, "https://localhost:3000/?a=b", "**=b"));
101+
98102
// This is not supported, we treat ? as a query separator.
99103
Assert.That("http://localhost:8080/Simple/path.js", Does.Not.Match(GlobToRegex("http://localhost:8080/?imple/path.js")));
100104
Assert.False(URLMatches(null, "http://playwright.dev/", "http://playwright.?ev"));

src/Playwright.Tests/PageAriaSnapshotTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,16 @@ await Expect(Page.Locator("body")).ToMatchAriaSnapshotAsync(@"
143143
- /url: /.*example.com/
144144
");
145145
}
146+
147+
[PlaywrightTest("page-aria-snapshot.spec.ts", "match values both against regex and string")]
148+
public async Task MatchValuesBothAgainstRegexAndString()
149+
{
150+
await Page.SetContentAsync(@"
151+
<a href='/auth?r=/'>Log in</a>
152+
");
153+
await Expect(Page.Locator("body")).ToMatchAriaSnapshotAsync(@"
154+
- link ""Log in"":
155+
- /url: /auth?r=/
156+
");
157+
}
146158
}

src/Playwright.Tests/PageEventConsoleTests.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public async Task ShouldTriggerCorrectLog()
118118
Page.WaitForConsoleMessageAsync(),
119119
Page.EvaluateAsync("async url => fetch(url).catch (e => { })", Server.EmptyPage)
120120
);
121-
StringAssert.Contains("Access-Control-Allow-Origin", messageEvent.Text);
121+
Assert.True(messageEvent.Text.Contains("Access-Control-Allow-Origin") || messageEvent.Text.Contains("blocked by CORS policy"));
122122
Assert.AreEqual("error", messageEvent.Type);
123123
}
124124

@@ -159,4 +159,25 @@ public async Task ShouldNotThrowWhenThereAreConsoleMessagesInDetachedIframes()
159159
// 4. Connect to the popup and make sure it doesn't throw.
160160
Assert.AreEqual(2, await popup.EvaluateAsync<int>("1 + 1"));
161161
}
162+
163+
[PlaywrightTest("page-event-console.spec.ts", "consoleMessages should work")]
164+
public async Task ConsoleMessagesShouldWork()
165+
{
166+
await Page.EvaluateAsync(@"() => {
167+
for (let i = 0; i < 301; i++)
168+
console.log('message' + i);
169+
}");
170+
171+
var messages = await Page.ConsoleMessagesAsync();
172+
Assert.True(messages.Count >= 100, "should be at least 100 messages");
173+
174+
int firstIndex = messages.Count - 100;
175+
for (int i = 0; i < 100; i++)
176+
{
177+
var message = messages[firstIndex + i];
178+
Assert.AreEqual("message" + (201 + i), message.Text);
179+
Assert.AreEqual("log", message.Type);
180+
Assert.AreEqual(Page, message.Page);
181+
}
182+
}
162183
}

src/Playwright.Tests/PageEventPageErrorTests.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,26 @@ public async Task ShouldHandleWindow()
131131

132132
StringAssert.Contains(TestConstants.IsChromium ? "Window" : "[object Window]", error);
133133
}
134+
135+
[PlaywrightTest("page-event-pageerror.spec.ts", "pageErrors should work")]
136+
public async Task PageErrorsShouldWork()
137+
{
138+
await Page.GotoAsync(Server.EmptyPage);
139+
await Page.EvaluateAsync(@"async () => {
140+
for (let i = 0; i < 301; i++)
141+
window.setTimeout(() => { throw new Error('error' + i); }, 0);
142+
await new Promise(f => window.setTimeout(f, 100));
143+
}");
144+
145+
var errors = await Page.PageErrorsAsync();
146+
Assert.True(errors.Count >= 100, "should be at least 100 errors");
147+
148+
// Check the last 100 errors (indices 201-300)
149+
int firstIndex = errors.Count - 100;
150+
for (int i = 0; i < 100; i++)
151+
{
152+
string error = errors[firstIndex + i];
153+
Assert.True(error.StartsWith("Error: error" + (201 + i)), error);
154+
}
155+
}
134156
}

src/Playwright.Tests/PageEventRequestTests.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,47 @@ public async Task ShouldReportRequestsAndResponsesHandledByServiceWorker()
7272
Assert.AreEqual(Server.Prefix + "/serviceworkers/fetchdummy/foo", response.Url);
7373
Assert.AreEqual("responseFromServiceWorker:foo", await response.TextAsync());
7474
}
75+
76+
[PlaywrightTest("page-event-request.spec.ts", "should return last requests")]
77+
public async Task ShouldReturnLastRequests()
78+
{
79+
await Page.GotoAsync(Server.Prefix + "/title.html");
80+
81+
// Set up routes for 200 requests
82+
for (int i = 0; i < 200; ++i)
83+
{
84+
Server.SetRoute("/fetch-" + i, context =>
85+
{
86+
context.Response.StatusCode = 200;
87+
return context.Response.WriteAsync("url:" + Server.Prefix + context.Request.Path);
88+
});
89+
}
90+
91+
// #0 is the navigation request, so start with #1.
92+
for (int i = 0; i < 99; ++i)
93+
{
94+
await Page.EvaluateAsync("url => fetch(url)", Server.Prefix + "/fetch-" + i);
95+
}
96+
var first99Requests = (await Page.RequestsAsync()).ToList();
97+
first99Requests.RemoveAt(0); // Remove the navigation request
98+
99+
for (int i = 99; i < 199; ++i)
100+
{
101+
await Page.EvaluateAsync("url => fetch(url)", Server.Prefix + "/fetch-" + i);
102+
}
103+
var last100Requests = await Page.RequestsAsync();
104+
var allRequests = new List<IRequest>();
105+
allRequests.AddRange(first99Requests);
106+
allRequests.AddRange(last100Requests);
107+
108+
// All 199 requests are fully functional.
109+
int index = 0;
110+
foreach (var request in allRequests)
111+
{
112+
var response = await request.ResponseAsync();
113+
Assert.AreEqual("url:" + Server.Prefix + "/fetch-" + index, await response.TextAsync());
114+
Assert.AreEqual(Server.Prefix + "/fetch-" + index, request.Url);
115+
index++;
116+
}
117+
}
75118
}

0 commit comments

Comments
 (0)