Esempio n. 1
0
        protected override async Task InitializeCoreAsync(TestContext context)
        {
            await base.InitializeCoreAsync(context);

            // Default to Chrome
            var browserKind = BrowserKind.Chromium;

            // Check if a different browser is requested
            var browserKindArgument = context.MethodArguments.FirstOrDefault();

            if (browserKindArgument != null &&
                browserKindArgument.GetType() == typeof(BrowserKind))
            {
                browserKind = (BrowserKind)browserKindArgument;
            }

            if (ShouldSkip(browserKind))
            {
                var avail = String.Join(",", BrowserManager.GetAvailableBrowsers());
                var error = $"Skipping browser: {browserKind}: Available: {avail}";
                Output.WriteLine(error);
                return;
            }

            TestBrowser = await BrowserManager.GetBrowserInstance(browserKind, BrowserContextInfo);

            TestPage = await TestBrowser.NewPageAsync();

            var response = await TestPage.GoToAsync(MountUri);

            Assert.True(response.Ok, $"Got: {response.StatusText} from: {MountUri}");
            Output.WriteLine($"Loaded MountUri: {MountUri}");

            await MountTestComponentAsync(TestPage);
        }