Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->136.0.7103.25<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Chromium <!-- GEN:chromium-version -->137.0.7151.27<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| WebKit <!-- GEN:webkit-version -->18.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->137.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |

Expand Down
2 changes: 1 addition & 1 deletion src/Common/Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyVersion>1.52.0</AssemblyVersion>
<PackageVersion>$(AssemblyVersion)</PackageVersion>
<DriverVersion>1.52.0</DriverVersion>
<DriverVersion>1.53.0-alpha-2025-05-21</DriverVersion>
<ReleaseVersion>$(AssemblyVersion)</ReleaseVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<NoDefaultExcludes>true</NoDefaultExcludes>
Expand Down
50 changes: 23 additions & 27 deletions src/Playwright.TestingHarnessTest/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Playwright.TestingHarnessTest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "playwright.testingharnesstest",
"private": true,
"devDependencies": {
"@playwright/test": "1.52.0",
"@playwright/test": "1.53.0-alpha-2025-05-21",
"@types/node": "^22.12.0",
"fast-xml-parser": "^4.5.0"
}
Expand Down
4 changes: 2 additions & 2 deletions src/Playwright.Tests/BrowserContextCookiesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ await Context.AddCookiesAsync(
Name = "doggo",
Value = "woofs"
},
]);
]);

void ValidateCookies(IReadOnlyList<BrowserContextCookiesResult> cookies)
{
Expand All @@ -230,6 +230,6 @@ void ValidateCookies(IReadOnlyList<BrowserContextCookiesResult> cookies)
ValidateCookies(await Context.CookiesAsync("https://foo.com"));
ValidateCookies(await Context.CookiesAsync(null as string));
ValidateCookies(await Context.CookiesAsync(null as string[]));
ValidateCookies(await Context.CookiesAsync([]));
ValidateCookies(await Context.CookiesAsync(new string[] { }));
}
}
16 changes: 0 additions & 16 deletions src/Playwright.Tests/PageAriaSnapshotTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,6 @@ await Expect(Page.Locator("body")).ToMatchAriaSnapshotAsync(@"
StringAssert.Contains("- unexpected value", exception.Message);
}

[PlaywrightTest("page-aria-snapshot.spec.ts", "should generate refs")]
public async Task ShouldGenerateRefs()
{
await Page.SetContentAsync(@"
<button>One</button>
<button>Two</button>
<button>Three</button>
");
var snapshot = await Page.Locator("body").AriaSnapshotAsync(new() { Ref = true });
Assert.AreEqual(_unshift(@"
- button ""One"" [ref=s1e3]
- button ""Two"" [ref=s1e4]
- button ""Three"" [ref=s1e5]
"), snapshot);
}

[PlaywrightTest("to-match-aria-snapshot.spec.ts", "should match url")]
public async Task ShouldMatchUrl()
{
Expand Down
37 changes: 19 additions & 18 deletions src/Playwright.Tests/TracingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ await Context.Tracing.StartAsync(new()
string[] expectedActionApiNames = new string[] { "BrowserContext.NewPageAsync", "Page.GotoAsync", "Page.SetContentAsync", "Page.ClickAsync", "Mouse.MoveAsync", "Mouse.DblClickAsync", "Keyboard.InsertTextAsync", "Page.WaitForTimeoutAsync", "Page.CloseAsync" };
Assert.AreEqual(expectedActionApiNames, actualActionApiNames);

Assert.GreaterOrEqual(events.Where(e => e?.ApiName == "Page.GotoAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.ApiName == "Page.SetContentAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.ApiName == "Page.ClickAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.ApiName == "Mouse.MoveAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.ApiName == "Mouse.DblClickAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.ApiName == "Keyboard.InsertTextAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.ApiName == "Page.CloseAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.Title == "Page.GotoAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.Title == "Page.SetContentAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.Title == "Page.ClickAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.Title == "Mouse.MoveAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.Title == "Mouse.DblClickAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.Title == "Keyboard.InsertTextAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(e => e?.Title == "Page.CloseAsync").Count(), 1);

Assert.GreaterOrEqual(events.Where(x => x.Type == "frame-snapshot").Count(), 1);
Assert.GreaterOrEqual(events.Where(x => x.Type == "screencast-frame").Count(), 1);
Expand Down Expand Up @@ -101,21 +101,21 @@ public async Task ShouldCollectTwoTraces()
{
var (events, resources) = ParseTrace(trace1Path);
Assert.AreEqual("context-options", events[0].Type);
Assert.GreaterOrEqual(events.Where(x => x?.ApiName == "Page.GotoAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(x => x?.ApiName == "Page.SetContentAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(x => x?.ApiName == "Page.ClickAsync").Count(), 1);
Assert.AreEqual(0, events.Where(x => x?.ApiName == "Page.CloseAsync").Count());
Assert.AreEqual(0, events.Where(x => x?.ApiName == "Page.DblClickAsync").Count());
Assert.GreaterOrEqual(events.Where(x => x?.Title == "Page.GotoAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(x => x?.Title == "Page.SetContentAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(x => x?.Title == "Page.ClickAsync").Count(), 1);
Assert.AreEqual(0, events.Where(x => x?.Title == "Page.CloseAsync").Count());
Assert.AreEqual(0, events.Where(x => x?.Title == "Page.DblClickAsync").Count());
}

{
var (events, resources) = ParseTrace(trace2Path);
Assert.AreEqual("context-options", events[0].Type);
Assert.AreEqual(0, events.Where(x => x?.ApiName == "Page.GottoAsync").Count());
Assert.AreEqual(0, events.Where(x => x?.ApiName == "Page.SetContentAsync").Count());
Assert.AreEqual(0, events.Where(x => x?.ApiName == "Page.ClickAsync").Count());
Assert.GreaterOrEqual(events.Where(x => x?.ApiName == "Page.CloseAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(x => x?.ApiName == "Page.DblClickAsync").Count(), 1);
Assert.AreEqual(0, events.Where(x => x?.Title == "Page.GottoAsync").Count());
Assert.AreEqual(0, events.Where(x => x?.Title == "Page.SetContentAsync").Count());
Assert.AreEqual(0, events.Where(x => x?.Title == "Page.ClickAsync").Count());
Assert.GreaterOrEqual(events.Where(x => x?.Title == "Page.CloseAsync").Count(), 1);
Assert.GreaterOrEqual(events.Where(x => x?.Title == "Page.DblClickAsync").Count(), 1);
}

}
Expand Down Expand Up @@ -415,6 +415,7 @@ private static (IReadOnlyList<TraceEventEntry> Events, Dictionary<string, byte[]
private class TraceEventEntry
{
public string Type { get; set; }
public string Title { get; set; }
public string ApiName { get; set; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public string ApiName { get; set; }

public TraceEventError Error { get; set; }
public double StartTime { get; set; }
Expand All @@ -428,5 +429,5 @@ private class TraceEventError
public string Message { get; set; }
}

string[] GetActions(IReadOnlyList<TraceEventEntry> events) => events.Where(action => action.Type == "action").OrderBy(action => action.StartTime).Select(action => action.ApiName).ToArray();
string[] GetActions(IReadOnlyList<TraceEventEntry> events) => events.Where(action => action.Type == "action").OrderBy(action => action.StartTime).Select(action => action.Title).ToArray();
}
14 changes: 14 additions & 0 deletions src/Playwright/API/Generated/ILocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,15 @@ public partial interface ILocator
/// <param name="options">Call options</param>
Task DblClickAsync(LocatorDblClickOptions? options = default);

/// <summary>
/// <para>
/// Describes the locator, description is used in the trace viewer and reports. Returns
/// the locator pointing to the same element.
/// </para>
/// </summary>
/// <param name="description">Locator description.</param>
ILocator Describe(string description);

/// <summary>
/// <para>Programmatically dispatch an event on the matching element.</para>
/// <para>**Usage**</para>
Expand Down Expand Up @@ -474,6 +483,11 @@ public partial interface ILocator
/// </para>
/// <para>If <see cref="ILocator.EvaluateAsync"/> throws or rejects, this method throws.</para>
/// <para>**Usage**</para>
/// <para>Passing argument to <see cref="ILocator.EvaluateAsync"/>:</para>
/// <code>
/// var result = await page.GetByTestId("myId").EvaluateAsync&lt;string&gt;("(element, [x, y]) =&gt; element.textContent + ' ' + x * y)", new[] { 7, 8 });<br/>
/// Console.WriteLine(result); // prints "myId text 56"
/// </code>
/// </summary>
/// <param name="expression">
/// JavaScript expression to be evaluated in the browser context. If the expression
Expand Down
12 changes: 6 additions & 6 deletions src/Playwright/API/Generated/ILocatorAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public partial interface ILocatorAssertions
/// matched against the corresponding class in the array:
/// </para>
/// <code>
/// var locator = Page.Locator("list &gt; .component");<br/>
/// var locator = Page.Locator(".list &gt; .component");<br/>
/// await Expect(locator).ToContainClassAsync(new string[]{"inactive", "active", "inactive"});
/// </code>
/// </summary>
Expand Down Expand Up @@ -261,7 +261,7 @@ public partial interface ILocatorAssertions
/// matched against the corresponding class in the array:
/// </para>
/// <code>
/// var locator = Page.Locator("list &gt; .component");<br/>
/// var locator = Page.Locator(".list &gt; .component");<br/>
/// await Expect(locator).ToContainClassAsync(new string[]{"inactive", "active", "inactive"});
/// </code>
/// </summary>
Expand Down Expand Up @@ -586,7 +586,7 @@ public partial interface ILocatorAssertions
/// is matched against the corresponding string or regular expression in the array:
/// </para>
/// <code>
/// var locator = Page.Locator("list &gt; .component");<br/>
/// var locator = Page.Locator(".list &gt; .component");<br/>
/// await Expect(locator).ToHaveClassAsync(new string[]{"component", "component selected", "component"});
/// </code>
/// </summary>
Expand All @@ -612,7 +612,7 @@ public partial interface ILocatorAssertions
/// is matched against the corresponding string or regular expression in the array:
/// </para>
/// <code>
/// var locator = Page.Locator("list &gt; .component");<br/>
/// var locator = Page.Locator(".list &gt; .component");<br/>
/// await Expect(locator).ToHaveClassAsync(new string[]{"component", "component selected", "component"});
/// </code>
/// </summary>
Expand All @@ -638,7 +638,7 @@ public partial interface ILocatorAssertions
/// is matched against the corresponding string or regular expression in the array:
/// </para>
/// <code>
/// var locator = Page.Locator("list &gt; .component");<br/>
/// var locator = Page.Locator(".list &gt; .component");<br/>
/// await Expect(locator).ToHaveClassAsync(new string[]{"component", "component selected", "component"});
/// </code>
/// </summary>
Expand All @@ -664,7 +664,7 @@ public partial interface ILocatorAssertions
/// is matched against the corresponding string or regular expression in the array:
/// </para>
/// <code>
/// var locator = Page.Locator("list &gt; .component");<br/>
/// var locator = Page.Locator(".list &gt; .component");<br/>
/// await Expect(locator).ToHaveClassAsync(new string[]{"component", "component selected", "component"});
/// </code>
/// </summary>
Expand Down
42 changes: 42 additions & 0 deletions src/Playwright/API/Generated/ITracing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ namespace Microsoft.Playwright;
/// Playwright script runs.
/// </para>
/// <para>
/// You probably want to <a href="https://playwright.dev/docs/api/class-testoptions#test-options-trace">enable
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment looks off.

/// tracing in your config file</a> instead of using <c>context.tracing</c>.
/// </para>
/// <para>
/// The <c>context.tracing</c> API captures browser operations and network activity,
/// but it doesn't record test assertions (like <c>expect</c> calls). We recommend <a
/// href="https://playwright.dev/docs/api/class-testoptions#test-options-trace">enabling
/// tracing through Playwright Test configuration</a>, which includes those assertions
/// and provides a more complete trace for debugging test failures.
/// </para>
/// <para>
/// Start recording a trace before performing actions. At the end, stop tracing and
/// save it to a file.
/// </para>
Expand All @@ -53,10 +64,31 @@ namespace Microsoft.Playwright;
/// });
/// </code>
/// </summary>
/// <remarks>
/// <para>
/// You probably want to <a href="https://playwright.dev/docs/api/class-testoptions#test-options-trace">enable
/// tracing in your config file</a> instead of using <c>context.tracing</c>. The <c>context.tracing</c>
/// API captures browser operations and network activity, but it doesn't record test
/// assertions (like <c>expect</c> calls). We recommend <a href="https://playwright.dev/docs/api/class-testoptions#test-options-trace">enabling
/// tracing through Playwright Test configuration</a>, which includes those assertions
/// and provides a more complete trace for debugging test failures.
/// </para>
/// </remarks>
public partial interface ITracing
{
/// <summary>
/// <para>Start tracing.</para>
/// <para>
/// You probably want to <a href="https://playwright.dev/docs/api/class-testoptions#test-options-trace">enable
/// tracing in your config file</a> instead of using <c>Tracing.start</c>.
/// </para>
/// <para>
/// The <c>context.tracing</c> API captures browser operations and network activity,
/// but it doesn't record test assertions (like <c>expect</c> calls). We recommend <a
/// href="https://playwright.dev/docs/api/class-testoptions#test-options-trace">enabling
/// tracing through Playwright Test configuration</a>, which includes those assertions
/// and provides a more complete trace for debugging test failures.
/// </para>
/// <para>**Usage**</para>
/// <code>
/// using var playwright = await Playwright.CreateAsync();<br/>
Expand All @@ -75,6 +107,16 @@ public partial interface ITracing
/// });
/// </code>
/// </summary>
/// <remarks>
/// <para>
/// You probably want to <a href="https://playwright.dev/docs/api/class-testoptions#test-options-trace">enable
/// tracing in your config file</a> instead of using <c>Tracing.start</c>. The <c>context.tracing</c>
/// API captures browser operations and network activity, but it doesn't record test
/// assertions (like <c>expect</c> calls). We recommend <a href="https://playwright.dev/docs/api/class-testoptions#test-options-trace">enabling
/// tracing through Playwright Test configuration</a>, which includes those assertions
/// and provides a more complete trace for debugging test failures.
/// </para>
/// </remarks>
/// <param name="options">Call options</param>
Task StartAsync(TracingStartOptions? options = default);

Expand Down
Loading