Example #1
0
        private async Task SetupWebAsync()
        {
            ControlledBrowserApp = await TestConstants.GetNewBrowserType().LaunchBrowserAppAsync();

            HostBrowserApp = await TestConstants.GetNewBrowserType().LaunchBrowserAppAsync();

            HostBrowser = await TestConstants.GetNewBrowserType().ConnectAsync(HostBrowserApp.ConnectOptions);
        }
Example #2
0
        //protected LaunchOptions DefaultOptions { get; set; }

        internal PlaywrightSharpBrowserBaseTest(ITestOutputHelper output) : base(output)
        {
            BaseDirectory = Path.Combine(Directory.GetCurrentDirectory(), "workspace");
            var dirInfo = new DirectoryInfo(BaseDirectory);

            if (!dirInfo.Exists)
            {
                dirInfo.Create();
            }

            Playwright = TestConstants.GetNewBrowserType();
        }
        private async Task SetupAsync()
        {
            var downloaderTask = TestConstants.GetNewBrowserType().CreateBrowserFetcher().DownloadAsync();

            Server      = SimpleServer.Create(TestConstants.Port, TestUtils.FindParentDirectory("PlaywrightSharp.TestServer"));
            HttpsServer = SimpleServer.CreateHttps(TestConstants.HttpsPort, TestUtils.FindParentDirectory("PlaywrightSharp.TestServer"));

            var serverStart      = Server.StartAsync();
            var httpsServerStart = HttpsServer.StartAsync();

            await Task.WhenAll(downloaderTask, serverStart, httpsServerStart);
        }
        internal static async Task SetupAsync()
        {
            var browserFetcher = TestConstants.GetNewBrowserType().CreateBrowserFetcher();
            int percentage     = 0;

            browserFetcher.DownloadProgressChanged += (sender, e) =>
            {
                if (percentage != e.ProgressPercentage)
                {
                    percentage = e.ProgressPercentage;
                    Console.WriteLine($"[{TestConstants.Product}] downloading browser {percentage}%");
                }
            };
            Console.WriteLine($"Downloading browser...");
            var downloaderTask = browserFetcher.DownloadAsync();

            Server      = SimpleServer.Create(TestConstants.Port, TestUtils.FindParentDirectory("PlaywrightSharp.TestServer"));
            HttpsServer = SimpleServer.CreateHttps(TestConstants.HttpsPort, TestUtils.FindParentDirectory("PlaywrightSharp.TestServer"));

            var serverStart      = Server.StartAsync();
            var httpsServerStart = HttpsServer.StartAsync();

            await Task.WhenAll(downloaderTask, serverStart, httpsServerStart);
        }
        private async Task SetupBrowserAsync()
        {
            BrowserApp = await TestConstants.GetNewBrowserType().LaunchBrowserAppAsync(TestConstants.GetDefaultBrowserOptions());

            Browser = await TestConstants.GetNewBrowserType().ConnectAsync(BrowserApp.ConnectOptions);
        }