diff --git a/README.md b/README.md index 829b37c18..031d910b8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | -| Chromium 158.0.8127.18 | ✅ | ✅ | ✅ | +| Chromium 159.0.8154.6 | ✅ | ✅ | ✅ | | WebKit 27.2 | ✅ | ✅ | ✅ | | Firefox 159.0 | ✅ | ✅ | ✅ | diff --git a/src/Common/Version.props b/src/Common/Version.props index e0a727b7a..ce9b8ce25 100644 --- a/src/Common/Version.props +++ b/src/Common/Version.props @@ -2,7 +2,7 @@ 1.65.0 $(AssemblyVersion) - 8534271f0413bae6a455b7cf43b2637391bc614b + 8124fc39233c4c349b9dbebd4abc4103738eae81 26.13.1 diff --git a/src/Playwright.TestingHarnessTest/tests/baseTest.ts b/src/Playwright.TestingHarnessTest/tests/baseTest.ts index ba29d6a9e..d110605f6 100644 --- a/src/Playwright.TestingHarnessTest/tests/baseTest.ts +++ b/src/Playwright.TestingHarnessTest/tests/baseTest.ts @@ -45,7 +45,7 @@ export const test = base.extend<{ const driver: typeof import('@playwright/test') = require(path.join(__dirname, '..', '..', 'Playwright', '.drivers', 'package')); const servers: BrowserServer[] = []; await use(async ({port}: {port: number}) => { - servers.push(await driver.chromium.launchServer({ host: '127.0.0.1', port })); + servers.push(await driver.chromium.launchServer({ host: '127.0.0.1', port, wsPath: '/' })); }); for (const server of servers) await server.close(); diff --git a/src/Playwright.Tests/Library/BrowsercontextCookiesTests.cs b/src/Playwright.Tests/Library/BrowsercontextCookiesTests.cs index 002726832..882a00f43 100644 --- a/src/Playwright.Tests/Library/BrowsercontextCookiesTests.cs +++ b/src/Playwright.Tests/Library/BrowsercontextCookiesTests.cs @@ -97,6 +97,7 @@ public async Task ShouldGetANonSessionCookie() } [UpstreamTest("CO-004 should allow adding cookies with >400 days expiration")] + [LocalFixme("dotnet: Cookie.Expires is a float, which holds the seconds since the epoch in steps of 128: the expiration that the test sets is rounded, up to 64 seconds later in about half of the runs, and WebKit on Windows returns it as set, so it is later than the time that the test computed (only in webkit on win32)")] public async Task ShouldAllowAddingCookiesWith400DaysExpiration() { var context = await ContextFixture(); diff --git a/src/Playwright.Tests/Library/BrowsercontextFetchTests.cs b/src/Playwright.Tests/Library/BrowsercontextFetchTests.cs index 29a46005e..2f14f482d 100644 --- a/src/Playwright.Tests/Library/BrowsercontextFetchTests.cs +++ b/src/Playwright.Tests/Library/BrowsercontextFetchTests.cs @@ -142,7 +142,6 @@ public async Task ShouldReturnTimingForHttps() } [UpstreamTest("FE-092 should throw on network error")] - [LocalFixme("dotnet: the message is 'socket hang up (ECONNRESET)', without the 'apiRequestContext.get: ' prefix of the call")] public async Task ShouldThrowOnNetworkError() { var context = await ContextFixture(); @@ -151,11 +150,10 @@ public async Task ShouldThrowOnNetworkError() req.Socket.Destroy(); }); var error = await Catch(() => context.APIRequest.GetAsync(Server.Prefix + "/test")); - Assert.That(error.Message, Does.Contain("apiRequestContext.get: socket hang up")); + Assert.That(error.Message, Does.Contain("socket hang up")); } [UpstreamTest("FE-093 should throw on network error after redirect")] - [LocalFixme("dotnet: the message is 'socket hang up (ECONNRESET)', without the 'apiRequestContext.get: ' prefix of the call")] public async Task ShouldThrowOnNetworkErrorAfterRedirect() { var context = await ContextFixture(); @@ -165,11 +163,10 @@ public async Task ShouldThrowOnNetworkErrorAfterRedirect() req.Socket.Destroy(); }); var error = await Catch(() => context.APIRequest.GetAsync(Server.Prefix + "/redirect")); - Assert.That(error.Message, Does.Contain("apiRequestContext.get: socket hang up")); + Assert.That(error.Message, Does.Contain("socket hang up")); } [UpstreamTest("FE-094 should throw on network error when sending body")] - [LocalFixme("dotnet: the message is 'aborted', without the 'apiRequestContext.get: ' prefix of the call")] public async Task ShouldThrowOnNetworkErrorWhenSendingBody() { var context = await ContextFixture(); @@ -185,11 +182,10 @@ public async Task ShouldThrowOnNetworkErrorWhenSendingBody() req.Socket.Destroy(); }); var error = await Catch(() => context.APIRequest.GetAsync(Server.Prefix + "/test")); - Assert.That(error.Message, Does.Contain("apiRequestContext.get: aborted")); + Assert.That(error.Message, Does.Contain("aborted")); } [UpstreamTest("FE-095 should throw on network error when sending body after redirect")] - [LocalFixme("dotnet: the message is 'aborted', without the 'apiRequestContext.get: ' prefix of the call")] public async Task ShouldThrowOnNetworkErrorWhenSendingBodyAfterRedirect() { var context = await ContextFixture(); @@ -206,7 +202,7 @@ public async Task ShouldThrowOnNetworkErrorWhenSendingBodyAfterRedirect() req.Socket.Destroy(); }); var error = await Catch(() => context.APIRequest.GetAsync(Server.Prefix + "/redirect")); - Assert.That(error.Message, Does.Contain("apiRequestContext.get: aborted")); + Assert.That(error.Message, Does.Contain("aborted")); } [UpstreamTest("FE-098 ${method} should support params passed as object")] @@ -1172,7 +1168,6 @@ public async Task ShouldThrowInformativeErrorOnCorruptedDeflateBody() } [UpstreamTest("FE-148 should support timeout option")] - [LocalFixme("dotnet: the message is 'Timeout 10ms exceeded.', without the 'apiRequestContext.get: ' prefix of the call")] public async Task ShouldSupportTimeoutOption() { var context = await ContextFixture(); @@ -1186,7 +1181,7 @@ public async Task ShouldSupportTimeoutOption() }); var error = await Catch(() => context.APIRequest.GetAsync(Server.Prefix + "/slow", new() { Timeout = 10 })); - Assert.That(error.Message, Does.Contain("apiRequestContext.get: Timeout 10ms exceeded")); + Assert.That(error.Message, Does.Contain("Timeout 10ms exceeded")); } [UpstreamTest("FE-149 should support a timeout of 0")] @@ -1216,7 +1211,6 @@ public async Task ShouldSupportATimeoutOf0() } [UpstreamTest("FE-150 should respect timeout after redirects")] - [LocalFixme("dotnet: the message is 'Timeout 100ms exceeded.', without the 'apiRequestContext.get: ' prefix of the call")] public async Task ShouldRespectTimeoutAfterRedirects() { var context = await ContextFixture(); @@ -1232,7 +1226,7 @@ public async Task ShouldRespectTimeoutAfterRedirects() context.SetDefaultTimeout(100); var error = await Catch(() => context.APIRequest.GetAsync(Server.Prefix + "/redirect")); - Assert.That(error.Message, Does.Contain("apiRequestContext.get: Timeout 100ms exceeded")); + Assert.That(error.Message, Does.Contain("Timeout 100ms exceeded")); } [UpstreamTest("FE-151 should not hang on a brotli encoded Range request")] diff --git a/src/Playwright.Tests/Library/BrowsercontextStorageStateTests.cs b/src/Playwright.Tests/Library/BrowsercontextStorageStateTests.cs index abc911e66..b14fbea2c 100644 --- a/src/Playwright.Tests/Library/BrowsercontextStorageStateTests.cs +++ b/src/Playwright.Tests/Library/BrowsercontextStorageStateTests.cs @@ -141,7 +141,6 @@ await context.SetStorageStateAsync(JsonStringify(new } [UpstreamTest("ST-003 should report good error if the url is not valid")] - [LocalFixme("dotnet: the message is 'Error setting storage state:\\n...', without the 'browser.newContext: ' prefix of the call")] public async Task ShouldReportGoodErrorIfTheUrlIsNotValid() { var error = await Catch(() => ContextFactory(new() @@ -167,7 +166,7 @@ public async Task ShouldReportGoodErrorIfTheUrlIsNotValid() }, }), })); - Assert.That(error.Message, Does.Contain("browser.newContext: Error setting storage state:")); + Assert.That(error.Message, Does.Contain("Error setting storage state:")); Assert.That(error.Message, Does.Contain("foo")); } diff --git a/src/Playwright.Tests/Library/BrowsertypeConnectTests.cs b/src/Playwright.Tests/Library/BrowsertypeConnectTests.cs index 104373e5f..39f5c59eb 100644 --- a/src/Playwright.Tests/Library/BrowsertypeConnectTests.cs +++ b/src/Playwright.Tests/Library/BrowsertypeConnectTests.cs @@ -95,7 +95,7 @@ protected async Task Connect(string wsEndpoint, BrowserTypeConnectOpti // .NET: (options as any).__testHookRedirectPortForwarding = testOptions.redirectPortForTest; the test hook is not in the .NET API. // .NET: browserType._playwright._defaultLaunchOptions is LaunchOptions(), so the local of upstream takes another name. var launchOptionsOfConnect = MergeOptions(new BrowserTypeLaunchOptions(testOptions.LaunchOptions), LaunchOptions()); - // .NET: the spread of options.headers is a loop. + // .NET: the launchOptions option of connect() is not in the .NET API: the Node.js client sends it as this header, before options.headers. var headers = new Dictionary { ["x-playwright-launch-options"] = JsonSerializer.Serialize(launchOptionsOfConnect, _launchOptionsJson), @@ -185,7 +185,6 @@ public async Task ShouldPrintWsError() } [UpstreamTest("BT-037 should print custom ws close error")] - [LocalFixme("dotnet: the message is 'Oh my!', without the 'browserType.connect: ' prefix of the call")] public async Task ShouldPrintCustomWsCloseError() { Server.OnceWebSocketConnection((ws, request) => @@ -196,7 +195,7 @@ public async Task ShouldPrintCustomWsCloseError() }); }); var error = await Catch(() => Connect($"ws://localhost:{Server.Port}/ws")); - Assert.That(error.Message, Does.Contain("browserType.connect: Oh my!")); + Assert.That(error.Message, Does.Contain("Oh my!")); } [UpstreamTest("BT-038 should be able to reconnect to a browser")] @@ -301,25 +300,23 @@ public async Task ShouldBeAbleToConnectTwoBrowsersAtTheSameTime() } [UpstreamTest("BT-044 should timeout in socket while connecting")] - [LocalFixme("dotnet: the message is 'Timeout 1000ms exceeded.', without the 'browserType.connect: ' prefix of the call")] public async Task ShouldTimeoutInSocketWhileConnecting() { var e = await Catch(() => Connect($"ws://localhost:{Server.Port}/ws-slow", new() { Timeout = 1000, })); - Assert.That(e.Message, Does.Contain("browserType.connect: Timeout 1000ms exceeded")); + Assert.That(e.Message, Does.Contain("Timeout 1000ms exceeded")); } [UpstreamTest("BT-045 should timeout in connect while connecting")] - [LocalFixme("dotnet: the message is 'BrowserType.ConnectAsync: Timeout 100ms exceeded', upstream expects 'browserType.connect: Timeout 100ms exceeded'")] public async Task ShouldTimeoutInConnectWhileConnecting() { var e = await Catch(() => Connect($"ws://localhost:{Server.Port}/ws", new() { Timeout = 100, })); - Assert.That(e.Message, Does.Contain("browserType.connect: Timeout 100ms exceeded")); + Assert.That(e.Message, Does.Contain("Timeout 100ms exceeded")); } [UpstreamTest("BT-046 should send extra headers with connect request")] @@ -734,6 +731,7 @@ public async Task ShouldBeAbleToConnectWhenTheWsEndpointIsPassedAsAnOption() var remoteServer = await StartRemoteServer(kind); var browser = await BrowserType.ConnectAsync(remoteServer.WsEndpoint(), new() { + // .NET: the launchOptions option of connect() is not in the .NET API: the Node.js client sends it as this header. Headers = new Dictionary { ["x-playwright-launch-options"] = JsonSerializer.Serialize(LaunchOptions(), _launchOptionsJson), @@ -929,17 +927,6 @@ public async Task SetInputFilesShouldPreserveLastModifiedTimestamp() } } - [UpstreamTest("BT-079 should connect over http")] - public async Task ShouldConnectOverHttp() - { - var remoteServer = await StartRemoteServer(kind); - - var url = new Uri(remoteServer.WsEndpoint()); - var browser = await Connect($"http://localhost:{url.Port}"); - Assert.That(browser.Version, Is.Not.Empty); - await browser.CloseAsync(); - } - [TestFixture("launchServer")] [TestFixture("run-server")] public class SocksProxy : BrowsertypeConnectTestsBase @@ -1096,18 +1083,4 @@ public async Task ShouldFilterLocalPathsFromUnsafeLaunchOptions() var (_, _, actions, _, _) = await ParseTraceRaw(tracePath); Assert.That(actions, Does.Contain("Set content")); } - - [UpstreamTest("BT-095 should timeout after redirect when connecting over http")] - public async Task ShouldTimeoutAfterRedirectWhenConnectingOverHttp() - { - Server.SetRedirect("/connect/json", "/connect/slow"); - var aborted = false; - Server.SetRoute("/connect/slow", (req, res) => - { - req.Socket.OnClose(() => aborted = true); - }); - var error = await Catch(() => Connect($"{Server.Prefix}/connect", new() { Timeout = 2000, Headers = new Dictionary { ["Connection"] = "Close" } })); - Assert.That(error.Message, Does.Contain("Timeout 2000ms exceeded.")); - await Expect(() => Assert.That(aborted, Is.EqualTo(true))).ToPassAsync(); - } } diff --git a/src/Playwright.Tests/Library/BrowsertypeLaunchTests.cs b/src/Playwright.Tests/Library/BrowsertypeLaunchTests.cs index 001899b73..28bd588ca 100644 --- a/src/Playwright.Tests/Library/BrowsertypeLaunchTests.cs +++ b/src/Playwright.Tests/Library/BrowsertypeLaunchTests.cs @@ -48,7 +48,6 @@ public async Task ShouldThrowIfPageArgumentIsPassed() } [UpstreamTest("BT-010 should reject if launched browser fails immediately")] - [LocalFixme("dotnet: the message is 'Target page, context or browser has been closed\\nBrowser logs: ...', without the 'browserType.launch: ' prefix of the call (only in chromium and webkit); dotnet: the message is 'Failed to launch the browser process.\\nBrowser logs: ...', without the 'browserType.launch: ' prefix of the call (only in firefox)")] public async Task ShouldRejectIfLaunchedBrowserFailsImmediately() { var error = await Catch(() => BrowserType.LaunchAsync(new(LaunchOptions()) { ExecutablePath = Asset("dummy_bad_browser_executable.js") })); @@ -58,7 +57,7 @@ public async Task ShouldRejectIfLaunchedBrowserFailsImmediately() } else { - Assert.That(error.Message, Does.Match(@"browserType\.launch(.|\n)*(spawn UNKNOWN|spawn EFTYPE|Browser logs:)").IgnoreCase); + Assert.That(error.Message, Does.Match(@"(spawn UNKNOWN|spawn EFTYPE|Browser logs:)").IgnoreCase); } } diff --git a/src/Playwright.Tests/Library/Chromium/ConnectOverCdpTests.cs b/src/Playwright.Tests/Library/Chromium/ConnectOverCdpTests.cs index 1647227e0..2aa53a7d0 100644 --- a/src/Playwright.Tests/Library/Chromium/ConnectOverCdpTests.cs +++ b/src/Playwright.Tests/Library/Chromium/ConnectOverCdpTests.cs @@ -448,7 +448,6 @@ public async Task ShouldReturnValidBrowserFromContextBrowser() } [UpstreamTest("CD-020 should report an expected error when the endpointURL returns a non-expected status code")] - [LocalFixme("dotnet: the message is 'Unexpected status 404 when connecting to /json/version/.', without the 'browserType.connectOverCDP: ' prefix of the call")] public async Task ShouldReportAnExpectedErrorWhenTheEndpointURLReturnsANonExpectedStatusCode() { Server.SetRoute("/json/version/", (req, resp) => @@ -460,11 +459,10 @@ public async Task ShouldReportAnExpectedErrorWhenTheEndpointURLReturnsANonExpect })); }); var error = await ThrowsAsync(() => BrowserType.ConnectOverCDPAsync(Server.Prefix)); - Assert.That(error.Message, Does.Contain($"browserType.connectOverCDP: Unexpected status 404 when connecting to {Server.Prefix}/json/version/")); + Assert.That(error.Message, Does.Contain($"Unexpected status 404 when connecting to {Server.Prefix}/json/version/")); } [UpstreamTest("CD-021 should report an expected error when the endpoint URL JSON webSocketDebuggerUrl is undefined")] - [LocalFixme("dotnet: the message is 'Invalid URL: undefined', without the 'browserType.connectOverCDP: ' prefix of the call")] public async Task ShouldReportAnExpectedErrorWhenTheEndpointURLJSONWebSocketDebuggerUrlIsUndefined() { Server.SetRoute("/json/version/", (req, resp) => @@ -475,7 +473,7 @@ public async Task ShouldReportAnExpectedErrorWhenTheEndpointURLJSONWebSocketDebu })); }); var error = await ThrowsAsync(() => BrowserType.ConnectOverCDPAsync(Server.Prefix)); - Assert.That(error.Message, Does.Contain("browserType.connectOverCDP: Invalid URL")); + Assert.That(error.Message, Does.Contain("Invalid URL")); } [UpstreamTest("CD-022 should connect to an existing cdp session when passed as a first argument")] diff --git a/src/Playwright.Tests/Library/DownloadTests.cs b/src/Playwright.Tests/Library/DownloadTests.cs index 996ad9823..d64459ced 100644 --- a/src/Playwright.Tests/Library/DownloadTests.cs +++ b/src/Playwright.Tests/Library/DownloadTests.cs @@ -457,7 +457,6 @@ public async Task ShouldSaveDownloadsToArtifactsDir() } [UpstreamTest("DO-023 should close the context without awaiting the failed download")] - [LocalFixme("dotnet: the message is 'canceled', without the 'download.path: ' prefix of the call")] public async Task ShouldCloseTheContextWithoutAwaitingTheFailedDownload() { Info.Skip(BrowserName != "chromium", "Only Chromium downloads on alt-click"); @@ -474,18 +473,11 @@ public async Task ShouldCloseTheContextWithoutAwaitingTheFailedDownload() Catch(() => download.PathAsync()), Catch(() => download.SaveAsAsync(Info.OutputPath("download.txt"))), page.Context.CloseAsync()); - Assert.That(downloadError.Message, Is.EqualTo("download.path: canceled")); - Assert.That( - new[] - { - "download.saveAs: File not found on disk. Check download.failure() for details.", - "download.saveAs: canceled", - }, - Does.Contain(saveError.Message)); + Assert.That(downloadError.Message, Does.Contain("canceled")); + Assert.That(new[] { "File not found on disk. Check download.failure() for details.", "canceled" }.Any(m => saveError.Message.Contains(m, StringComparison.Ordinal)), Is.EqualTo(true)); } [UpstreamTest("DO-024 should close the context without awaiting the download")] - [LocalFixme("dotnet: the message is 'canceled', without the 'download.path: ' prefix of the call (only in chromium and firefox); dotnet: the message is 'Target page, context or browser has been closed', without the 'download.path: ' prefix of the call (only in webkit)")] public async Task ShouldCloseTheContextWithoutAwaitingTheDownload() { Info.Skip(BrowserName == "webkit" && (Platform == "linux" || Channel == "webkit-wsl"), "WebKit on linux does not convert to the download immediately upon receiving headers"); @@ -511,20 +503,8 @@ public async Task ShouldCloseTheContextWithoutAwaitingTheDownload() page.Context.CloseAsync()); // The exact error message is racy, because sometimes browser is fast enough // to cancel the download. - Assert.That( - new[] - { - "download.path: canceled", - "download.path: " + TargetClosedErrorMessage, - }, - Does.Contain(downloadError.Message)); - Assert.That( - new[] - { - "download.saveAs: canceled", - "download.saveAs: " + TargetClosedErrorMessage, - }, - Does.Contain(saveError.Message)); + Assert.That(new[] { "canceled", TargetClosedErrorMessage }.Any(m => downloadError.Message.Contains(m, StringComparison.Ordinal)), Is.EqualTo(true)); + Assert.That(new[] { "canceled", TargetClosedErrorMessage }.Any(m => saveError.Message.Contains(m, StringComparison.Ordinal)), Is.EqualTo(true)); } [UpstreamTest("DO-026 should download large binary.zip")] diff --git a/src/Playwright.Tests/Library/EmulationFocusTests.cs b/src/Playwright.Tests/Library/EmulationFocusTests.cs index e8119dfba..0445d0b8d 100644 --- a/src/Playwright.Tests/Library/EmulationFocusTests.cs +++ b/src/Playwright.Tests/Library/EmulationFocusTests.cs @@ -296,6 +296,7 @@ await page.SetContentAsync(@" [UpstreamTest("EM-028 should keep mouse drag when interacting with another page/context")] public async Task ShouldKeepMouseDragWhenInteractingWithAnotherPageContext() { + Info.Skip(!Headless, "Stray mouse events mess up the test"); var page1 = await (await ContextFactory()).NewPageAsync(); var page2 = await (await ContextFactory()).NewPageAsync(); foreach (var page in new[] { page1, page2 }) diff --git a/src/Playwright.Tests/Library/GlobalFetchTests.cs b/src/Playwright.Tests/Library/GlobalFetchTests.cs index f18b2105e..c3df3721c 100644 --- a/src/Playwright.Tests/Library/GlobalFetchTests.cs +++ b/src/Playwright.Tests/Library/GlobalFetchTests.cs @@ -91,13 +91,12 @@ public async Task ShouldSupportGlobalUserAgentOption() } [UpstreamTest("FE-004 should support global timeout option")] - [LocalFixme("dotnet: the message is 'Timeout 100ms exceeded.', without the 'apiRequestContext.get: ' prefix of the call")] public async Task ShouldSupportGlobalTimeoutOption() { var request = await Playwright.APIRequest.NewContextAsync(new() { Timeout = 100 }); Server.SetRoute("/empty.html", (req, res) => { }); var error = await Catch(() => request.GetAsync(Server.EmptyPage)); - Assert.That(error.Message, Does.Contain("apiRequestContext.get: Timeout 100ms exceeded")); + Assert.That(error.Message, Does.Contain("Timeout 100ms exceeded")); await request.DisposeAsync(); } diff --git a/src/Playwright.Tests/Library/HitTargetTests.cs b/src/Playwright.Tests/Library/HitTargetTests.cs index 497b4f64d..234d0095d 100644 --- a/src/Playwright.Tests/Library/HitTargetTests.cs +++ b/src/Playwright.Tests/Library/HitTargetTests.cs @@ -24,7 +24,6 @@ namespace Microsoft.Playwright.Tests.Library; public class HitTargetTests : UpstreamPageTest { [UpstreamTest("HT-001 should block all events when hit target is wrong")] - [LocalFixme("dotnet: the message is 'Timeout 3000ms exceeded.', without the 'page.click: ' prefix of the call")] public async Task ShouldBlockAllEventsWhenHitTargetIsWrong() { await Page.GotoAsync(Server.Prefix + "/input/button.html"); @@ -46,7 +45,7 @@ await Page.EvaluateAsync(@"() => { }"); var error = await Catch(() => Page.ClickAsync("button", new() { Timeout = 3000 })); - Assert.That(error.Message, Does.Contain("page.click: Timeout 3000ms exceeded.")); + Assert.That(error.Message, Does.Contain("Timeout 3000ms exceeded.")); // Give it some time, just in case. await Page.WaitForTimeoutAsync(1000); @@ -97,7 +96,6 @@ await Page.EvalOnSelectorAsync("button", @"button => { } [UpstreamTest("HT-004 should block all events when hit target is wrong and element detaches")] - [LocalFixme("dotnet: the message is 'Timeout 3000ms exceeded.', without the 'page.click: ' prefix of the call")] public async Task ShouldBlockAllEventsWhenHitTargetIsWrongAndElementDetaches() { await Page.GotoAsync(Server.Prefix + "/input/button.html"); @@ -121,7 +119,7 @@ await Page.EvalOnSelectorAsync("button", @"button => { }"); var error = await Catch(() => Page.ClickAsync("button", new() { Timeout = 3000 })); - Assert.That(error.Message, Does.Contain("page.click: Timeout 3000ms exceeded.")); + Assert.That(error.Message, Does.Contain("Timeout 3000ms exceeded.")); // Give it some time, just in case. await Page.WaitForTimeoutAsync(1000); diff --git a/src/Playwright.Tests/Library/PageClockTests.cs b/src/Playwright.Tests/Library/PageClockTests.cs index 5ec46c077..0dba9c072 100644 --- a/src/Playwright.Tests/Library/PageClockTests.cs +++ b/src/Playwright.Tests/Library/PageClockTests.cs @@ -234,8 +234,8 @@ await page.EvaluateAsync(@"async () => { setInterval(window.stub, 10000); }"); await ThrowsAsync(() => page.Clock.RunForAsync("12:02:34:10")); - // .NET: await expect(page.clock.runFor(NaN)).rejects.toThrow('clock.runFor: Invalid ticks: NaN') is left out: RunForAsync takes a long, which has no NaN. - // .NET: await expect(page.clock.fastForward(Infinity)).rejects.toThrow('clock.fastForward: Invalid ticks: Infinity') is left out: FastForwardAsync takes a long, which has no Infinity. + // .NET: await expect(page.clock.runFor(NaN)).rejects.toThrow('Invalid ticks: NaN') is left out: RunForAsync takes a long, which has no NaN. + // .NET: await expect(page.clock.fastForward(Infinity)).rejects.toThrow('Invalid ticks: Infinity') is left out: FastForwardAsync takes a long, which has no Infinity. ExpectToEqual(calls, Array.Empty()); await page.GotoAsync(Server.EmptyPage); Assert.That(await page.EvaluateAsync("() => Date.now()"), Is.EqualTo(1000)); @@ -331,13 +331,12 @@ public async Task SetsInitialTimestamp() } [UpstreamTest("CK-018 should throw for invalid date")] - [LocalFixme("dotnet: the message is 'Invalid date: invalid', without the 'clock.setSystemTime: ' prefix of the call")] public async Task ShouldThrowForInvalidDate() { var page = await PageFixture(); // .NET: await expect(page.clock.setSystemTime(new Date('invalid'))).rejects.toThrow('Invalid date: Invalid Date') is left out: a DateTime is never an invalid date. var error = await ThrowsAsync(() => page.Clock.SetSystemTimeAsync("invalid")); - Assert.That(error.Message, Does.Contain("clock.setSystemTime: Invalid date: invalid")); + Assert.That(error.Message, Does.Contain("Invalid date: invalid")); } [UpstreamTest("CK-019 replaces global setTimeout")] diff --git a/src/Playwright.Tests/Library/PageEventCrashTests.cs b/src/Playwright.Tests/Library/PageEventCrashTests.cs index 482ca95cb..8e044fb96 100644 --- a/src/Playwright.Tests/Library/PageEventCrashTests.cs +++ b/src/Playwright.Tests/Library/PageEventCrashTests.cs @@ -111,7 +111,7 @@ public async Task ShouldCancelWaitForEventWhenPageCrashes() } [UpstreamTest("ER-018 should cancel navigation when page crashes")] - [LocalFixme("dotnet: the message is 'Page crashed\\nCall log: ...', without the 'page.goto: ' prefix of the call (only in chromium); harness: the crash fixture crashes a page of Firefox and WebKit with toImpl(page).delegate._session.send('Page.crash', {}), and toImpl is not available (only in firefox and webkit)")] + [LocalFixme("harness: the crash fixture crashes a page of Firefox and WebKit with toImpl(page).delegate._session.send('Page.crash', {}), and toImpl is not available (only in firefox and webkit)")] public async Task ShouldCancelNavigationWhenPageCrashes() { await Page.SetContentAsync("
This page should crash
"); @@ -120,7 +120,7 @@ public async Task ShouldCancelNavigationWhenPageCrashes() await Page.WaitForNavigationAsync(new() { WaitUntil = WaitUntilState.DOMContentLoaded }); Crash(); var error = await promise; - Assert.That(error.Message, Does.Contain("page.goto: Page crashed")); + Assert.That(error.Message, Does.Contain("Page crashed")); } [UpstreamTest("ER-019 should be able to close context when page crashes")] diff --git a/src/Playwright.Tests/Library/SelectorsRegisterTests.cs b/src/Playwright.Tests/Library/SelectorsRegisterTests.cs index 7c4714671..ece7ecbda 100644 --- a/src/Playwright.Tests/Library/SelectorsRegisterTests.cs +++ b/src/Playwright.Tests/Library/SelectorsRegisterTests.cs @@ -106,7 +106,7 @@ public async Task ShouldWorkInMainAndIsolatedWorld() } [UpstreamTest("SE-164 should handle errors")] - [LocalFixme("dotnet: the message is 'Selector engine name may only contain [a-zA-Z0-9_] characters', without the 'selectors.register: ' prefix of the call")] + [LocalFixme("dotnet: the message is '\"dummy\" selector engine has been already registered', without the 'selectors.register: ' prefix of the call")] public async Task ShouldHandleErrors() { var page = await Browser.NewPageAsync(NewPageOptions()); @@ -123,7 +123,7 @@ public async Task ShouldHandleErrors() })"; error = await Catch(() => Playwright.Selectors.RegisterAsync("$", new() { Script = "(" + createDummySelector + ")()" })); - Assert.That(error.Message, Is.EqualTo("selectors.register: Selector engine name may only contain [a-zA-Z0-9_] characters")); + Assert.That(error.Message, Does.Contain("Selector engine name may only contain [a-zA-Z0-9_] characters")); // Selector names are case-sensitive. await Playwright.Selectors.RegisterAsync("dummy", new() { Script = "(" + createDummySelector + ")()" }); @@ -133,7 +133,7 @@ public async Task ShouldHandleErrors() Assert.That(error.Message, Is.EqualTo("selectors.register: \"dummy\" selector engine has been already registered")); error = await Catch(() => Playwright.Selectors.RegisterAsync("css", new() { Script = "(" + createDummySelector + ")()" })); - Assert.That(error.Message, Is.EqualTo("selectors.register: \"css\" is a predefined selector engine")); + Assert.That(error.Message, Does.Contain("\"css\" is a predefined selector engine")); await page.CloseAsync(); } diff --git a/src/Playwright.Tests/Library/TracingTests.cs b/src/Playwright.Tests/Library/TracingTests.cs index 132f3c04f..4290eab8a 100644 --- a/src/Playwright.Tests/Library/TracingTests.cs +++ b/src/Playwright.Tests/Library/TracingTests.cs @@ -343,6 +343,29 @@ public async Task ShouldRespectTracesDirAndName() Assert.That(File.Exists(Path.Combine(tracesDir, "name2.trace")), Is.EqualTo(true)); Assert.That(File.Exists(Path.Combine(tracesDir, "name2.network")), Is.EqualTo(true)); + await context.Tracing.StartAsync(new() { Name = "discarded", Screenshots = true, Snapshots = true, ScreenSnapshots = true, AriaSnapshots = true }); + await page.GotoAsync(Server.Prefix + "/har.html"); + // A stylesheet changed through CSSOM is saved as a snapshot resource. + await page.EvaluateAsync("() => document.styleSheets[0].insertRule('.discarded-rule { color: red }')"); + await page.ClickAsync("body"); + string[] snapshotResources() => Directory.GetFileSystemEntries(Path.Combine(tracesDir, "resources")).Select(Path.GetFileName).Where(file => File.ReadAllText(Path.Combine(tracesDir, "resources", file)).Contains(".discarded-rule", StringComparison.Ordinal)).ToArray(); + foreach (var dir in new[] { "screencast", "screenshots", "aria" }) + { + await Expect(() => Assert.That(Directory.GetFileSystemEntries(Path.Combine(tracesDir, dir)).Length, Is.GreaterThan(0))).ToPassAsync(); + } + await Expect(() => Assert.That(snapshotResources(), Has.Length.EqualTo(1))).ToPassAsync(); + var networkResources = Directory.GetFileSystemEntries(Path.Combine(tracesDir, "resources")).Select(Path.GetFileName).Where(file => !snapshotResources().Contains(file)).ToArray(); + await context.Tracing.StopChunkAsync(); + // Discarded files are removed in the background. + await Expect(() => Assert.That(File.Exists(Path.Combine(tracesDir, "discarded.trace")), Is.EqualTo(false))).ToPassAsync(); + foreach (var dir in new[] { "screencast", "screenshots", "aria" }) + { + await Expect(() => Assert.That(Directory.GetFileSystemEntries(Path.Combine(tracesDir, dir)).Select(Path.GetFileName), Is.EqualTo(Array.Empty()))).ToPassAsync(); + } + await Expect(() => Assert.That(Directory.GetFileSystemEntries(Path.Combine(tracesDir, "resources")).Select(Path.GetFileName), Is.EqualTo(networkResources))).ToPassAsync(); + Assert.That(File.Exists(Path.Combine(tracesDir, "discarded.network")), Is.EqualTo(true)); + await context.Tracing.StopAsync(); + await browser.CloseAsync(); string[] resourceNames(Dictionary resources) diff --git a/src/Playwright.Tests/Library/WebSocketTests.cs b/src/Playwright.Tests/Library/WebSocketTests.cs index 3386982cb..920c119cb 100644 --- a/src/Playwright.Tests/Library/WebSocketTests.cs +++ b/src/Playwright.Tests/Library/WebSocketTests.cs @@ -230,7 +230,7 @@ public async Task ShouldNavigateWhileAnIframeOpensWebSockets() res.SetHeader("Content-Type", "text/html"); res.End(""); }); - for (var i = 0; i < 100; ++i) + for (var i = 0; i < 20; ++i) { await Page.GotoAsync(Server.Prefix + "/parent"); } diff --git a/src/Playwright.Tests/Page/ElementhandleScreenshotTests.cs b/src/Playwright.Tests/Page/ElementhandleScreenshotTests.cs index eb5fc5ed0..bc1ff6263 100644 --- a/src/Playwright.Tests/Page/ElementhandleScreenshotTests.cs +++ b/src/Playwright.Tests/Page/ElementhandleScreenshotTests.cs @@ -228,13 +228,12 @@ public async Task ShouldFailToScreenshotADetachedElement() } [UpstreamTest("EH-084 should timeout waiting for visible")] - [LocalFixme("dotnet: the message is 'Timeout 3000ms exceeded.', without the 'elementHandle.screenshot: ' prefix of the call")] public async Task ShouldTimeoutWaitingForVisible() { await Page.SetContentAsync("
"); var div = await Page.QuerySelectorAsync("div"); var error = await Catch(() => div.ScreenshotAsync(new() { Timeout = 3000 })); - Assert.That(error.Message, Does.Contain("elementHandle.screenshot: Timeout 3000ms exceeded")); + Assert.That(error.Message, Does.Contain("Timeout 3000ms exceeded")); Assert.That(error.Message, Does.Contain("element is not visible")); } diff --git a/src/Playwright.Tests/Page/FrameEvaluateTests.cs b/src/Playwright.Tests/Page/FrameEvaluateTests.cs index a56b6e98a..8c09f8e79 100644 --- a/src/Playwright.Tests/Page/FrameEvaluateTests.cs +++ b/src/Playwright.Tests/Page/FrameEvaluateTests.cs @@ -96,14 +96,13 @@ public async Task ShouldNotAllowCrossFrameElementHandlesWhenFramesDoNotScriptEac } [UpstreamTest("FR-009 should throw for detached frames")] - [LocalFixme("dotnet: the message is 'Frame was detached', without the 'frame.evaluate: ' prefix of the call")] public async Task ShouldThrowForDetachedFrames() { var frame1 = await AttachFrame(Page, "frame1", Server.EmptyPage); await DetachFrame(Page, "frame1"); Exception error = null; error = await Catch(() => frame1.EvaluateAsync("() => 7 * 8")); - Assert.That(error.Message, Does.Contain("frame.evaluate: Frame was detached")); + Assert.That(error.Message, Does.Contain("Frame was detached")); } [UpstreamTest("FR-010 should be isolated between frames")] diff --git a/src/Playwright.Tests/Page/FrameGotoTests.cs b/src/Playwright.Tests/Page/FrameGotoTests.cs index 965c5e73b..ecce509bd 100644 --- a/src/Playwright.Tests/Page/FrameGotoTests.cs +++ b/src/Playwright.Tests/Page/FrameGotoTests.cs @@ -58,7 +58,6 @@ public async Task ShouldRejectWhenFrameDetaches() } [UpstreamTest("FR-022 should continue after client redirect")] - [LocalFixme("dotnet: the message is 'Timeout 5000ms exceeded.', without the 'page.goto: ' prefix of the call (only in chromium and webkit)")] public async Task ShouldContinueAfterClientRedirect() { Info.Fixme(IsAndroid); @@ -67,7 +66,7 @@ public async Task ShouldContinueAfterClientRedirect() Server.SetRoute("/frames/script.js", (req, res) => { }); var url = Server.Prefix + "/frames/child-redirect.html"; var error = await Catch(() => Page.GotoAsync(url, new() { Timeout = 5000, WaitUntil = WaitUntilState.NetworkIdle })); - Assert.That(error.Message, Does.Contain("page.goto: Timeout 5000ms exceeded.")); + Assert.That(error.Message, Does.Contain("Timeout 5000ms exceeded.")); Assert.That(error.Message, Does.Contain($"navigating to \"{url}\", waiting until \"networkidle\"")); } diff --git a/src/Playwright.Tests/Page/PageBasicTests.cs b/src/Playwright.Tests/Page/PageBasicTests.cs index 05a4de7b0..bf2991ba1 100644 --- a/src/Playwright.Tests/Page/PageBasicTests.cs +++ b/src/Playwright.Tests/Page/PageBasicTests.cs @@ -248,4 +248,12 @@ public async Task HasNavigatorWebdriverSetToTrue() Assert.That(await Page.EvaluateAsync("() => navigator.webdriver"), Is.EqualTo(true)); } + + [UpstreamTest("PA-057 should prefix the error message with the api name")] + [LocalFixme("dotnet: the message is 'Timeout 1ms exceeded.', without the 'page.goto: ' prefix of the call")] + public async Task ShouldPrefixTheErrorMessageWithTheApiName() + { + var error = await Catch(() => Page.GotoAsync(Server.Prefix + "/empty.html", new() { Timeout = 1 })); + Assert.That(error.Message, Does.Contain("page.goto: Timeout 1ms exceeded.")); + } } diff --git a/src/Playwright.Tests/Page/PageClickReactTests.cs b/src/Playwright.Tests/Page/PageClickReactTests.cs index ec7652968..1992f0cd4 100644 --- a/src/Playwright.Tests/Page/PageClickReactTests.cs +++ b/src/Playwright.Tests/Page/PageClickReactTests.cs @@ -24,13 +24,12 @@ namespace Microsoft.Playwright.Tests.Page; public class PageClickReactTests : UpstreamPageTest { [UpstreamTest("CL-106 should timeout when click opens alert")] - [LocalFixme("dotnet: the message is 'Timeout 3000ms exceeded.', without the 'page.click: ' prefix of the call")] public async Task ShouldTimeoutWhenClickOpensAlert() { var dialogPromise = Once(h => Page.Dialog += h, h => Page.Dialog -= h); await Page.SetContentAsync("
Click me
"); var error = await Catch(() => Page.ClickAsync("div", new() { Timeout = 3000 })); - Assert.That(error.Message, Does.Contain("page.click: Timeout 3000ms exceeded.")); + Assert.That(error.Message, Does.Contain("Timeout 3000ms exceeded.")); var dialog = await dialogPromise; await dialog.DismissAsync(); } diff --git a/src/Playwright.Tests/Page/PageClickTimeout1Tests.cs b/src/Playwright.Tests/Page/PageClickTimeout1Tests.cs index bce5ab4b9..070820f0d 100644 --- a/src/Playwright.Tests/Page/PageClickTimeout1Tests.cs +++ b/src/Playwright.Tests/Page/PageClickTimeout1Tests.cs @@ -24,25 +24,23 @@ namespace Microsoft.Playwright.Tests.Page; public class PageClickTimeout1Tests : UpstreamPageTest { [UpstreamTest("CL-111 should timeout waiting for button to be enabled")] - [LocalFixme("dotnet: the message is 'Timeout 3000ms exceeded.', without the 'page.click: ' prefix of the call")] public async Task ShouldTimeoutWaitingForButtonToBeEnabled() { await Page.SetContentAsync(""); var error = await Catch(() => Page.ClickAsync("text=Click target", new() { Timeout = 3000 })); Assert.That(await Page.EvaluateAsync("window.__CLICKED"), Is.Null); - Assert.That(error.Message, Does.Contain("page.click: Timeout 3000ms exceeded.")); + Assert.That(error.Message, Does.Contain("Timeout 3000ms exceeded.")); Assert.That(error.Message, Does.Contain("element is not enabled")); Assert.That(error.Message, Does.Contain("retrying click action")); } [UpstreamTest("CL-112 should timeout waiting for inert element to become non-inert")] - [LocalFixme("dotnet: the message is 'Timeout 3000ms exceeded.', without the 'page.click: ' prefix of the call")] public async Task ShouldTimeoutWaitingForInertElementToBecomeNonInert() { await Page.SetContentAsync("
"); var error = await Catch(() => Page.ClickAsync("text=Click target", new() { Timeout = 3000 })); Assert.That(await Page.EvaluateAsync("window.__CLICKED"), Is.Null); - Assert.That(error.Message, Does.Contain("page.click: Timeout 3000ms exceeded.")); + Assert.That(error.Message, Does.Contain("Timeout 3000ms exceeded.")); Assert.That(error.Message, Does.Contain("element is inert")); Assert.That(error.Message, Does.Contain("retrying click action")); } diff --git a/src/Playwright.Tests/Page/PageClickTimeout2Tests.cs b/src/Playwright.Tests/Page/PageClickTimeout2Tests.cs index 78388631d..bcda2840f 100644 --- a/src/Playwright.Tests/Page/PageClickTimeout2Tests.cs +++ b/src/Playwright.Tests/Page/PageClickTimeout2Tests.cs @@ -24,26 +24,24 @@ namespace Microsoft.Playwright.Tests.Page; public class PageClickTimeout2Tests : UpstreamPageTest { [UpstreamTest("CL-114 should timeout waiting for display:none to be gone")] - [LocalFixme("dotnet: the message is 'Timeout 5000ms exceeded.', without the 'page.click: ' prefix of the call")] public async Task ShouldTimeoutWaitingForDisplayNoneToBeGone() { await Page.GotoAsync(Server.Prefix + "/input/button.html"); await Page.EvalOnSelectorAsync("button", "b => b.style.display = 'none'"); var error = await Catch(() => Page.ClickAsync("button", new() { Timeout = 5000 })); - Assert.That(error.Message, Does.Contain("page.click: Timeout 5000ms exceeded.")); + Assert.That(error.Message, Does.Contain("Timeout 5000ms exceeded.")); Assert.That(error.Message, Does.Contain("waiting for element to be visible, enabled and stable")); Assert.That(error.Message, Does.Contain("element is not visible")); Assert.That(error.Message, Does.Contain("retrying click action")); } [UpstreamTest("CL-115 should timeout waiting for visibility:hidden to be gone")] - [LocalFixme("dotnet: the message is 'Timeout 5000ms exceeded.', without the 'page.click: ' prefix of the call")] public async Task ShouldTimeoutWaitingForVisibilityHiddenToBeGone() { await Page.GotoAsync(Server.Prefix + "/input/button.html"); await Page.EvalOnSelectorAsync("button", "b => b.style.visibility = 'hidden'"); var error = await Catch(() => Page.ClickAsync("button", new() { Timeout = 5000 })); - Assert.That(error.Message, Does.Contain("page.click: Timeout 5000ms exceeded.")); + Assert.That(error.Message, Does.Contain("Timeout 5000ms exceeded.")); Assert.That(error.Message, Does.Contain("waiting for element to be visible, enabled and stable")); Assert.That(error.Message, Does.Contain("element is not visible")); Assert.That(error.Message, Does.Contain("retrying click action")); diff --git a/src/Playwright.Tests/Page/PageClickTimeout3Tests.cs b/src/Playwright.Tests/Page/PageClickTimeout3Tests.cs index 31cf285fa..b1d0e8bf3 100644 --- a/src/Playwright.Tests/Page/PageClickTimeout3Tests.cs +++ b/src/Playwright.Tests/Page/PageClickTimeout3Tests.cs @@ -24,7 +24,6 @@ namespace Microsoft.Playwright.Tests.Page; public class PageClickTimeout3Tests : UpstreamPageTest { [UpstreamTest("CL-117 should timeout waiting for hit target")] - [LocalFixme("dotnet: the message is 'Timeout 5000ms exceeded.', without the 'elementHandle.click: ' prefix of the call")] public async Task ShouldTimeoutWaitingForHitTarget() { await Page.GotoAsync(Server.Prefix + "/input/button.html"); @@ -41,7 +40,7 @@ await Page.EvaluateAsync(@"() => { document.body.appendChild(blocker); }"); var error = await Catch(() => button.ClickAsync(new() { Timeout = 5000 })); - Assert.That(error.Message, Does.Contain("elementHandle.click: Timeout 5000ms exceeded.")); + Assert.That(error.Message, Does.Contain("Timeout 5000ms exceeded.")); Assert.That(error.Message, Does.Contain("
intercepts pointer events")); Assert.That(error.Message, Does.Contain("retrying click action")); Assert.That(error.Message, Does.Contain("waiting 500ms")); @@ -67,7 +66,6 @@ await Page.EvaluateAsync(@"() => { } [UpstreamTest("CL-119 should report wrong hit target subtree")] - [LocalFixme("dotnet: the message is 'Timeout 5000ms exceeded.', without the 'elementHandle.click: ' prefix of the call")] public async Task ShouldReportWrongHitTargetSubtree() { await Page.GotoAsync(Server.Prefix + "/input/button.html"); @@ -94,7 +92,7 @@ await Page.EvaluateAsync(@"() => { blocker.appendChild(inner); }"); var error = await Catch(() => button.ClickAsync(new() { Timeout = 5000 })); - Assert.That(error.Message, Does.Contain("elementHandle.click: Timeout 5000ms exceeded.")); + Assert.That(error.Message, Does.Contain("Timeout 5000ms exceeded.")); Assert.That(error.Message, Does.Contain("
from
…
subtree intercepts pointer events")); Assert.That(error.Message, Does.Contain("retrying click action")); } diff --git a/src/Playwright.Tests/Page/PageClickTimeout4Tests.cs b/src/Playwright.Tests/Page/PageClickTimeout4Tests.cs index 3183d9604..c60f73d69 100644 --- a/src/Playwright.Tests/Page/PageClickTimeout4Tests.cs +++ b/src/Playwright.Tests/Page/PageClickTimeout4Tests.cs @@ -24,7 +24,6 @@ namespace Microsoft.Playwright.Tests.Page; public class PageClickTimeout4Tests : UpstreamPageTest { [UpstreamTest("CL-120 should timeout waiting for stable position")] - [LocalFixme("dotnet: the message is 'Timeout 3000ms exceeded.', without the 'elementHandle.click: ' prefix of the call")] public async Task ShouldTimeoutWaitingForStablePosition() { await Page.GotoAsync(Server.Prefix + "/input/button.html"); @@ -36,7 +35,7 @@ await button.EvaluateAsync(@"button => { // rafraf for Firefox to kick in the animation. await Rafraf(Page); var error = await Catch(() => button.ClickAsync(new() { Timeout = 3000 })); - Assert.That(error.Message, Does.Contain("elementHandle.click: Timeout 3000ms exceeded.")); + Assert.That(error.Message, Does.Contain("Timeout 3000ms exceeded.")); Assert.That(error.Message, Does.Contain("waiting for element to be visible, enabled and stable")); Assert.That(error.Message, Does.Contain("element is not stable")); Assert.That(error.Message, Does.Contain("retrying click action")); diff --git a/src/Playwright.Tests/Page/PageEvaluateTests.cs b/src/Playwright.Tests/Page/PageEvaluateTests.cs index 0969a41c7..15c0963da 100644 --- a/src/Playwright.Tests/Page/PageEvaluateTests.cs +++ b/src/Playwright.Tests/Page/PageEvaluateTests.cs @@ -17,7 +17,6 @@ using System.Globalization; using System.Numerics; -using System.Text.Json; using System.Text.RegularExpressions; using Microsoft.Playwright.Tests.Fixtures; using static Microsoft.Playwright.Tests.Fixtures.Utils; @@ -353,30 +352,12 @@ public async Task ShouldIncludeANonErrorRejectionValueInTheErrorMessage() } [UpstreamTest("EV-032 should return complex objects")] - [LocalFixme("dotnet: an argument that is 200 objects deep does not leave the client: the connection serializes the message with the default MaxDepth of System.Text.Json, 64, and throws a JsonException")] public async Task ShouldReturnComplexObjects() { var @object = new { foo = "bar!" }; var result = await Page.EvaluateAsync("a => a", @object); Assert.That(result, Is.Not.SameAs(@object)); ExpectToEqual(result, @object); - - object argument = 0; - // Chromium rejects protocol arguments at 60 levels, WebKit at 200. - for (var i = 0; i < 200; i++) - { - argument = new { children = new[] { argument } }; - } - // .NET: JsonSerializer stops at 64 levels unless MaxDepth says otherwise - Assert.That(await Page.EvaluateAsync("value => JSON.stringify(value).length", argument), Is.EqualTo(JsonSerializer.Serialize(argument, new JsonSerializerOptions { MaxDepth = 1000 }).Length)); - - // An argument that is too deep rejects and does not hang. - for (var i = 0; i < 800; i++) - { - argument = new { children = new[] { argument } }; - } - var error = await Catch(() => Page.EvaluateAsync("value => JSON.stringify(value).length", argument)); - Assert.That(error.Message, Does.Match("Maximum call stack size exceeded|too much recursion")); } [UpstreamTest("EV-033 should return NaN")] @@ -969,7 +950,6 @@ public async Task ShouldNotExposeTheInjectedScriptExport() } [UpstreamTest("EV-093 should throw when frame is detached")] - [LocalFixme("dotnet: the message is 'Frame was detached', without the 'frame.evaluate: ' prefix of the call")] public async Task ShouldThrowWhenFrameIsDetached() { await AttachFrame(Page, "frame1", Server.EmptyPage); @@ -978,7 +958,7 @@ public async Task ShouldThrowWhenFrameIsDetached() await DetachFrame(Page, "frame1"); var error = await promise; Assert.That(error, Is.Not.Null); - Assert.That(error.Message, Does.Match("frame.evaluate: (Frame was detached|Execution context was destroyed)")); + Assert.That(error.Message, Does.Match("(Frame was detached|Execution context was destroyed)")); } [UpstreamTest("EV-094 should work with overridden Object.defineProperty")] diff --git a/src/Playwright.Tests/Page/PageExposeFunctionTests.cs b/src/Playwright.Tests/Page/PageExposeFunctionTests.cs index 47fac48f3..55a1c406f 100644 --- a/src/Playwright.Tests/Page/PageExposeFunctionTests.cs +++ b/src/Playwright.Tests/Page/PageExposeFunctionTests.cs @@ -222,12 +222,11 @@ await Page.ExposeFunctionAsync("complexObject", (JsonElement a, JsonElement b) = } [UpstreamTest("EF-014 should throw for duplicate registrations")] - [LocalFixme("dotnet: the message is 'Function \"foo\" has been already registered', without the 'page.exposeFunction: ' prefix of the call")] public async Task ShouldThrowForDuplicateRegistrations() { await Page.ExposeFunctionAsync("foo", () => { }); var error = await Catch(() => Page.ExposeFunctionAsync("foo", () => { })); - Assert.That(error.Message, Does.Contain("page.exposeFunction: Function \"foo\" has been already registered")); + Assert.That(error.Message, Does.Contain("Function \"foo\" has been already registered")); } [UpstreamTest("EF-015 should work with setContent")] diff --git a/src/Playwright.Tests/Page/PageFillTests.cs b/src/Playwright.Tests/Page/PageFillTests.cs index f7e000635..d6ce65291 100644 --- a/src/Playwright.Tests/Page/PageFillTests.cs +++ b/src/Playwright.Tests/Page/PageFillTests.cs @@ -267,13 +267,12 @@ await Page.EvalOnSelectorAsync("div[contenteditable]", @"div => { } [UpstreamTest("FI-018 should throw nice error without injected script stack when element is not an ")] - [LocalFixme("dotnet: the message is 'Error: Element is not an ,