Fix MonoSanityTest instability
This commit is contained in:
parent
b7bbacf4ed
commit
86500ce761
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<packageSources>
|
|
||||||
<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />
|
|
||||||
</packageSources>
|
|
||||||
</configuration>
|
|
||||||
|
|
@ -66,6 +66,7 @@
|
||||||
buttons[i].disabled = false;
|
buttons[i].disabled = false;
|
||||||
}
|
}
|
||||||
el('loadingIndicator').style.display = 'none';
|
el('loadingIndicator').style.display = 'none';
|
||||||
|
window.isTestReady = true; // The Xunit code polls until this is true
|
||||||
});
|
});
|
||||||
|
|
||||||
el('addNumbers').onsubmit = function (evt) {
|
el('addNumbers').onsubmit = function (evt) {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="2.1.0-preview2-30093" />
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
|
||||||
<PackageReference Include="Selenium.WebDriver" Version="3.8.0" />
|
<PackageReference Include="Selenium.WebDriver" Version="3.8.0" />
|
||||||
<PackageReference Include="xunit" Version="2.3.1" />
|
<PackageReference Include="xunit" Version="2.3.1" />
|
||||||
|
|
|
||||||
|
|
@ -3,38 +3,41 @@
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Blazor.E2ETest.Infrastructure;
|
using Microsoft.AspNetCore.Blazor.E2ETest.Infrastructure;
|
||||||
using Microsoft.AspNetCore.Blazor.E2ETest.Infrastructure.ServerFixtures;
|
using Microsoft.AspNetCore.Blazor.E2ETest.Infrastructure.ServerFixtures;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
|
using OpenQA.Selenium.Support.UI;
|
||||||
|
using System;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests
|
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<AspNetSiteServerFixture>
|
public class MonoSanityTest : ServerTestBase<AspNetSiteServerFixture>
|
||||||
{
|
{
|
||||||
public MonoSanityTest(BrowserFixture browserFixture, AspNetSiteServerFixture serverFixture)
|
public MonoSanityTest(BrowserFixture browserFixture, AspNetSiteServerFixture serverFixture)
|
||||||
: base(browserFixture, serverFixture)
|
: base(browserFixture, serverFixture)
|
||||||
{
|
{
|
||||||
serverFixture.BuildWebHostMethod = MonoSanity.Program.BuildWebHost;
|
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()
|
public void HasTitle()
|
||||||
{
|
{
|
||||||
Navigate("/", noReload: true);
|
|
||||||
Assert.Equal("Mono sanity check", Browser.Title);
|
Assert.Equal("Mono sanity check", Browser.Title);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public void CanAddNumbers()
|
public void CanAddNumbers()
|
||||||
{
|
{
|
||||||
Navigate("/", noReload: true);
|
|
||||||
|
|
||||||
SetValue(Browser, "addNumberA", "1001");
|
SetValue(Browser, "addNumberA", "1001");
|
||||||
SetValue(Browser, "addNumberB", "2002");
|
SetValue(Browser, "addNumberB", "2002");
|
||||||
Browser.FindElement(By.CssSelector("#addNumbers button")).Click();
|
Browser.FindElement(By.CssSelector("#addNumbers button")).Click();
|
||||||
|
|
@ -42,11 +45,9 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests
|
||||||
Assert.Equal("3003", GetValue(Browser, "addNumbersResult"));
|
Assert.Equal("3003", GetValue(Browser, "addNumbersResult"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public void CanRepeatString()
|
public void CanRepeatString()
|
||||||
{
|
{
|
||||||
Navigate("/", noReload: true);
|
|
||||||
|
|
||||||
SetValue(Browser, "repeatStringStr", "Test");
|
SetValue(Browser, "repeatStringStr", "Test");
|
||||||
SetValue(Browser, "repeatStringCount", "5");
|
SetValue(Browser, "repeatStringCount", "5");
|
||||||
Browser.FindElement(By.CssSelector("#repeatString button")).Click();
|
Browser.FindElement(By.CssSelector("#repeatString button")).Click();
|
||||||
|
|
@ -54,31 +55,27 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests
|
||||||
Assert.Equal("TestTestTestTestTest", GetValue(Browser, "repeatStringResult"));
|
Assert.Equal("TestTestTestTestTest", GetValue(Browser, "repeatStringResult"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public void CanReceiveDotNetExceptionInJavaScript()
|
public void CanReceiveDotNetExceptionInJavaScript()
|
||||||
{
|
{
|
||||||
Navigate("/", noReload: true);
|
|
||||||
|
|
||||||
SetValue(Browser, "triggerExceptionMessage", "Hello from test");
|
SetValue(Browser, "triggerExceptionMessage", "Hello from test");
|
||||||
Browser.FindElement(By.CssSelector("#triggerException button")).Click();
|
Browser.FindElement(By.CssSelector("#triggerException button")).Click();
|
||||||
|
|
||||||
Assert.Contains("Hello from test", GetValue(Browser, "triggerExceptionMessageStackTrace"));
|
Assert.Contains("Hello from test", GetValue(Browser, "triggerExceptionMessageStackTrace"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public void CanCallJavaScriptFromDotNet()
|
public void CanCallJavaScriptFromDotNet()
|
||||||
{
|
{
|
||||||
Navigate("/", noReload: true);
|
|
||||||
SetValue(Browser, "callJsEvalExpression", "getUserAgentString()");
|
SetValue(Browser, "callJsEvalExpression", "getUserAgentString()");
|
||||||
Browser.FindElement(By.CssSelector("#callJs button")).Click();
|
Browser.FindElement(By.CssSelector("#callJs button")).Click();
|
||||||
var result = GetValue(Browser, "callJsResult");
|
var result = GetValue(Browser, "callJsResult");
|
||||||
Assert.StartsWith(".NET received: Mozilla", result);
|
Assert.StartsWith(".NET received: Mozilla", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public void CanReceiveJavaScriptExceptionInDotNet()
|
public void CanReceiveJavaScriptExceptionInDotNet()
|
||||||
{
|
{
|
||||||
Navigate("/", noReload: true);
|
|
||||||
SetValue(Browser, "callJsEvalExpression", "triggerJsException()");
|
SetValue(Browser, "callJsEvalExpression", "triggerJsException()");
|
||||||
Browser.FindElement(By.CssSelector("#callJs button")).Click();
|
Browser.FindElement(By.CssSelector("#callJs button")).Click();
|
||||||
var result = GetValue(Browser, "callJsResult");
|
var result = GetValue(Browser, "callJsResult");
|
||||||
|
|
@ -88,43 +85,36 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests
|
||||||
Assert.Contains("at triggerJsException", result);
|
Assert.Contains("at triggerJsException", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public void CanEvaluateJsExpressionThatResultsInNull()
|
public void CanEvaluateJsExpressionThatResultsInNull()
|
||||||
{
|
{
|
||||||
Navigate("/", noReload: true);
|
|
||||||
SetValue(Browser, "callJsEvalExpression", "null");
|
SetValue(Browser, "callJsEvalExpression", "null");
|
||||||
Browser.FindElement(By.CssSelector("#callJs button")).Click();
|
Browser.FindElement(By.CssSelector("#callJs button")).Click();
|
||||||
var result = GetValue(Browser, "callJsResult");
|
var result = GetValue(Browser, "callJsResult");
|
||||||
Assert.Equal(".NET received: (NULL)", result);
|
Assert.Equal(".NET received: (NULL)", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public void CanEvaluateJsExpressionThatResultsInUndefined()
|
public void CanEvaluateJsExpressionThatResultsInUndefined()
|
||||||
{
|
{
|
||||||
Navigate("/", noReload: true);
|
|
||||||
SetValue(Browser, "callJsEvalExpression", "console.log('Not returning anything')");
|
SetValue(Browser, "callJsEvalExpression", "console.log('Not returning anything')");
|
||||||
Browser.FindElement(By.CssSelector("#callJs button")).Click();
|
Browser.FindElement(By.CssSelector("#callJs button")).Click();
|
||||||
var result = GetValue(Browser, "callJsResult");
|
var result = GetValue(Browser, "callJsResult");
|
||||||
Assert.Equal(".NET received: (NULL)", result);
|
Assert.Equal(".NET received: (NULL)", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public void CanCallJsFunctionsWithoutBoxing()
|
public void CanCallJsFunctionsWithoutBoxing()
|
||||||
{
|
{
|
||||||
Navigate("/", noReload: true);
|
|
||||||
|
|
||||||
SetValue(Browser, "callJsNoBoxingNumberA", "108");
|
SetValue(Browser, "callJsNoBoxingNumberA", "108");
|
||||||
SetValue(Browser, "callJsNoBoxingNumberB", "4");
|
SetValue(Browser, "callJsNoBoxingNumberB", "4");
|
||||||
Browser.FindElement(By.CssSelector("#callJsNoBoxing button")).Click();
|
Browser.FindElement(By.CssSelector("#callJsNoBoxing button")).Click();
|
||||||
|
|
||||||
Assert.Equal(".NET received: 27", GetValue(Browser, "callJsNoBoxingResult"));
|
Assert.Equal(".NET received: 27", GetValue(Browser, "callJsNoBoxingResult"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[Fact]
|
||||||
public void CanCallJsFunctionsWithoutBoxingAndReceiveException()
|
public void CanCallJsFunctionsWithoutBoxingAndReceiveException()
|
||||||
{
|
{
|
||||||
Navigate("/", noReload: true);
|
|
||||||
|
|
||||||
SetValue(Browser, "callJsNoBoxingNumberA", "1");
|
SetValue(Browser, "callJsNoBoxingNumberA", "1");
|
||||||
SetValue(Browser, "callJsNoBoxingNumberB", "0");
|
SetValue(Browser, "callJsNoBoxingNumberB", "0");
|
||||||
Browser.FindElement(By.CssSelector("#callJsNoBoxing button")).Click();
|
Browser.FindElement(By.CssSelector("#callJsNoBoxing button")).Click();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue