// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Testing.xunit; using OpenQA.Selenium; using Templates.Test.Helpers; using Xunit; using Xunit.Abstractions; namespace Templates.Test { public class SpaTemplateTest : TemplateTestBase { public SpaTemplateTest(ITestOutputHelper output) : base(output) { } [ConditionalTheory] [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] // Just use 'angular' as representative for .NET 4.6.1 coverage, as // the client-side code isn't affected by the .NET runtime choice [InlineData("angular")] public void SpaTemplate_Works_NetFramework(string template) => SpaTemplateImpl("net461", template); [Theory] [InlineData("angular")] [InlineData("react")] [InlineData("reactredux")] [InlineData("aurelia")] [InlineData("knockout")] [InlineData("vue")] public void SpaTemplate_Works_NetCore(string template) => SpaTemplateImpl(null, template); private void SpaTemplateImpl(string targetFrameworkOverride, string template) { RunDotNetNew(template, targetFrameworkOverride); RunNpmInstall(); TestApplication(targetFrameworkOverride, publish: false); TestApplication(targetFrameworkOverride, publish: true); } private void TestApplication(string targetFrameworkOverride, bool publish) { using (var aspNetProcess = StartAspNetProcess(targetFrameworkOverride, publish)) { aspNetProcess.AssertOk("/"); if (WebDriverFactory.HostSupportsBrowserAutomation) { using (var browser = aspNetProcess.VisitInBrowser()) { TestBasicNavigation(browser); } } } } private void TestBasicNavigation(IWebDriver browser) { //