diff --git a/NuGet.config b/NuGet.config deleted file mode 100644 index 7244c7ff7c..0000000000 --- a/NuGet.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/samples/MonoSanity/wwwroot/index.html b/samples/MonoSanity/wwwroot/index.html index 3dd60e581d..449dc78b3a 100644 --- a/samples/MonoSanity/wwwroot/index.html +++ b/samples/MonoSanity/wwwroot/index.html @@ -66,6 +66,7 @@ buttons[i].disabled = false; } el('loadingIndicator').style.display = 'none'; + window.isTestReady = true; // The Xunit code polls until this is true }); el('addNumbers').onsubmit = function (evt) { diff --git a/test/Microsoft.AspNetCore.Blazor.E2ETest/Microsoft.AspNetCore.Blazor.E2ETest.csproj b/test/Microsoft.AspNetCore.Blazor.E2ETest/Microsoft.AspNetCore.Blazor.E2ETest.csproj index 4258a185e0..c1fe37b21c 100644 --- a/test/Microsoft.AspNetCore.Blazor.E2ETest/Microsoft.AspNetCore.Blazor.E2ETest.csproj +++ b/test/Microsoft.AspNetCore.Blazor.E2ETest/Microsoft.AspNetCore.Blazor.E2ETest.csproj @@ -9,7 +9,6 @@ - diff --git a/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/MonoSanityTest.cs b/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/MonoSanityTest.cs index 7fdc26e86a..ee4d78351c 100644 --- a/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/MonoSanityTest.cs +++ b/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/MonoSanityTest.cs @@ -3,38 +3,41 @@ using Microsoft.AspNetCore.Blazor.E2ETest.Infrastructure; using Microsoft.AspNetCore.Blazor.E2ETest.Infrastructure.ServerFixtures; -using Microsoft.AspNetCore.Testing.xunit; using OpenQA.Selenium; +using OpenQA.Selenium.Support.UI; +using System; using Xunit; namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests { - // Currently skipping all MonoSanityTests because, since the latest Chrome update, they - // are failing intermittently. Need to investigate what is wrong about how these tests - // are interacting with the browser. - [OSSkipCondition(OperatingSystems.Linux)] - [OSSkipCondition(OperatingSystems.MacOSX)] - [OSSkipCondition(OperatingSystems.Windows)] public class MonoSanityTest : ServerTestBase { public MonoSanityTest(BrowserFixture browserFixture, AspNetSiteServerFixture serverFixture) : base(browserFixture, serverFixture) { serverFixture.BuildWebHostMethod = MonoSanity.Program.BuildWebHost; + Navigate("/", noReload: true); + WaitUntilMonoRunningInBrowser(); } - [ConditionalFact] + private void WaitUntilMonoRunningInBrowser() + { + new WebDriverWait(Browser, TimeSpan.FromSeconds(30)).Until(driver => + { + return ((IJavaScriptExecutor)driver) + .ExecuteScript("return window.isTestReady;"); + }); + } + + [Fact] public void HasTitle() { - Navigate("/", noReload: true); Assert.Equal("Mono sanity check", Browser.Title); } - [ConditionalFact] + [Fact] public void CanAddNumbers() { - Navigate("/", noReload: true); - SetValue(Browser, "addNumberA", "1001"); SetValue(Browser, "addNumberB", "2002"); Browser.FindElement(By.CssSelector("#addNumbers button")).Click(); @@ -42,11 +45,9 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests Assert.Equal("3003", GetValue(Browser, "addNumbersResult")); } - [ConditionalFact] + [Fact] public void CanRepeatString() { - Navigate("/", noReload: true); - SetValue(Browser, "repeatStringStr", "Test"); SetValue(Browser, "repeatStringCount", "5"); Browser.FindElement(By.CssSelector("#repeatString button")).Click(); @@ -54,31 +55,27 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests Assert.Equal("TestTestTestTestTest", GetValue(Browser, "repeatStringResult")); } - [ConditionalFact] + [Fact] public void CanReceiveDotNetExceptionInJavaScript() { - Navigate("/", noReload: true); - SetValue(Browser, "triggerExceptionMessage", "Hello from test"); Browser.FindElement(By.CssSelector("#triggerException button")).Click(); Assert.Contains("Hello from test", GetValue(Browser, "triggerExceptionMessageStackTrace")); } - [ConditionalFact] + [Fact] public void CanCallJavaScriptFromDotNet() { - Navigate("/", noReload: true); SetValue(Browser, "callJsEvalExpression", "getUserAgentString()"); Browser.FindElement(By.CssSelector("#callJs button")).Click(); var result = GetValue(Browser, "callJsResult"); Assert.StartsWith(".NET received: Mozilla", result); } - [ConditionalFact] + [Fact] public void CanReceiveJavaScriptExceptionInDotNet() { - Navigate("/", noReload: true); SetValue(Browser, "callJsEvalExpression", "triggerJsException()"); Browser.FindElement(By.CssSelector("#callJs button")).Click(); var result = GetValue(Browser, "callJsResult"); @@ -88,43 +85,36 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests Assert.Contains("at triggerJsException", result); } - [ConditionalFact] + [Fact] public void CanEvaluateJsExpressionThatResultsInNull() { - Navigate("/", noReload: true); SetValue(Browser, "callJsEvalExpression", "null"); Browser.FindElement(By.CssSelector("#callJs button")).Click(); var result = GetValue(Browser, "callJsResult"); Assert.Equal(".NET received: (NULL)", result); } - [ConditionalFact] + [Fact] public void CanEvaluateJsExpressionThatResultsInUndefined() { - Navigate("/", noReload: true); SetValue(Browser, "callJsEvalExpression", "console.log('Not returning anything')"); Browser.FindElement(By.CssSelector("#callJs button")).Click(); var result = GetValue(Browser, "callJsResult"); Assert.Equal(".NET received: (NULL)", result); } - [ConditionalFact] + [Fact] public void CanCallJsFunctionsWithoutBoxing() { - Navigate("/", noReload: true); - SetValue(Browser, "callJsNoBoxingNumberA", "108"); SetValue(Browser, "callJsNoBoxingNumberB", "4"); Browser.FindElement(By.CssSelector("#callJsNoBoxing button")).Click(); - Assert.Equal(".NET received: 27", GetValue(Browser, "callJsNoBoxingResult")); } - [ConditionalFact] + [Fact] public void CanCallJsFunctionsWithoutBoxingAndReceiveException() { - Navigate("/", noReload: true); - SetValue(Browser, "callJsNoBoxingNumberA", "1"); SetValue(Browser, "callJsNoBoxingNumberB", "0"); Browser.FindElement(By.CssSelector("#callJsNoBoxing button")).Click();