Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(roll): roll Playwright to v1.47.0 #3000

Merged
merged 2 commits into from
Sep 9, 2024
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->128.0.6613.18<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Chromium <!-- GEN:chromium-version -->129.0.6668.29<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| WebKit <!-- GEN:webkit-version -->18.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->128.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->130.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |

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

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.46.0</AssemblyVersion>
<PackageVersion>$(AssemblyVersion)</PackageVersion>
<DriverVersion>1.46.0</DriverVersion>
<DriverVersion>1.47.0</DriverVersion>
<ReleaseVersion>$(AssemblyVersion)</ReleaseVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<NoDefaultExcludes>true</NoDefaultExcludes>
Expand Down
29 changes: 21 additions & 8 deletions src/Playwright.Tests/BrowserContextFetchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,35 @@ public async Task ShouldAddSessionCookiesToRequest()
Assert.AreEqual("username=John Doe", cookieHeader);
}

[PlaywrightTest("browsercontext-fetch.spec.ts", "should support queryParams")]
public async Task ShouldSupportQueryParams()
[PlaywrightTest("browsercontext-fetch.spec.ts", "should support paras passed as object")]
public async Task ShouldSupportParamsPassedAsObject()
{
var queryString = new QueryString();
queryString.Add("p1", "v1");
queryString.Add("парам2", "знач2");
var requestOptions = new APIRequestContextOptions() { Params = new Dictionary<string, object>() { { "p1", "v1" }, { "парам2", "знач2" } } };
var requestOptions = new APIRequestContextOptions() { Params = new Dictionary<string, object>() { { "param1", "value1" }, { "парам2", "знач2" } } };
await ForAllMethods(Context.APIRequest, async responseTask =>
{
var (receivedQueryString, _) = await TaskUtils.WhenAll(
Server.WaitForRequest("/empty.html", request => request.Query),
responseTask
);
Assert.AreEqual("v1", receivedQueryString["p1"].First());
CollectionAssert.AreEquivalent(new[] { "value1", "value2" }, receivedQueryString["param1"]);
Assert.AreEqual("знач2", receivedQueryString["парам2"].First());
}, Server.Prefix + "/empty.html?" + queryString.ToString(), requestOptions);
}, Server.Prefix + "/empty.html?param1=value2", requestOptions);
}

[PlaywrightTest("browsercontext-fetch.spec.ts", "should support params passed as string")]
public async Task ShouldSupportParamsPassedAsString()
{
var queryParams = "?param1=value1&param1=value2&парам2=знач2";
var requestOptions = new APIRequestContextOptions() { ParamsString = queryParams };
await ForAllMethods(Context.APIRequest, async responseTask =>
{
var (receivedQueryString, _) = await TaskUtils.WhenAll(
Server.WaitForRequest("/empty.html", request => request.Query),
responseTask
);
CollectionAssert.AreEquivalent(new[] { "value1", "value2" }, receivedQueryString["param1"]);
Assert.AreEqual("знач2", string.Join(",", receivedQueryString["парам2"]));
}, Server.Prefix + "/empty.html", requestOptions);
}

[PlaywrightTest("browsercontext-fetch.spec.ts", "should support failOnStatusCode")]
Expand Down
34 changes: 34 additions & 0 deletions src/Playwright.Tests/ClientCertficatesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,40 @@ public async Task ShouldWorkWithNewContext()
await context.CloseAsync();
}

[PlaywrightTest("", "")]
public async Task ShouldWorkWithNewContextAndCertificateAsContent()
{
var context = await Browser.NewContextAsync(new()
{
IgnoreHTTPSErrors = true,
ClientCertificates =
[
new()
{
Origin = "https://localhost:10000",
Cert = File.ReadAllBytes(TestUtils.GetAsset("client-certificates/client/trusted/cert.pem")),
Key = File.ReadAllBytes(TestUtils.GetAsset("client-certificates/client/trusted/key.pem")),
}
]
});
var page = await context.NewPageAsync();
{
await page.GotoAsync("https://127.0.0.1:10000");
await Expect(page.GetByTestId("message")).ToHaveTextAsync("Sorry, but you need to provide a client certificate to continue.");

var response = await page.APIRequest.GetAsync("https://127.0.0.1:10000");
StringAssert.Contains("Sorry, but you need to provide a client certificate to continue", await response.TextAsync());
}
{
await page.GotoAsync("https://localhost:10000");
await Expect(page.GetByText("Hello CN=Alice")).ToBeVisibleAsync();

var response = await page.APIRequest.GetAsync("https://localhost:10000");
StringAssert.Contains("Hello CN=Alice", await response.TextAsync());
}
await context.CloseAsync();
}

[PlaywrightTest("", "")]
public async Task ShouldWorkWithNewPage()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Playwright/API/Generated/IAPIResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public partial interface IAPIResponse

/// <summary>
/// <para>
/// An array with all the request HTTP headers associated with this response. Header
/// An array with all the response HTTP headers associated with this response. Header
/// names are not lower-cased. Headers with multiple entries, such as <c>Set-Cookie</c>,
/// appear in the array multiple times.
/// </para>
Expand Down
4 changes: 2 additions & 2 deletions src/Playwright/API/Generated/IBrowserContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ namespace Microsoft.Playwright;
/// belong to the parent page's browser context.
/// </para>
/// <para>
/// Playwright allows creating "incognito" browser contexts with <see cref="IBrowser.NewContextAsync"/>
/// method. "Incognito" browser contexts don't write any browsing data to disk.
/// Playwright allows creating isolated non-persistent browser contexts with <see cref="IBrowser.NewContextAsync"/>
/// method. Non-persistent browser contexts don't write any browsing data to disk.
/// </para>
/// <code>
/// using var playwright = await Playwright.CreateAsync();<br/>
Expand Down
10 changes: 5 additions & 5 deletions src/Playwright/API/Generated/IPageAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ public partial interface IPageAssertions
/// Makes the assertion check for the opposite condition. For example, this code tests
/// that the page URL doesn't contain <c>"error"</c>:
/// </para>
/// <code>await Expect(Page).Not.ToHaveURL("error");</code>
/// <code>await Expect(Page).Not.ToHaveURLAsync("error");</code>
/// </summary>
public IPageAssertions Not { get; }

/// <summary>
/// <para>Ensures the page has the given title.</para>
/// <para>**Usage**</para>
/// <code>await Expect(Page).ToHaveTitle("Playwright");</code>
/// <code>await Expect(Page).ToHaveTitleAsync("Playwright");</code>
/// </summary>
/// <param name="titleOrRegExp">Expected title or RegExp.</param>
/// <param name="options">Call options</param>
Expand All @@ -76,7 +76,7 @@ public partial interface IPageAssertions
/// <summary>
/// <para>Ensures the page has the given title.</para>
/// <para>**Usage**</para>
/// <code>await Expect(Page).ToHaveTitle("Playwright");</code>
/// <code>await Expect(Page).ToHaveTitleAsync("Playwright");</code>
/// </summary>
/// <param name="titleOrRegExp">Expected title or RegExp.</param>
/// <param name="options">Call options</param>
Expand All @@ -85,7 +85,7 @@ public partial interface IPageAssertions
/// <summary>
/// <para>Ensures the page is navigated to the given URL.</para>
/// <para>**Usage**</para>
/// <code>await Expect(Page).ToHaveURL(new Regex(".*checkout"));</code>
/// <code>await Expect(Page).ToHaveURLAsync(new Regex(".*checkout"));</code>
/// </summary>
/// <param name="urlOrRegExp">Expected URL string or RegExp.</param>
/// <param name="options">Call options</param>
Expand All @@ -94,7 +94,7 @@ public partial interface IPageAssertions
/// <summary>
/// <para>Ensures the page is navigated to the given URL.</para>
/// <para>**Usage**</para>
/// <code>await Expect(Page).ToHaveURL(new Regex(".*checkout"));</code>
/// <code>await Expect(Page).ToHaveURLAsync(new Regex(".*checkout"));</code>
/// </summary>
/// <param name="urlOrRegExp">Expected URL string or RegExp.</param>
/// <param name="options">Call options</param>
Expand Down
18 changes: 16 additions & 2 deletions src/Playwright/API/Generated/IRoute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public partial interface IRoute
Task AbortAsync(string? errorCode = default);

/// <summary>
/// <para>Continues route's request with optional overrides.</para>
/// <para>Sends route's request to the network with optional overrides.</para>
/// <para>**Usage**</para>
/// <code>
/// await page.RouteAsync("**/*", async route =&gt;<br/>
Expand All @@ -91,19 +91,29 @@ public partial interface IRoute
/// through redirects, use the combination of <see cref="IRoute.FetchAsync"/> and <see
/// cref="IRoute.FulfillAsync"/> instead.
/// </para>
/// <para>
/// <see cref="IRoute.ContinueAsync"/> will immediately send the request to the network,
/// other matching handlers won't be invoked. Use <see cref="IRoute.FallbackAsync"/>
/// If you want next matching handler in the chain to be invoked.
/// </para>
/// </summary>
/// <param name="options">Call options</param>
Task ContinueAsync(RouteContinueOptions? options = default);

