chore(roll): roll Playwright to 1.33.0-beta-1682447195000 (#2563)

This commit is contained in:
Max Schmitt
2023-04-27 16:41:39 +02:00
committed by GitHub
parent bc4062c760
commit 7c2c2aec1a
12 changed files with 163 additions and 41 deletions
+2 -2
View File
@@ -3,9 +3,9 @@
| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->113.0.5672.24<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Chromium <!-- GEN:chromium-version -->113.0.5672.53<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->111.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->112.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**.
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyVersion>1.32.0</AssemblyVersion>
<PackageVersion>$(AssemblyVersion)</PackageVersion>
<DriverVersion>1.33.0-alpha-apr-12-2023</DriverVersion>
<DriverVersion>1.33.0-beta-1682447195000</DriverVersion>
<ReleaseVersion>$(AssemblyVersion)</ReleaseVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<NoDefaultExcludes>true</NoDefaultExcludes>
+19 -10
View File
@@ -22,8 +22,6 @@
* SOFTWARE.
*/
using System.Drawing;
namespace Microsoft.Playwright.Tests;
public class PageClickTests : PageTestEx
@@ -501,15 +499,18 @@ public class PageClickTests : PageTestEx
await page.ClickAsync("button", new() { Position = new() { X = 20, Y = 10 } });
Assert.AreEqual("Clicked", await page.EvaluateAsync<string>("window.result"));
var point = BrowserName switch
void AssertCloseTo(int expected, int actual)
{
"chromium" => new(27, 18),
"webkit" => new(26, 17),
_ => new Point(28, 18),
};
if (Math.Abs(expected - actual) > 2)
{
throw new AssertionException($"Expected {expected}, received {actual}");
}
}
Assert.AreEqual(point.X, Convert.ToInt32(await page.EvaluateAsync<decimal>("pageX")));
Assert.AreEqual(point.Y, Convert.ToInt32(await page.EvaluateAsync<decimal>("pageY")));
// Expect 20;10 + 8px of border in each direction. Allow some delta as different
// browsers round up or down differently during css -> dip -> css conversion.
AssertCloseTo(28, await page.EvaluateAsync<int>("pageX"));
AssertCloseTo(18, await page.EvaluateAsync<int>("pageY"));
}
[PlaywrightTest("page-click.spec.ts", "should wait for stable position")]
@@ -684,7 +685,15 @@ public class PageClickTests : PageTestEx
[PlaywrightTest("page-click.spec.ts", "should wait for select to be enabled")]
public async Task ShouldWaitForSelectToBeEnabled()
{
await Page.SetContentAsync("<select onclick=\"javascript: window.__CLICKED = true;\" disabled><option selected>Hello</option></select>");
await Page.SetContentAsync(@"
<select disabled><option selected>Hello</option></select>
<script>
document.querySelector('select').addEventListener('mousedown', event => {
window.__CLICKED=true;
event.preventDefault();
});
</script>
");
var clickTask = Page.ClickAsync("select");
await GiveItAChanceToClick(Page);
Assert.Null(await Page.EvaluateAsync<bool?>("window.__CLICKED"));
@@ -216,6 +216,22 @@ public class PageRequestInterceptTests : PageTestEx
Assert.True(response.Headers["content-type"].Contains("text/html"));
}
[PlaywrightTest("page-request-intercept.spec.ts", "should support timeout option in route.fetch")]
public async Task ShouldSupportTimeoutOptionInRouteFetch()
{
Server.SetRoute("/slow", async context =>
{
await Task.Delay(10000);
});
await Page.RouteAsync("**/*", async (route) =>
{
var error = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(() => route.FetchAsync(new() { Timeout = 1000 }));
Assert.True(error.Message.Contains("Request timed out after 1000ms"));
});
var error = await PlaywrightAssert.ThrowsAsync<TimeoutException>(() => Page.GotoAsync(Server.Prefix + "/slow", new() { Timeout = 2000 }));
Assert.True(error.Message.Contains("Timeout 2000ms exceeded"));
}
[PlaywrightTest("page-request-intercept.spec.ts", "should not follow redirects when maxRedirects is set to 0 in route.fetch")]
public async Task ShouldNotFollowRedirectsInRouteFetch()
{
+2
View File
@@ -155,6 +155,7 @@ public class WorkersTests : PageTestEx
}
[PlaywrightTest("workers.spec.ts", "should report network activity")]
[Skip(SkipAttribute.Targets.Firefox)] // https://github.com/microsoft/playwright/issues/21760
public async Task ShouldReportNetworkActivity()
{
var (worker, _) = await TaskUtils.WhenAll(
@@ -176,6 +177,7 @@ public class WorkersTests : PageTestEx
}
[PlaywrightTest("workers.spec.ts", "should report network activity on worker creation")]
[Skip(SkipAttribute.Targets.Firefox)] // https://github.com/microsoft/playwright/issues/21760
public async Task ShouldReportNetworkActivityOnWorkerCreation()
{
await Page.GotoAsync(Server.EmptyPage);
+9 -6
View File
@@ -46,18 +46,21 @@ public partial interface ILocator
/// When locator points to a list of elements, returns array of locators, pointing to
/// respective elements.
/// </para>
/// <para>
/// Note that <see cref="ILocator.AllAsync"/> does not wait for elements to match the
/// locator, and instead immediately returns whatever is present in the page. To avoid
/// flakiness when elements are loaded dynamically, wait for the loading to finish before
/// calling <see cref="ILocator.AllAsync"/>.
/// </para>
/// <para>**Usage**</para>
/// <code>
/// foreach (var li in await page.GetByRole('listitem').AllAsync())<br/>
/// await li.ClickAsync();
/// </code>
/// </summary>
/// <remarks>
/// <para>
/// <see cref="ILocator.AllAsync"/> does not wait for elements to match the locator,
/// and instead immediately returns whatever is present in the page. When the list
/// of elements changes dynamically, <see cref="ILocator.AllAsync"/> will produce unpredictable
/// and flaky results. When the list of elements is stable, but loaded dynamically,
/// wait for the full list to finish loading before calling <see cref="ILocator.AllAsync"/>.
/// </para>
/// </remarks>
Task<IReadOnlyList<ILocator>> AllAsync();
/// <summary>
@@ -127,7 +127,13 @@ public class BrowserNewContextOptions
[JsonPropertyName("colorScheme")]
public ColorScheme? ColorScheme { get; set; }
/// <summary><para>Specify device scale factor (can be thought of as dpr). Defaults to <c>1</c>.</para></summary>
/// <summary>
/// <para>
/// Specify device scale factor (can be thought of as dpr). Defaults to <c>1</c>. Learn
/// more about <a href="https://playwright.dev/dotnet/docs/emulation#devices">emulating
/// devices with device scale factor</a>.
/// </para>
/// </summary>
[JsonPropertyName("deviceScaleFactor")]
public float? DeviceScaleFactor { get; set; }
@@ -148,7 +154,12 @@ public class BrowserNewContextOptions
[JsonPropertyName("geolocation")]
public Geolocation? Geolocation { get; set; }
/// <summary><para>Specifies if viewport supports touch events. Defaults to false.</para></summary>
/// <summary>
/// <para>
/// Specifies if viewport supports touch events. Defaults to false. Learn more about
/// <a href="https://playwright.dev/dotnet/docs/emulation#devices">mobile emulation</a>.
/// </para>
/// </summary>
[JsonPropertyName("hasTouch")]
public bool? HasTouch { get; set; }
@@ -169,13 +180,21 @@ public class BrowserNewContextOptions
/// <summary>
/// <para>
/// Whether the <c>meta viewport</c> tag is taken into account and touch events are
/// enabled. Defaults to <c>false</c>. Not supported in Firefox.
/// enabled. isMobile is a part of device, so you don't actually need to set it manually.
/// Defaults to <c>false</c> and is not supported in Firefox. Learn more about <a href="https://playwright.dev/dotnet/docs/emulation#isMobile">mobile
/// emulation</a>.
/// </para>
/// </summary>
[JsonPropertyName("isMobile")]
public bool? IsMobile { get; set; }
/// <summary><para>Whether or not to enable JavaScript in the context. Defaults to <c>true</c>.</para></summary>
/// <summary>
/// <para>
/// Whether or not to enable JavaScript in the context. Defaults to <c>true</c>. Learn
/// more about <a href="https://playwright.dev/dotnet/docs/emulation#javascript-enabled">disabling
/// JavaScript</a>.
/// </para>
/// </summary>
[JsonPropertyName("javaScriptEnabled")]
public bool? JavaScriptEnabled { get; set; }
@@ -183,13 +202,19 @@ public class BrowserNewContextOptions
/// <para>
/// Specify user locale, for example <c>en-GB</c>, <c>de-DE</c>, etc. Locale will affect
/// <c>navigator.language</c> value, <c>Accept-Language</c> request header value as
/// well as number and date formatting rules.
/// well as number and date formatting rules. Learn more about emulation in our <a href="https://playwright.dev/dotnet/docs/emulation#locale--timezone">emulation
/// guide</a>.
/// </para>
/// </summary>
[JsonPropertyName("locale")]
public string? Locale { get; set; }
/// <summary><para>Whether to emulate network being offline. Defaults to <c>false</c>.</para></summary>
/// <summary>
/// <para>
/// Whether to emulate network being offline. Defaults to <c>false</c>. Learn more about
/// <a href="https://playwright.dev/dotnet/docs/emulation#offline">network emulation</a>.
/// </para>
/// </summary>
[JsonPropertyName("offline")]
public bool? Offline { get; set; }
@@ -364,7 +389,9 @@ public class BrowserNewContextOptions
/// <summary>
/// <para>
/// Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use
/// <c>ViewportSize.NoViewport</c> to disable the consistent viewport emulation.
/// <c>ViewportSize.NoViewport</c> to disable the consistent viewport emulation. Learn
/// more about <a href="https://playwright.dev/dotnet/docs/emulation#viewport">viewport
/// emulation</a>.
/// </para>
/// </summary>
/// <remarks>
@@ -127,7 +127,13 @@ public class BrowserNewPageOptions
[JsonPropertyName("colorScheme")]
public ColorScheme? ColorScheme { get; set; }
/// <summary><para>Specify device scale factor (can be thought of as dpr). Defaults to <c>1</c>.</para></summary>
/// <summary>
/// <para>
/// Specify device scale factor (can be thought of as dpr). Defaults to <c>1</c>. Learn
/// more about <a href="https://playwright.dev/dotnet/docs/emulation#devices">emulating
/// devices with device scale factor</a>.
/// </para>
/// </summary>
[JsonPropertyName("deviceScaleFactor")]
public float? DeviceScaleFactor { get; set; }
@@ -148,7 +154,12 @@ public class BrowserNewPageOptions
[JsonPropertyName("geolocation")]
public Geolocation? Geolocation { get; set; }
/// <summary><para>Specifies if viewport supports touch events. Defaults to false.</para></summary>
/// <summary>
/// <para>
/// Specifies if viewport supports touch events. Defaults to false. Learn more about
/// <a href="https://playwright.dev/dotnet/docs/emulation#devices">mobile emulation</a>.
/// </para>
/// </summary>
[JsonPropertyName("hasTouch")]
public bool? HasTouch { get; set; }
@@ -169,13 +180,21 @@ public class BrowserNewPageOptions
/// <summary>
/// <para>
/// Whether the <c>meta viewport</c> tag is taken into account and touch events are
/// enabled. Defaults to <c>false</c>. Not supported in Firefox.
/// enabled. isMobile is a part of device, so you don't actually need to set it manually.
/// Defaults to <c>false</c> and is not supported in Firefox. Learn more about <a href="https://playwright.dev/dotnet/docs/emulation#isMobile">mobile
/// emulation</a>.
/// </para>
/// </summary>
[JsonPropertyName("isMobile")]
public bool? IsMobile { get; set; }
/// <summary><para>Whether or not to enable JavaScript in the context. Defaults to <c>true</c>.</para></summary>
/// <summary>
/// <para>
/// Whether or not to enable JavaScript in the context. Defaults to <c>true</c>. Learn
/// more about <a href="https://playwright.dev/dotnet/docs/emulation#javascript-enabled">disabling
/// JavaScript</a>.
/// </para>
/// </summary>
[JsonPropertyName("javaScriptEnabled")]
public bool? JavaScriptEnabled { get; set; }
@@ -183,13 +202,19 @@ public class BrowserNewPageOptions
/// <para>
/// Specify user locale, for example <c>en-GB</c>, <c>de-DE</c>, etc. Locale will affect
/// <c>navigator.language</c> value, <c>Accept-Language</c> request header value as
/// well as number and date formatting rules.
/// well as number and date formatting rules. Learn more about emulation in our <a href="https://playwright.dev/dotnet/docs/emulation#locale--timezone">emulation
/// guide</a>.
/// </para>
/// </summary>
[JsonPropertyName("locale")]
public string? Locale { get; set; }
/// <summary><para>Whether to emulate network being offline. Defaults to <c>false</c>.</para></summary>
/// <summary>
/// <para>
/// Whether to emulate network being offline. Defaults to <c>false</c>. Learn more about
/// <a href="https://playwright.dev/dotnet/docs/emulation#offline">network emulation</a>.
/// </para>
/// </summary>
[JsonPropertyName("offline")]
public bool? Offline { get; set; }
@@ -364,7 +389,9 @@ public class BrowserNewPageOptions
/// <summary>
/// <para>
/// Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use
/// <c>ViewportSize.NoViewport</c> to disable the consistent viewport emulation.
/// <c>ViewportSize.NoViewport</c> to disable the consistent viewport emulation. Learn
/// more about <a href="https://playwright.dev/dotnet/docs/emulation#viewport">viewport
/// emulation</a>.
/// </para>
/// </summary>
/// <remarks>
@@ -165,7 +165,13 @@ public class BrowserTypeLaunchPersistentContextOptions
[JsonPropertyName("colorScheme")]
public ColorScheme? ColorScheme { get; set; }
/// <summary><para>Specify device scale factor (can be thought of as dpr). Defaults to <c>1</c>.</para></summary>
/// <summary>
/// <para>
/// Specify device scale factor (can be thought of as dpr). Defaults to <c>1</c>. Learn
/// more about <a href="https://playwright.dev/dotnet/docs/emulation#devices">emulating
/// devices with device scale factor</a>.
/// </para>
/// </summary>
[JsonPropertyName("deviceScaleFactor")]
public float? DeviceScaleFactor { get; set; }
@@ -233,7 +239,12 @@ public class BrowserTypeLaunchPersistentContextOptions
[JsonPropertyName("handleSIGTERM")]
public bool? HandleSIGTERM { get; set; }
/// <summary><para>Specifies if viewport supports touch events. Defaults to false.</para></summary>
/// <summary>
/// <para>
/// Specifies if viewport supports touch events. Defaults to false. Learn more about
/// <a href="https://playwright.dev/dotnet/docs/emulation#devices">mobile emulation</a>.
/// </para>
/// </summary>
[JsonPropertyName("hasTouch")]
public bool? HasTouch { get; set; }
@@ -283,13 +294,21 @@ public class BrowserTypeLaunchPersistentContextOptions
/// <summary>
/// <para>
/// Whether the <c>meta viewport</c> tag is taken into account and touch events are
/// enabled. Defaults to <c>false</c>. Not supported in Firefox.
/// enabled. isMobile is a part of device, so you don't actually need to set it manually.
/// Defaults to <c>false</c> and is not supported in Firefox. Learn more about <a href="https://playwright.dev/dotnet/docs/emulation#isMobile">mobile
/// emulation</a>.
/// </para>
/// </summary>
[JsonPropertyName("isMobile")]
public bool? IsMobile { get; set; }
/// <summary><para>Whether or not to enable JavaScript in the context. Defaults to <c>true</c>.</para></summary>
/// <summary>
/// <para>
/// Whether or not to enable JavaScript in the context. Defaults to <c>true</c>. Learn
/// more about <a href="https://playwright.dev/dotnet/docs/emulation#javascript-enabled">disabling
/// JavaScript</a>.
/// </para>
/// </summary>
[JsonPropertyName("javaScriptEnabled")]
public bool? JavaScriptEnabled { get; set; }
@@ -297,13 +316,19 @@ public class BrowserTypeLaunchPersistentContextOptions
/// <para>
/// Specify user locale, for example <c>en-GB</c>, <c>de-DE</c>, etc. Locale will affect
/// <c>navigator.language</c> value, <c>Accept-Language</c> request header value as
/// well as number and date formatting rules.
/// well as number and date formatting rules. Learn more about emulation in our <a href="https://playwright.dev/dotnet/docs/emulation#locale--timezone">emulation
/// guide</a>.
/// </para>
/// </summary>
[JsonPropertyName("locale")]
public string? Locale { get; set; }
/// <summary><para>Whether to emulate network being offline. Defaults to <c>false</c>.</para></summary>
/// <summary>
/// <para>
/// Whether to emulate network being offline. Defaults to <c>false</c>. Learn more about
/// <a href="https://playwright.dev/dotnet/docs/emulation#offline">network emulation</a>.
/// </para>
/// </summary>
[JsonPropertyName("offline")]
public bool? Offline { get; set; }
@@ -473,7 +498,9 @@ public class BrowserTypeLaunchPersistentContextOptions
/// <summary>
/// <para>
/// Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use
/// <c>ViewportSize.NoViewport</c> to disable the consistent viewport emulation.
/// <c>ViewportSize.NoViewport</c> to disable the consistent viewport emulation. Learn
/// more about <a href="https://playwright.dev/dotnet/docs/emulation#viewport">viewport
/// emulation</a>.
/// </para>
/// </summary>
/// <remarks>
@@ -44,6 +44,7 @@ public class RouteFetchOptions
MaxRedirects = clone.MaxRedirects;
Method = clone.Method;
PostData = clone.PostData;
Timeout = clone.Timeout;
Url = clone.Url;
}
@@ -69,6 +70,15 @@ public class RouteFetchOptions
[JsonPropertyName("postData")]
public byte[]? PostData { get; set; }
/// <summary>
/// <para>
/// Request timeout in milliseconds. Defaults to <c>30000</c> (30 seconds). Pass <c>0</c>
/// to disable timeout.
/// </para>
/// </summary>
[JsonPropertyName("timeout")]
public float? Timeout { get; set; }
/// <summary><para>If set changes the request URL. New URL must have same protocol as original one.</para></summary>
[JsonPropertyName("url")]
public string? Url { get; set; }
+1 -1
View File
@@ -72,7 +72,7 @@ internal class Artifact : ChannelOwnerBase, IChannelOwner<Artifact>
{
using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write))
{
await stream.StreamImpl.CopyToAsync(fileStream).ConfigureAwait(false);
await stream.StreamImpl.CopyToAsync(fileStream, bufferSize: 1024 * 1024).ConfigureAwait(false);
}
}
}
+1
View File
@@ -264,6 +264,7 @@ internal class Route : ChannelOwnerBase, IChannelOwner<Route>, IRoute
Method = options?.Method,
DataByte = options?.PostData,
MaxRedirects = options?.MaxRedirects,
Timeout = options?.Timeout,
});
});
}