public void ShouldDumpBrowserProcessStderr() { bool success = false; var process = GetTestAppProcess( "PlaywrightSharp.Tests.DumpIO", $"\"{Playwright.CreateBrowserFetcher().GetRevisionInfo().ExecutablePath}\" {TestConstants.Product}"); process.ErrorDataReceived += (sender, e) => { success |= e.Data != null && e.Data.Contains("DevTools listening on ws://"); }; process.Start(); process.BeginErrorReadLine(); process.WaitForExit(); Assert.True(success); }
public async Task ShouldDownloadAndExtractLinuxBinary() { var browserFetcher = Playwright.CreateBrowserFetcher(new BrowserFetcherOptions { Platform = Platform.Linux, Path = _downloadsFolder.Path, Host = TestConstants.ServerUrl }); var revisionInfo = browserFetcher.GetRevisionInfo("123456"); Server.SetRedirect(revisionInfo.Url.Substring(TestConstants.ServerUrl.Length), "/chromium-linux.zip"); Assert.False(revisionInfo.Local); Assert.Equal(Platform.Linux, revisionInfo.Platform); Assert.False(await browserFetcher.CanDownloadAsync("100000")); Assert.True(await browserFetcher.CanDownloadAsync("123456")); revisionInfo = await browserFetcher.DownloadAsync("123456"); Assert.True(revisionInfo.Local); Assert.Equal("LINUX BINARY\n", File.ReadAllText(revisionInfo.ExecutablePath)); if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { #if NETCOREAPP //This will not be run on net4x anyway. Mono.Unix.FileAccessPermissions permissions = ConvertPermissions(LinuxSysCall.ExecutableFilePermissions); Assert.Equal(permissions, UnixFileSystemInfo.GetFileSystemEntry(revisionInfo.ExecutablePath).FileAccessPermissions & permissions); #endif } Assert.Equal(new[] { "123456" }, browserFetcher.GetLocalRevisions()); browserFetcher.Remove("123456"); Assert.Empty(browserFetcher.GetLocalRevisions()); //Download should return data from a downloaded version //This section is not in the Playwright test. await browserFetcher.DownloadAsync("123456"); Server.Reset(); revisionInfo = await browserFetcher.DownloadAsync("123456"); Assert.True(revisionInfo.Local); Assert.Equal("LINUX BINARY\n", File.ReadAllText(revisionInfo.ExecutablePath)); }