/// <summary>
/// <para>
/// Continues route's request with optional overrides. The method is similar to <see
/// cref="IRoute.ContinueAsync"/> with the difference that other matching handlers will
/// be invoked before sending the request.
/// </para>
/// <para>**Usage**</para>
/// <para>
/// When several routes match the given pattern, they run in the order opposite to their
/// registration. That way the last registered route can always override all the previous
/// ones. In the example below, request will be handled by the bottom-most handler first,
/// then it'll fall back to the previous one and in the end will be aborted by the first
/// registered route.
/// </para>
/// <para>**Usage**</para>
/// <code>
/// await page.RouteAsync("**/*", route =&gt; {<br/>
/// // Runs last.<br/>
Expand Down Expand Up @@ -158,6 +168,10 @@ public partial interface IRoute
/// await route.FallbackAsync(new() { Headers = headers });<br/>
/// });
/// </code>
/// <para>
/// Use <see cref="IRoute.ContinueAsync"/> to immediately send the request to the network,
/// other matching handlers won't be invoked in that case.
/// </para>
/// </summary>
/// <param name="options">Call options</param>
Task FallbackAsync(RouteFallbackOptions? options = default);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public APIRequestContextOptions(APIRequestContextOptions clone)
Method = clone.Method;
Multipart = clone.Multipart;
Params = clone.Params;
ParamsString = clone.ParamsString;
Timeout = clone.Timeout;
}

Expand Down Expand Up @@ -181,6 +182,10 @@ public APIRequestContextOptions(APIRequestContextOptions clone)
[JsonPropertyName("params")]
public IEnumerable<KeyValuePair<string, object>>? Params { get; set; }

/// <summary><para>Query parameters to be sent with the URL.</para></summary>
[JsonPropertyName("paramsString")]
public string? ParamsString { get; set; }

/// <summary>
/// <para>
/// Request timeout in milliseconds. Defaults to <c>30000</c> (30 seconds). Pass <c>0</c>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ public APIRequestNewContextOptions(APIRequestNewContextOptions clone)
/// </para>
/// <para>**Details**</para>
/// <para>
/// An array of client certificates to be used. Each certificate object must have both
/// <c>certPath</c> and <c>keyPath</c> or a single <c>pfxPath</c> to load the client
/// certificate. Optionally, <c>passphrase</c> property should be provided if the certficiate
/// is encrypted. The <c>origin</c> property should be provided with an exact match
/// to the request origin that the certificate is valid for.
/// An array of client certificates to be used. Each certificate object must have either
/// both <c>certPath</c> and <c>keyPath</c>, a single <c>pfxPath</c>, or their corresponding
/// direct value equivalents (<c>cert</c> and <c>key</c>, or <c>pfx</c>). Optionally,
/// <c>passphrase</c> property should be provided if the certificate is encrypted. The
/// <c>origin</c> property should be provided with an exact match to the request origin
/// that the certificate is valid for.
/// </para>
/// </summary>
/// <remarks>
Expand Down
19 changes: 6 additions & 13 deletions src/Playwright/API/Generated/Options/BrowserNewContextOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ public BrowserNewContextOptions(BrowserNewContextOptions clone)
/// </para>
/// <para>**Details**</para>
/// <para>
/// An array of client certificates to be used. Each certificate object must have both
/// <c>certPath</c> and <c>keyPath</c> or a single <c>pfxPath</c> to load the client
/// certificate. Optionally, <c>passphrase</c> property should be provided if the certficiate
/// is encrypted. The <c>origin</c> property should be provided with an exact match
/// to the request origin that the certificate is valid for.
/// An array of client certificates to be used. Each certificate object must have either
/// both <c>certPath</c> and <c>keyPath</c>, a single <c>pfxPath</c>, or their corresponding
/// direct value equivalents (<c>cert</c> and <c>key</c>, or <c>pfx</c>). Optionally,
/// <c>passphrase</c> property should be provided if the certificate is encrypted. The
/// <c>origin</c> property should be provided with an exact match to the request origin
/// that the certificate is valid for.
/// </para>
/// </summary>
/// <remarks>
Expand Down Expand Up @@ -259,14 +260,6 @@ public BrowserNewContextOptions(BrowserNewContextOptions clone)
public IEnumerable<string>? Permissions { get; set; }

/// <summary><para>Network proxy settings to use with this context. Defaults to none.</para></summary>
/// <remarks>
/// <para>
/// For Chromium on Windows the browser needs to be launched with the global proxy for
/// this option to work. If all contexts override the proxy, global proxy will be never
/// used and can be any string, for example <c>launch({ proxy: { server: 'http://per-context'
/// } })</c>.
/// </para>
/// </remarks>
[JsonPropertyName("proxy")]
public Proxy? Proxy { get; set; }

