Fix and identify flaky components E2E Tests (#8690)

This commit is contained in:
Javier Calvarro Nelson 2019-03-21 07:39:47 +01:00 committed by GitHub
parent 69732c9ecc
commit 5f4be179e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

View File

@ -1,14 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Linq;
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure; using Microsoft.AspNetCore.Components.E2ETest.Infrastructure;
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures; using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures;
using Microsoft.AspNetCore.E2ETesting; using Microsoft.AspNetCore.E2ETesting;
using OpenQA.Selenium; using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI; using OpenQA.Selenium.Support.UI;
using System;
using System.Linq;
using System.Threading.Tasks;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
@ -41,7 +40,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests
[Fact] [Fact]
public void HasHeading() public void HasHeading()
{ {
Assert.Equal("Hello, world!", Browser.FindElement(By.TagName("h1")).Text); Browser.Equal("Hello, world!", () => Browser.FindElement(By.CssSelector("h1#index")).Text);
} }
[Fact] [Fact]
@ -96,7 +95,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests
{ {
// Navigate to "Fetch Data" // Navigate to "Fetch Data"
Browser.FindElement(By.LinkText("Fetch data")).Click(); Browser.FindElement(By.LinkText("Fetch data")).Click();
Browser.Equal("Weather forecast", () => Browser.FindElement(By.TagName("h1")).Text); Browser.Equal("Weather forecast", () => Browser.FindElement(By.CssSelector("h1#fetch-data")).Text);
// Wait until loaded // Wait until loaded
var tableSelector = By.CssSelector("table.table"); var tableSelector = By.CssSelector("table.table");

View File

@ -6,6 +6,7 @@ using BasicTestApp;
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure; using Microsoft.AspNetCore.Components.E2ETest.Infrastructure;
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures; using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures;
using Microsoft.AspNetCore.E2ETesting; using Microsoft.AspNetCore.E2ETesting;
using Microsoft.AspNetCore.Testing.xunit;
using OpenQA.Selenium; using OpenQA.Selenium;
using OpenQA.Selenium.Interactions; using OpenQA.Selenium.Interactions;
using Xunit; using Xunit;
@ -133,6 +134,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Tests
} }
[Fact] [Fact]
[Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/1987")]
public void InputEvent_RespondsOnKeystrokes() public void InputEvent_RespondsOnKeystrokes()
{ {
MountTestComponent<InputEventComponent>(); MountTestComponent<InputEventComponent>();

View File

@ -2,7 +2,7 @@
@page "/fetchdata/{StartDate:datetime}" @page "/fetchdata/{StartDate:datetime}"
@inject WeatherForecastService ForecastService @inject WeatherForecastService ForecastService
<h1>Weather forecast</h1> <h1 id="fetch-data">Weather forecast</h1>
<p>This component demonstrates fetching data from the server.</p> <p>This component demonstrates fetching data from the server.</p>

View File

@ -1,5 +1,5 @@
@page "/" @page "/"
<h1>Hello, world!</h1> <h1 id="index">Hello, world!</h1>
Welcome to your new app. Welcome to your new app.