Skip to content

Commit

Permalink
chore(roll): roll Playwright to 1.35.0 (#2611)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Jun 12, 2023
1 parent b8ebe7c commit 8df5ac7
Show file tree
Hide file tree
Showing 44 changed files with 207 additions and 136 deletions.
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 -->114.0.5735.35<!-- GEN:stop --> ||||
| Chromium <!-- GEN:chromium-version -->115.0.5790.24<!-- GEN:stop --> ||||
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->113.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.34.0</AssemblyVersion>
<PackageVersion>$(AssemblyVersion)</PackageVersion>
<DriverVersion>1.34.3</DriverVersion>
<DriverVersion>1.35.0</DriverVersion>
<ReleaseVersion>$(AssemblyVersion)</ReleaseVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<NoDefaultExcludes>true</NoDefaultExcludes>
Expand Down
12 changes: 12 additions & 0 deletions src/Playwright.Tests.TestServer/assets/input/fileupload-multi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>File upload test</title>
</head>
<body>
<form action="/upload" method="post" enctype="multipart/form-data">
<input type="file" multiple name="file1">
<input type="submit">
</form>
</body>
</html>
62 changes: 0 additions & 62 deletions src/Playwright.Tests/PageAutoWaitingBasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,68 +118,6 @@ await TaskUtils.WhenAll(
Assert.AreEqual("route|navigated|click", string.Join("|", messages));
}

[PlaywrightTest("page-autowaiting-basic.spec.ts", "should await navigation when assigning location")]
[Ignore("Flacky")]
public async Task ShouldAwaitNavigationWhenAssigningLocation()
{
var messages = new List<string>();
Server.SetRoute("/empty.html", context =>
{
messages.Add("route");
context.Response.ContentType = "text/html";
return context.Response.WriteAsync("<link rel='stylesheet' href='./one-style.css'>");
});

await TaskUtils.WhenAll(
Page.EvaluateAsync($"window.location.href = '{Server.EmptyPage}'").ContinueWith(_ => messages.Add("evaluate")),
Page.WaitForNavigationAsync().ContinueWith(_ => messages.Add("navigated")));

Assert.AreEqual("route|navigated|evaluate", string.Join("|", messages));
}

[PlaywrightTest("page-autowaiting-basic.spec.ts", "should await navigation when assigning location twice")]
public async Task ShouldAwaitNavigationWhenAssigningLocationTwice()
{
var messages = new List<string>();
Server.SetRoute("/empty.html?cancel", context =>
{
return context.Response.WriteAsync("done");
});

Server.SetRoute("/empty.html?override", context =>
{
messages.Add("routeoverride");
return context.Response.WriteAsync("done");
});

await Page.EvaluateAsync($@"
window.location.href = '{Server.EmptyPage}?cancel';
window.location.href = '{Server.EmptyPage}?override';");
messages.Add("evaluate");

Assert.AreEqual("routeoverride|evaluate", string.Join("|", messages));
}

[PlaywrightTest("page-autowaiting-basic.spec.ts", "should await navigation when evaluating reload")]
[Ignore("Flacky")]
public async Task ShouldAwaitNavigationWhenEvaluatingReload()
{
var messages = new List<string>();
await Page.GotoAsync(Server.EmptyPage);
Server.SetRoute("/empty.html", context =>
{
messages.Add("route");
context.Response.ContentType = "text/html";
return context.Response.WriteAsync("<link rel='stylesheet' href='./one-style.css'>");
});

await TaskUtils.WhenAll(
Page.EvaluateAsync($"window.location.reload();").ContinueWith(_ => messages.Add("evaluate")),
Page.WaitForNavigationAsync().ContinueWith(_ => messages.Add("navigated")));

Assert.AreEqual("route|navigated|evaluate", string.Join("|", messages));
}

[PlaywrightTest("page-autowaiting-basic.spec.ts", "should await navigating specified target")]
[Ignore("Flacky")]
public async Task ShouldAwaitNavigatingSpecifiedTarget()
Expand Down
38 changes: 38 additions & 0 deletions src/Playwright.Tests/PageSetInputFilesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,4 +386,42 @@ public async Task ShouldUploadLargeFile()
Assert.AreEqual("200MB", file0Name);
Assert.AreEqual(200 * 1024 * 1024, file0Size);
}

[PlaywrightTest("page-set-input-files.spec.ts", "should upload multiple large files")]
public async Task ShouldUploadMultipleLargeFiles()
{
var filesCount = 10;
await Page.GotoAsync(Server.Prefix + "/input/fileupload-multi.html");
var uploadFile = Path.Combine(Path.GetTempPath(), "50MB_1.zip");
using (var stream = File.OpenWrite(uploadFile))
{
var str = new string('A', 1024);
// 49 is close to the actual limit
for (var i = 0; i < 49 * 1024; i++)
{
await stream.WriteAsync(Encoding.UTF8.GetBytes(str));
}
}
var input = Page.Locator("input[type=file]");
var uploadFiles = new List<string> { uploadFile };
using var tmpDir = new TempDirectory();
for (var i = 2; i <= filesCount; i++)
{
var dstFile = Path.Combine(tmpDir.Path, $"50MB_{i}.zip");
File.Copy(uploadFile, dstFile);
uploadFiles.Add(dstFile);
}
var fileChooser = await TaskUtils.WhenAll(
Page.WaitForFileChooserAsync(),
input.ClickAsync()
);
await fileChooser.SetFilesAsync(uploadFiles);
var filesLen = await Page.EvaluateAsync<int>("document.getElementsByTagName(\"input\")[0].files.length");
Assert.True(fileChooser.IsMultiple);
Assert.AreEqual(filesCount, filesLen);
foreach (var file in uploadFiles)
{
File.Delete(file);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ public APIRequestNewContextOptions(APIRequestNewContextOptions clone)
[JsonPropertyName("baseURL")]
public string? BaseURL { get; set; }

/// <summary><para>An object containing additional HTTP headers to be sent with every request.</para></summary>
/// <summary>
/// <para>
/// An object containing additional HTTP headers to be sent with every request. Defaults
/// to none.
/// </para>
/// </summary>
[JsonPropertyName("extraHTTPHeaders")]
public IEnumerable<KeyValuePair<string, string>>? ExtraHTTPHeaders { get; set; }

Expand Down
24 changes: 15 additions & 9 deletions src/Playwright/API/Generated/Options/BrowserNewContextOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public BrowserNewContextOptions(BrowserNewContextOptions clone)
/// When using <see cref="IPage.GotoAsync"/>, <see cref="IPage.RouteAsync"/>, <see cref="IPage.WaitForURLAsync"/>,
/// <see cref="IPage.RunAndWaitForRequestAsync"/>, or <see cref="IPage.RunAndWaitForResponseAsync"/>
/// it takes the base URL in consideration by using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL"><c>URL()</c></a>
/// constructor for building the corresponding URL. Examples:
/// constructor for building the corresponding URL. Unset by default. Examples:
/// </para>
/// <list type="bullet">
/// <item><description>
Expand All @@ -112,7 +112,7 @@ public BrowserNewContextOptions(BrowserNewContextOptions clone)
[JsonPropertyName("baseURL")]
public string? BaseURL { get; set; }

/// <summary><para>Toggles bypassing page's Content-Security-Policy.</para></summary>
/// <summary><para>Toggles bypassing page's Content-Security-Policy. Defaults to <c>false</c>.</para></summary>
[JsonPropertyName("bypassCSP")]
public bool? BypassCSP { get; set; }

Expand All @@ -137,7 +137,12 @@ public BrowserNewContextOptions(BrowserNewContextOptions clone)
[JsonPropertyName("deviceScaleFactor")]
public float? DeviceScaleFactor { get; set; }

/// <summary><para>An object containing additional HTTP headers to be sent with every request.</para></summary>
/// <summary>
/// <para>
/// An object containing additional HTTP headers to be sent with every request. Defaults
/// to none.
/// </para>
/// </summary>
[JsonPropertyName("extraHTTPHeaders")]
public IEnumerable<KeyValuePair<string, string>>? ExtraHTTPHeaders { get; set; }

Expand Down Expand Up @@ -202,7 +207,8 @@ public BrowserNewContextOptions(BrowserNewContextOptions clone)
/// <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. Learn more about emulation in our <a href="https://playwright.dev/dotnet/docs/emulation#locale--timezone">emulation
/// well as number and date formatting rules. Defaults to the system default locale.
/// Learn more about emulation in our <a href="https://playwright.dev/dotnet/docs/emulation#locale--timezone">emulation
/// guide</a>.
/// </para>
/// </summary>
Expand All @@ -221,13 +227,13 @@ public BrowserNewContextOptions(BrowserNewContextOptions clone)
/// <summary>
/// <para>
/// A list of permissions to grant to all pages in this context. See <see cref="IBrowserContext.GrantPermissionsAsync"/>
/// for more details.
/// for more details. Defaults to none.
/// </para>
/// </summary>
[JsonPropertyName("permissions")]
public IEnumerable<string>? Permissions { get; set; }

/// <summary><para>Network proxy settings to use with this context.</para></summary>
/// <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
Expand Down Expand Up @@ -366,8 +372,8 @@ public BrowserNewContextOptions(BrowserNewContextOptions clone)
/// If set to true, enables strict selectors mode for this context. In the strict selectors
/// mode all operations on selectors that imply single target DOM element will throw
/// when more than one element matches the selector. This option does not affect any
/// Locator APIs (Locators are always strict). See <see cref="ILocator"/> to learn more
/// about the strict mode.
/// Locator APIs (Locators are always strict). Defaults to <c>false</c>. See <see cref="ILocator"/>
/// to learn more about the strict mode.
/// </para>
/// </summary>
[JsonPropertyName("strictSelectors")]
Expand All @@ -376,7 +382,7 @@ public BrowserNewContextOptions(BrowserNewContextOptions clone)
/// <summary>
/// <para>
/// Changes the timezone of the context. See <a href="https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1">ICU's
/// metaZones.txt</a> for a list of supported timezone IDs.
/// metaZones.txt</a> for a list of supported timezone IDs. Defaults to the system timezone.
/// </para>
/// </summary>
[JsonPropertyName("timezoneId")]
Expand Down
24 changes: 15 additions & 9 deletions src/Playwright/API/Generated/Options/BrowserNewPageOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public BrowserNewPageOptions(BrowserNewPageOptions clone)
/// When using <see cref="IPage.GotoAsync"/>, <see cref="IPage.RouteAsync"/>, <see cref="IPage.WaitForURLAsync"/>,
/// <see cref="IPage.RunAndWaitForRequestAsync"/>, or <see cref="IPage.RunAndWaitForResponseAsync"/>
/// it takes the base URL in consideration by using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL"><c>URL()</c></a>
/// constructor for building the corresponding URL. Examples:
/// constructor for building the corresponding URL. Unset by default. Examples:
/// </para>
/// <list type="bullet">
/// <item><description>
Expand All @@ -112,7 +112,7 @@ public BrowserNewPageOptions(BrowserNewPageOptions clone)
[JsonPropertyName("baseURL")]
public string? BaseURL { get; set; }

/// <summary><para>Toggles bypassing page's Content-Security-Policy.</para></summary>
/// <summary><para>Toggles bypassing page's Content-Security-Policy. Defaults to <c>false</c>.</para></summary>
[JsonPropertyName("bypassCSP")]
public bool? BypassCSP { get; set; }

Expand All @@ -137,7 +137,12 @@ public BrowserNewPageOptions(BrowserNewPageOptions clone)
[JsonPropertyName("deviceScaleFactor")]
public float? DeviceScaleFactor { get; set; }

/// <summary><para>An object containing additional HTTP headers to be sent with every request.</para></summary>
/// <summary>
/// <para>
/// An object containing additional HTTP headers to be sent with every request. Defaults
/// to none.
/// </para>
/// </summary>
[JsonPropertyName("extraHTTPHeaders")]
public IEnumerable<KeyValuePair<string, string>>? ExtraHTTPHeaders { get; set; }

Expand Down Expand Up @@ -202,7 +207,8 @@ public BrowserNewPageOptions(BrowserNewPageOptions clone)
/// <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. Learn more about emulation in our <a href="https://playwright.dev/dotnet/docs/emulation#locale--timezone">emulation
/// well as number and date formatting rules. Defaults to the system default locale.
/// Learn more about emulation in our <a href="https://playwright.dev/dotnet/docs/emulation#locale--timezone">emulation
/// guide</a>.
/// </para>
/// </summary>
Expand All @@ -221,13 +227,13 @@ public BrowserNewPageOptions(BrowserNewPageOptions clone)
/// <summary>
/// <para>
/// A list of permissions to grant to all pages in this context. See <see cref="IBrowserContext.GrantPermissionsAsync"/>
/// for more details.
/// for more details. Defaults to none.
/// </para>
/// </summary>
[JsonPropertyName("permissions")]
public IEnumerable<string>? Permissions { get; set; }

/// <summary><para>Network proxy settings to use with this context.</para></summary>
/// <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
Expand Down Expand Up @@ -366,8 +372,8 @@ public BrowserNewPageOptions(BrowserNewPageOptions clone)
/// If set to true, enables strict selectors mode for this context. In the strict selectors
/// mode all operations on selectors that imply single target DOM element will throw
/// when more than one element matches the selector. This option does not affect any
/// Locator APIs (Locators are always strict). See <see cref="ILocator"/> to learn more
/// about the strict mode.
/// Locator APIs (Locators are always strict). Defaults to <c>false</c>. See <see cref="ILocator"/>
/// to learn more about the strict mode.
/// </para>
/// </summary>
[JsonPropertyName("strictSelectors")]
Expand All @@ -376,7 +382,7 @@ public BrowserNewPageOptions(BrowserNewPageOptions clone)
/// <summary>
/// <para>
/// Changes the timezone of the context. See <a href="https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1">ICU's
/// metaZones.txt</a> for a list of supported timezone IDs.
/// metaZones.txt</a> for a list of supported timezone IDs. Defaults to the system timezone.
/// </para>
/// </summary>
[JsonPropertyName("timezoneId")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public BrowserTypeLaunchPersistentContextOptions(BrowserTypeLaunchPersistentCont
/// When using <see cref="IPage.GotoAsync"/>, <see cref="IPage.RouteAsync"/>, <see cref="IPage.WaitForURLAsync"/>,
/// <see cref="IPage.RunAndWaitForRequestAsync"/>, or <see cref="IPage.RunAndWaitForResponseAsync"/>
/// it takes the base URL in consideration by using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL/URL"><c>URL()</c></a>
/// constructor for building the corresponding URL. Examples:
/// constructor for building the corresponding URL. Unset by default. Examples:
/// </para>
/// <list type="bullet">
/// <item><description>
Expand All @@ -135,7 +135,7 @@ public BrowserTypeLaunchPersistentContextOptions(BrowserTypeLaunchPersistentCont
[JsonPropertyName("baseURL")]
public string? BaseURL { get; set; }

/// <summary><para>Toggles bypassing page's Content-Security-Policy.</para></summary>
/// <summary><para>Toggles bypassing page's Content-Security-Policy. Defaults to <c>false</c>.</para></summary>
[JsonPropertyName("bypassCSP")]
public bool? BypassCSP { get; set; }

Expand Down Expand Up @@ -210,7 +210,12 @@ public BrowserTypeLaunchPersistentContextOptions(BrowserTypeLaunchPersistentCont
[JsonPropertyName("executablePath")]
public string? ExecutablePath { get; set; }

/// <summary><para>An object containing additional HTTP headers to be sent with every request.</para></summary>
/// <summary>
/// <para>
/// An object containing additional HTTP headers to be sent with every request. Defaults
/// to none.
/// </para>
/// </summary>
[JsonPropertyName("extraHTTPHeaders")]
public IEnumerable<KeyValuePair<string, string>>? ExtraHTTPHeaders { get; set; }

Expand Down Expand Up @@ -316,7 +321,8 @@ public BrowserTypeLaunchPersistentContextOptions(BrowserTypeLaunchPersistentCont
/// <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. Learn more about emulation in our <a href="https://playwright.dev/dotnet/docs/emulation#locale--timezone">emulation
/// well as number and date formatting rules. Defaults to the system default locale.
/// Learn more about emulation in our <a href="https://playwright.dev/dotnet/docs/emulation#locale--timezone">emulation
/// guide</a>.
/// </para>
/// </summary>
Expand All @@ -335,7 +341,7 @@ public BrowserTypeLaunchPersistentContextOptions(BrowserTypeLaunchPersistentCont
/// <summary>
/// <para>
/// A list of permissions to grant to all pages in this context. See <see cref="IBrowserContext.GrantPermissionsAsync"/>
/// for more details.
/// for more details. Defaults to none.
/// </para>
/// </summary>
[JsonPropertyName("permissions")]
Expand Down Expand Up @@ -462,8 +468,8 @@ public BrowserTypeLaunchPersistentContextOptions(BrowserTypeLaunchPersistentCont
/// If set to true, enables strict selectors mode for this context. In the strict selectors
/// mode all operations on selectors that imply single target DOM element will throw
/// when more than one element matches the selector. This option does not affect any
/// Locator APIs (Locators are always strict). See <see cref="ILocator"/> to learn more
/// about the strict mode.
/// Locator APIs (Locators are always strict). Defaults to <c>false</c>. See <see cref="ILocator"/>
/// to learn more about the strict mode.
/// </para>
/// </summary>
[JsonPropertyName("strictSelectors")]
Expand All @@ -481,7 +487,7 @@ public BrowserTypeLaunchPersistentContextOptions(BrowserTypeLaunchPersistentCont
/// <summary>
/// <para>
/// Changes the timezone of the context. See <a href="https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1">ICU's
/// metaZones.txt</a> for a list of supported timezone IDs.
/// metaZones.txt</a> for a list of supported timezone IDs. Defaults to the system timezone.
/// </para>
/// </summary>
[JsonPropertyName("timezoneId")]
Expand Down
Loading

0 comments on commit 8df5ac7

Please sign in to comment.