Expand Down
19 changes: 6 additions & 13 deletions src/Playwright/API/Generated/Options/BrowserNewPageOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ public BrowserNewPageOptions(BrowserNewPageOptions clone)
/// </para>
/// <para>**Details**</para>
/// <para>
/// An array of client certificates to be used. Each certificate object must have both
/// <c>certPath</c> and <c>keyPath</c> or a single <c>pfxPath</c> to load the client
/// certificate. Optionally, <c>passphrase</c> property should be provided if the certficiate
/// is encrypted. The <c>origin</c> property should be provided with an exact match
/// to the request origin that the certificate is valid for.
/// An array of client certificates to be used. Each certificate object must have either
/// both <c>certPath</c> and <c>keyPath</c>, a single <c>pfxPath</c>, or their corresponding
/// direct value equivalents (<c>cert</c> and <c>key</c>, or <c>pfx</c>). Optionally,
/// <c>passphrase</c> property should be provided if the certificate is encrypted. The
/// <c>origin</c> property should be provided with an exact match to the request origin
/// that the certificate is valid for.
/// </para>
/// </summary>
/// <remarks>
Expand Down Expand Up @@ -259,14 +260,6 @@ public BrowserNewPageOptions(BrowserNewPageOptions clone)
public IEnumerable<string>? Permissions { get; set; }

/// <summary><para>Network proxy settings to use with this context. Defaults to none.</para></summary>
/// <remarks>
/// <para>
/// For Chromium on Windows the browser needs to be launched with the global proxy for
/// this option to work. If all contexts override the proxy, global proxy will be never
/// used and can be any string, for example <c>launch({ proxy: { server: 'http://per-context'
/// } })</c>.
/// </para>
/// </remarks>
[JsonPropertyName("proxy")]
public Proxy? Proxy { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,12 @@ public BrowserTypeLaunchPersistentContextOptions(BrowserTypeLaunchPersistentCont
/// </para>
/// <para>**Details**</para>
/// <para>
/// An array of client certificates to be used. Each certificate object must have both
/// <c>certPath</c> and <c>keyPath</c> or a single <c>pfxPath</c> to load the client
/// certificate. Optionally, <c>passphrase</c> property should be provided if the certficiate
/// is encrypted. The <c>origin</c> property should be provided with an exact match
/// to the request origin that the certificate is valid for.
/// An array of client certificates to be used. Each certificate object must have either
/// both <c>certPath</c> and <c>keyPath</c>, a single <c>pfxPath</c>, or their corresponding
/// direct value equivalents (<c>cert</c> and <c>key</c>, or <c>pfx</c>). Optionally,
/// <c>passphrase</c> property should be provided if the certificate is encrypted. The
/// <c>origin</c> property should be provided with an exact match to the request origin
/// that the certificate is valid for.
/// </para>
/// </summary>
/// <remarks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,8 @@ public ElementHandleSelectOptionOptions(ElementHandleSelectOptionOptions clone)
public bool? Force { get; set; }

/// <summary>
/// <para>**DEPRECATED** This option will default to <c>true</c> in the future.</para>
/// <para>
/// Actions that initiate navigations are waiting for these navigations to happen and
/// for pages to start loading. You can opt out of waiting via setting this flag. You
/// would only need this option in the exceptional cases such as navigating to inaccessible
/// pages. Defaults to <c>false</c>.
/// </para>
/// <para>**DEPRECATED** This option has no effect.</para>
/// <para>This option has no effect.</para>
/// </summary>
[JsonPropertyName("noWaitAfter")]
[System.Obsolete]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,8 @@ public FrameSelectOptionOptions(FrameSelectOptionOptions clone)
public bool? Force { get; set; }

/// <summary>
/// <para>**DEPRECATED** This option will default to <c>true</c> in the future.</para>
/// <para>
/// Actions that initiate navigations are waiting for these navigations to happen and
/// for pages to start loading. You can opt out of waiting via setting this flag. You
/// would only need this option in the exceptional cases such as navigating to inaccessible
/// pages. Defaults to <c>false</c>.
/// </para>
/// <para>**DEPRECATED** This option has no effect.</para>
/// <para>This option has no effect.</para>
/// </summary>
[JsonPropertyName("noWaitAfter")]
[System.Obsolete]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,8 @@ public LocatorSelectOptionOptions(LocatorSelectOptionOptions clone)
public bool? Force { get; set; }

/// <summary>
/// <para>**DEPRECATED** This option will default to <c>true</c> in the future.</para>
/// <para>
/// Actions that initiate navigations are waiting for these navigations to happen and
/// for pages to start loading. You can opt out of waiting via setting this flag. You
/// would only need this option in the exceptional cases such as navigating to inaccessible
/// pages. Defaults to <c>false</c>.
/// </para>
/// <para>**DEPRECATED** This option has no effect.</para>
/// <para>This option has no effect.</para>
/// </summary>
[JsonPropertyName("noWaitAfter")]
[System.Obsolete]
Expand Down
Loading
Loading