-
Notifications
You must be signed in to change notification settings - Fork 295
chore: roll to 1.23 #2184
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 to 1.23 #2184
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * MIT License | ||
| * | ||
| * Copyright (c) Microsoft Corporation. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in all | ||
| * copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
|
|
||
| using System.Threading.Tasks; | ||
| using Microsoft.Playwright.NUnit; | ||
| using NUnit.Framework; | ||
|
|
||
| namespace Microsoft.Playwright.Tests | ||
| { | ||
| public class BrowserContextServiceWorkerPolicyTests : BrowserTestEx | ||
|
mxschmitt marked this conversation as resolved.
|
||
| { | ||
| [PlaywrightTest("browsercontext-service-worker-policy.spec.ts", "should allow service workers by default")] | ||
| public async Task ShouldAllowServiceWorkersByDefault() | ||
| { | ||
| var context = await Browser.NewContextAsync(); | ||
| var page = await context.NewPageAsync(); | ||
| await page.GotoAsync(Server.Prefix + "/serviceworkers/empty/sw.html"); | ||
| var registrationResult = await page.EvaluateAsync<object>("() => window['registrationPromise']"); | ||
| Assert.IsNotNull(registrationResult); | ||
| await context.CloseAsync(); | ||
| } | ||
|
|
||
| [PlaywrightTest("browsercontext-service-worker-policy.spec.ts", "blocks service worker registration")] | ||
| public async Task ShouldBlockServiceWorkerRegistration() | ||
| { | ||
| var context = await Browser.NewContextAsync(new() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't forget to close the context! |
||
| { | ||
| ServiceWorkers = ServiceWorkerPolicy.Block | ||
| }); | ||
| var page = await context.NewPageAsync(); | ||
| var (consoleMessage, _) = await TaskUtils.WhenAll(page.WaitForConsoleMessageAsync(), | ||
| page.GotoAsync(Server.Prefix + "/serviceworkers/empty/sw.html")); | ||
| Assert.AreEqual("Service Worker registration blocked by Playwright", consoleMessage.Text); | ||
| await context.CloseAsync(); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,11 +22,10 @@ | |
| * SOFTWARE. | ||
| */ | ||
|
|
||
| using System.Collections.Generic; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Net; | ||
| using System.Runtime.InteropServices; | ||
| using System.Text.RegularExpressions; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.AspNetCore.Http; | ||
| using Microsoft.AspNetCore.Http.Features; | ||
|
|
@@ -255,5 +254,22 @@ public async Task ShouldBehaveTheSameWayForHeadersAndAllHeaders() | |
| Assert.AreEqual(response.Headers, allHeaders); | ||
| #pragma warning restore 0612 | ||
| } | ||
|
|
||
| [PlaywrightTest("page-network-response.spec.ts", "should report if request was fromServiceWorker")] | ||
| public async Task ShouldReportIfRequestWasFromServiceWorker() | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| { | ||
| { | ||
| var res = await Page.GotoAsync(Server.Prefix + "/serviceworkers/fetch/sw.html"); | ||
| Assert.False(res.FromServiceWorker); | ||
| } | ||
| await Page.EvaluateAsync("() => window['activationPromise']"); | ||
| { | ||
| var (res, _) = await TaskUtils.WhenAll( | ||
| Page.WaitForResponseAsync(new Regex("example.txt")), | ||
| Page.EvaluateAsync("() => fetch('/example.txt')") | ||
| ); | ||
| Assert.True(res.FromServiceWorker); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ | |
|
|
||
| namespace Microsoft.Playwright.Tests | ||
| { | ||
| public class RequestInterceptTests : PageTestEx | ||
| public class PageRequestInterceptTests : PageTestEx | ||
| { | ||
| [PlaywrightTest("page-request-intercept.spec.ts", "should fulfill intercepted response")] | ||
| public async Task ShouldFulfillInterceptedResponse() | ||
|
|
@@ -70,6 +70,9 @@ await route.FulfillAsync(new() | |
| Response = response, | ||
| Status = 201, | ||
| Body = "", | ||
| Headers = new Dictionary<string, string> { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this fixes tests, was also made upstream the same way. Class got renamed to align it with file name which is common in c# and we do it everywhere else. |
||
| { "Content-Length", "0" }, | ||
| }, | ||
| }); | ||
| }); | ||
| var response = await Page.GotoAsync(Server.Prefix + "/title.html"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * MIT License | ||
| * | ||
| * Copyright (c) Microsoft Corporation. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in all | ||
| * copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.ComponentModel.DataAnnotations; | ||
| using System.Drawing; | ||
| using System.Globalization; | ||
| using System.IO; | ||
| using System.Runtime.Serialization; | ||
| using System.Text.Json; | ||
| using System.Text.Json.Serialization; | ||
| using System.Text.RegularExpressions; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| #nullable enable | ||
|
|
||
| namespace Microsoft.Playwright | ||
| { | ||
| public enum HarContentPolicy | ||
| { | ||
| [EnumMember(Value = "omit")] | ||
| Omit, | ||
| [EnumMember(Value = "embed")] | ||
| Embed, | ||
| [EnumMember(Value = "attach")] | ||
| Attach, | ||
| } | ||
| } | ||
|
|
||
| #nullable disable |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * MIT License | ||
| * | ||
| * Copyright (c) Microsoft Corporation. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in all | ||
| * copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.ComponentModel.DataAnnotations; | ||
| using System.Drawing; | ||
| using System.Globalization; | ||
| using System.IO; | ||
| using System.Runtime.Serialization; | ||
| using System.Text.Json; | ||
| using System.Text.Json.Serialization; | ||
| using System.Text.RegularExpressions; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| #nullable enable | ||
|
|
||
| namespace Microsoft.Playwright | ||
| { | ||
| public enum HarMode | ||
| { | ||
| [EnumMember(Value = "full")] | ||
| Full, | ||
| [EnumMember(Value = "minimal")] | ||
| Minimal, | ||
| } | ||
| } | ||
|
|
||
| #nullable disable |
Uh oh!
There was an error while loading. Please reload this page.