[UITests] Try fix iOS failing tests (#4264)

* [UITests] Try fix iOS failing tests

* [UITests] Try fix 1931 test

* [UITests] WaitForElement on test for 1469
This commit is contained in:
Rui Marinho 2018-11-13 12:46:56 +00:00 коммит произвёл GitHub
Родитель 5ec989c455
Коммит a7d6d2ce59
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -14,6 +14,10 @@ namespace Xamarin.Forms.Controls.Issues
[Issue(IssueTracker.Github, 1469, "Setting SelectedItem to null inside ItemSelected event handler does not work", PlatformAffected.UWP)]
public class Issue1469 : TestContentPage
{
const string Go = "Select 3rd item";
const string Back = "Clear selection";
const string Success = "Success";
const string Fail = "Fail";
protected override void Init()
{
var statusLabel = new Label() { FontSize = 40 };
@ -31,15 +35,15 @@ namespace Xamarin.Forms.Controls.Issues
statusLabel.Text = "One moment please...";
await Task.Delay(500);
statusLabel.Text = list.SelectedItem == null ? "Success" : "Fail";
statusLabel.Text = list.SelectedItem == null ? Success : Fail;
};
Content = new StackLayout
{
Children = {
new Label { Text = "If you click an item in the list it should not become selected" },
new Button { Text = "Select 3rd item", Command = new Command(() => list.SelectedItem = _items[2]) },
new Button { Text = "Clear selection", Command = new Command(() => list.SelectedItem = list.SelectedItem = null) },
new Button { Text = Go, Command = new Command(() => list.SelectedItem = _items[2]) },
new Button { Text = Back, Command = new Command(() => list.SelectedItem = list.SelectedItem = null) },
statusLabel,
list
}
@ -50,9 +54,9 @@ namespace Xamarin.Forms.Controls.Issues
[Test]
public void Issue1469Test()
{
RunningApp.WaitForElement("Select 3rd item");
RunningApp.Tap("Select 3rd item");
RunningApp.WaitForElement("Success");
RunningApp.WaitForElement(Go);
RunningApp.Tap(Go);
RunningApp.WaitForElement(Success);
}
#endif
}

Просмотреть файл

@ -22,7 +22,7 @@ namespace Xamarin.Forms.Controls.Issues
public class Issue1931 : TestNavigationPage
{
const string Go = "Go";
const string Back = "Back";
const string Back = "GoBack";
const string Success = "Success";
Label _result;
Label _instructions2;
@ -32,7 +32,7 @@ namespace Xamarin.Forms.Controls.Issues
var page = new ContentPage();
page.Title = "GH1931 Root";
var button = new Button { Text = Go };
var button = new Button { Text = Go , AutomationId = Go };
button.Clicked += (sender, args) => PushAsync(ListViewPage());
var instructions = new Label { Text = $"Tap the {Go} button" };
@ -68,7 +68,7 @@ namespace Xamarin.Forms.Controls.Issues
var instructions = new Label { Text = $"Tap the {Back} button" };
var button = new Button { Text = Back };
var button = new Button { Text = Back, AutomationId = Back };
button.Clicked += (sender, args) => PopAsync();
layout.Children.Add(instructions);

Просмотреть файл

@ -143,7 +143,7 @@ namespace Xamarin.Forms.Controls.Issues
public event PropertyChangedEventHandler PropertyChanged;
}
#if UITEST
#if UITEST && __ANDROID__
[Test]
public void ViewCellsAllDisposed()
{

Просмотреть файл

@ -141,9 +141,11 @@ namespace Xamarin.Forms.Core.UITests
#if __MACOS__
var btn1 = App.Query(c => c.Button())[4];
#else
App.WaitForElement(c => c.Marked(btn1Id));
var btn1 = App.Query(c => c.Marked(btn1Id))[0];
#endif
ShouldShowMenu();
App.WaitForElement(c => c.Marked(btn4Id));
var btn2 = App.Query(c => c.Marked(btn4Id))[0];
#if __IOS__
Assert.True(btn1.Rect.CenterY < btn2.Rect.CenterY);