chore(roll): roll Playwright to 1.37.0-alpha-aug-8-2023 (#2656)

This commit is contained in:
Max Schmitt
2023-08-09 22:00:48 +02:00
committed by GitHub
parent 44723ec094
commit efc4dff936
19 changed files with 102 additions and 20 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->115.0.5790.75<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Chromium <!-- GEN:chromium-version -->116.0.5845.62<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| WebKit <!-- GEN:webkit-version -->17.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->115.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyVersion>1.36.0</AssemblyVersion>
<PackageVersion>$(AssemblyVersion)</PackageVersion>
<DriverVersion>1.36.0</DriverVersion>
<DriverVersion>1.37.0-alpha-aug-8-2023</DriverVersion>
<ReleaseVersion>$(AssemblyVersion)</ReleaseVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<NoDefaultExcludes>true</NoDefaultExcludes>
@@ -66,7 +66,7 @@ public class BrowserContextFetchTests : PageTestEx
return Task.CompletedTask;
});
var error = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(async () => await Context.APIRequest.GetAsync(Server.Prefix + "/test"));
StringAssert.Contains("socket hang up", error.Message);
Assert.True(error.Message.Contains("read ECONNRESET") || error.Message.Contains("socket hang up"));
}
[PlaywrightTest("browsercontext-fetch.spec.ts", "should throw on network error after redirect")]
@@ -79,7 +79,7 @@ public class BrowserContextFetchTests : PageTestEx
return Task.CompletedTask;
});
var error = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(async () => await Context.APIRequest.GetAsync(Server.Prefix + "/redirect"));
StringAssert.Contains("socket hang up", error.Message);
Assert.True(error.Message.Contains("read ECONNRESET") || error.Message.Contains("socket hang up"));
}
[PlaywrightTest("browsercontext-fetch.spec.ts", "should add session cookies to request")]
+8 -1
View File
@@ -51,7 +51,14 @@ public class FrameGoToTests : PageTestEx
await Server.WaitForRequest("/one-style.css");
await Page.EvalOnSelectorAsync("iframe", "frame => frame.remove()");
var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(() => navigationTask);
Assert.True(exception.Message.Contains("frame was detached") || exception.Message.Contains("net::ERR_ABORTED"));
if (BrowserName == "chromium")
{
Assert.True(exception.Message.Contains("net::ERR_ABORTED") || exception.Message.ToLowerInvariant().Contains("frame was detached"));
}
else
{
Assert.True(exception.Message.ToLowerInvariant().Contains("frame was detached"));
}
}
[PlaywrightTest("frame-goto.spec.ts", "should continue after client redirect")]
+4 -2
View File
@@ -50,12 +50,14 @@ public class GlobTests : PageTestEx
Assert.That("http://localhost:3000/signin-oidc/foo", Does.Not.Match(StringExtensions.GlobToRegex("http://localhost:3000/signin-oidc*")));
Assert.That("http://localhost:3000/signin-oidcnice", Does.Match(StringExtensions.GlobToRegex("http://localhost:3000/signin-oidc*")));
Assert.That("http://mydomain:8080/blah/blah/three-columns/settings.html?id=settings-e3c58efe-02e9-44b0-97ac-dd138100cf7c&blah", Does.Match(StringExtensions.GlobToRegex("**/three-columns/settings.html?**id=[a-z]**")));
Assert.AreEqual("^\\?$", StringExtensions.GlobToRegex("\\?"));
Assert.AreEqual("^\\\\$", StringExtensions.GlobToRegex("\\"));
Assert.AreEqual("^\\\\$", StringExtensions.GlobToRegex("\\\\"));
Assert.AreEqual("^\\[$", StringExtensions.GlobToRegex("\\["));
Assert.AreEqual("^\\[$", StringExtensions.GlobToRegex("["));
Assert.AreEqual("^\\$\\^\\+\\.\\*\\(\\)\\|\\?\\{\\}\\[\\]$", StringExtensions.GlobToRegex("$^+.\\*()|\\?\\{\\}[]"));
Assert.AreEqual("^[a-z]$", StringExtensions.GlobToRegex("[a-z]"));
Assert.AreEqual(@"^\$\^\+\.\*\(\)\|\?\{\}\[\]$", StringExtensions.GlobToRegex("$^+.\\*()|\\?\\{\\}\\[\\]"));
}
[PlaywrightTest("interception.spec.ts", "should work with ignoreHTTPSErrors")]
@@ -234,6 +234,23 @@ public class LocatorQueryTests : PageTestEx
await Expect(Page.Locator("span").Or(Page.Locator("article"))).ToHaveTextAsync("world");
}
[PlaywrightTest("locator-query.spec.ts", "should support locator.locator with and/or")]
public async Task ShouldSupportLocatorLocatorWithAndOr()
{
await Page.SetContentAsync(@"
<div>one <span>two</span> <button>three</button> </div>
<span>four</span>
<button>five</button>
");
await Expect(Page.Locator("div").Locator(Page.Locator("button"))).ToHaveTextAsync(new[] { "three" });
await Expect(Page.Locator("div").Locator(Page.Locator("button").Or(Page.Locator("span")))).ToHaveTextAsync(new[] { "two", "three" });
await Expect(Page.Locator("button").Or(Page.Locator("span"))).ToHaveTextAsync(new[] { "two", "three", "four", "five" });
await Expect(Page.Locator("div").Locator(Page.Locator("button").And(Page.GetByRole(AriaRole.Button)))).ToHaveTextAsync(new[] { "three" });
await Expect(Page.Locator("button").And(Page.GetByRole(AriaRole.Button))).ToHaveTextAsync(new[] { "three", "five" });
}
[PlaywrightTest("locator-query.spec.ts", "should enforce same frame for has:locator'")]
public async Task ShouldEnforceSameFrameForHasLocator()
{
@@ -625,7 +625,7 @@ public partial interface IBrowserContext
/// <summary>
/// <para>
/// If specified the network requests that are made in the context will be served from
/// the HAR file. Read more about <a href="https://playwright.dev/dotnet/docs/network#replaying-from-har">Replaying
/// the HAR file. Read more about <a href="https://playwright.dev/dotnet/docs/mock#replaying-from-har">Replaying
/// from HAR</a>.
/// </para>
/// <para>
+6
View File
@@ -1424,6 +1424,12 @@ public partial interface IFrame
/// <param name="options">Call options</param>
Task SetCheckedAsync(string selector, bool checkedState, FrameSetCheckedOptions? options = default);
/// <summary>
/// <para>
/// This method internally calls <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/write">document.write()</a>,
/// inheriting all its specific characteristics and behaviors.
/// </para>
/// </summary>
/// <param name="html">HTML markup to assign to the page.</param>
/// <param name="options">Call options</param>
Task SetContentAsync(string html, FrameSetContentOptions? options = default);
+9 -3
View File
@@ -35,7 +35,7 @@ namespace Microsoft.Playwright;
/// <para>
/// Locators are the central piece of Playwright's auto-waiting and retry-ability. In
/// a nutshell, locators represent a way to find element(s) on the page at any moment.
/// Locator can be created with the <see cref="IPage.Locator"/> method.
/// A locator can be created with the <see cref="IPage.Locator"/> method.
/// </para>
/// <para><a href="https://playwright.dev/dotnet/docs/locators">Learn more about locators</a>.</para>
/// </summary>
@@ -43,8 +43,8 @@ public partial interface ILocator
{
/// <summary>
/// <para>
/// When locator points to a list of elements, returns array of locators, pointing to
/// respective elements.
/// When the locator points to a list of elements, this returns an array of locators,
/// pointing to their respective elements.
/// </para>
/// <para>**Usage**</para>
/// <code>
@@ -1544,6 +1544,12 @@ public partial interface ILocator
/// await element.PressAsync("Enter");
/// </code>
/// </summary>
/// <remarks>
/// <para>
/// In most cases, you should use <see cref="ILocator.FillAsync"/> instead. You only
/// need to type characters if there is special keyboard handling on the page.
/// </para>
/// </remarks>
/// <param name="text">A text to type into a focused element.</param>
/// <param name="options">Call options</param>
Task TypeAsync(string text, LocatorTypeOptions? options = default);
+7 -1
View File
@@ -1879,7 +1879,7 @@ public partial interface IPage
/// <summary>
/// <para>
/// If specified the network requests that are made in the page will be served from
/// the HAR file. Read more about <a href="https://playwright.dev/dotnet/docs/network#replaying-from-har">Replaying
/// the HAR file. Read more about <a href="https://playwright.dev/dotnet/docs/mock#replaying-from-har">Replaying
/// from HAR</a>.
/// </para>
/// <para>
@@ -2217,6 +2217,12 @@ public partial interface IPage
/// <param name="options">Call options</param>
Task SetCheckedAsync(string selector, bool checkedState, PageSetCheckedOptions? options = default);
/// <summary>
/// <para>
/// This method internally calls <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/write">document.write()</a>,
/// inheriting all its specific characteristics and behaviors.
/// </para>
/// </summary>
/// <param name="html">HTML markup to assign to the page.</param>
/// <param name="options">Call options</param>
Task SetContentAsync(string html, PageSetContentOptions? options = default);
@@ -186,7 +186,7 @@ public class BrowserNewContextOptions
/// <para>
/// Whether the <c>meta viewport</c> tag is taken into account and touch events are
/// 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
/// 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>
@@ -186,7 +186,7 @@ public class BrowserNewPageOptions
/// <para>
/// Whether the <c>meta viewport</c> tag is taken into account and touch events are
/// 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
/// 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>
@@ -40,11 +40,42 @@ public class BrowserTypeConnectOptions
return;
}
ExposeNetwork = clone.ExposeNetwork;
Headers = clone.Headers;
SlowMo = clone.SlowMo;
Timeout = clone.Timeout;
}
/// <summary>
/// <para>
/// This option exposes network available on the connecting client to the browser being
/// connected to. Consists of a list of rules separated by comma.
/// </para>
/// <para>Available rules:</para>
/// <list type="ordinal">
/// <item><description>
/// Hostname pattern, for example: <c>example.com</c>, <c>*.org:99</c>, <c>x.*.y.com</c>,
/// <c>*foo.org</c>.
/// </description></item>
/// <item><description>IP literal, for example: <c>127.0.0.1</c>, <c>0.0.0.0:99</c>, <c>[::1]</c>, <c>[0:0::1]:99</c>.</description></item>
/// <item><description>
/// <c>&lt;loopback&gt;</c> that matches local loopback interfaces: <c>localhost</c>,
/// <c>*.localhost</c>, <c>127.0.0.1</c>, <c>[::1]</c>.
/// </description></item>
/// </list>
/// <para>Some common examples:</para>
/// <list type="ordinal">
/// <item><description><c>"*"</c> to expose all network.</description></item>
/// <item><description><c>"&lt;loopback&gt;"</c> to expose localhost network.</description></item>
/// <item><description>
/// <c>"*.test.internal-domain,*.staging.internal-domain,&lt;loopback&gt;"</c> to expose
/// test/staging deployments and localhost.
/// </description></item>
/// </list>
/// </summary>
[JsonPropertyName("exposeNetwork")]
public string? ExposeNetwork { get; set; }
/// <summary><para>Additional HTTP headers to be sent with web socket connect request. Optional.</para></summary>
[JsonPropertyName("headers")]
public IEnumerable<KeyValuePair<string, string>>? Headers { get; set; }
@@ -300,7 +300,7 @@ public class BrowserTypeLaunchPersistentContextOptions
/// <para>
/// Whether the <c>meta viewport</c> tag is taken into account and touch events are
/// 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
/// 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>
+1 -1
View File
@@ -166,7 +166,7 @@ internal class BrowserType : ChannelOwnerBase, IChannelOwner<BrowserType>, IBrow
new KeyValuePair<string, string>("x-playwright-browser", Name),
}.ToDictionary(pair => pair.Key, pair => pair.Value);
var localUtils = _channel.Connection.LocalUtils;
var pipe = await localUtils.ConnectAsync(wsEndpoint: wsEndpoint, headers: headers, slowMo: options.SlowMo, timeout: options.Timeout).ConfigureAwait(false);
var pipe = await localUtils.ConnectAsync(wsEndpoint: wsEndpoint, headers: headers, slowMo: options.SlowMo, timeout: options.Timeout, exposeNetwork: options.ExposeNetwork).ConfigureAwait(false);
void ClosePipe()
{
+2 -2
View File
@@ -65,8 +65,8 @@ internal class LocalUtils : ChannelOwnerBase, IChannelOwner<LocalUtils>
internal Task HarUnzipAsync(string zipFile, string harFile)
=> _channel.HarUnzipAsync(zipFile, harFile);
internal Task<JsonPipe> ConnectAsync(string wsEndpoint = default, IEnumerable<KeyValuePair<string, string>> headers = default, float? slowMo = default, float? timeout = default)
=> _channel.ConnectAsync(wsEndpoint, headers, slowMo, timeout);
internal Task<JsonPipe> ConnectAsync(string wsEndpoint = default, IEnumerable<KeyValuePair<string, string>> headers = default, float? slowMo = default, float? timeout = default, string exposeNetwork = default)
=> _channel.ConnectAsync(wsEndpoint, headers, slowMo, timeout, exposeNetwork);
internal void AddStackToTracingNoReply(List<StackFrame> stack, int id)
=> _channel.AddStackToTracingNoReply(stack, id);
+1 -1
View File
@@ -177,7 +177,7 @@ internal class Locator : ILocator
{
throw new ArgumentException("Locators must belong to the same frame.");
}
return new Locator(_frame, $"{_selector} >> {locatorImpl._selector}", options);
return new Locator(_frame, $"{_selector} >> internal:chain={JsonSerializer.Serialize(locatorImpl._selector, _locatorSerializerOptions)}", options);
}
IFrameLocator ILocator.FrameLocator(string selector) =>
@@ -687,6 +687,12 @@ internal static class StringExtensions
case '?':
tokens.Add(".");
break;
case '[':
tokens.Add("[");
break;
case ']':
tokens.Add("]");
break;
case '{':
inGroup = true;
tokens.Add("(");
@@ -89,7 +89,7 @@ internal class LocalUtilsChannel : Channel<LocalUtils>
{ "harFile", harFile },
});
internal async Task<JsonPipe> ConnectAsync(string wsEndpoint, IEnumerable<KeyValuePair<string, string>> headers, float? slowMo, float? timeout)
internal async Task<JsonPipe> ConnectAsync(string wsEndpoint, IEnumerable<KeyValuePair<string, string>> headers, float? slowMo, float? timeout, string exposeNetwork)
{
var args = new Dictionary<string, object>
{
@@ -97,6 +97,7 @@ internal class LocalUtilsChannel : Channel<LocalUtils>
{ "headers", headers },
{ "slowMo", slowMo },
{ "timeout", timeout },
{ "exposeNetwork", exposeNetwork },
};
return (await Connection.SendMessageToServerAsync(Guid, "connect", args).ConfigureAwait(false)).Value.GetObject<JsonPipe>("pipe", Connection);
}