maui-linux/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issu.../Bugzilla34561.cs

86 строки
2.1 KiB
C#
Исходник Обычный вид История

2016-03-22 23:02:25 +03:00
using System;
using Xamarin.Forms.CustomAttributes;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using Xamarin.Forms.Internals;
2016-03-22 23:02:25 +03:00
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.UITest.iOS;
Add more UWP automated testing capabilities (#1252) * Implement Clear(marked) method * For Windows tests where we need to query a value we can't get, mark inconclusive * Fix queries for multi-line "marked" values * Force frames with text in them to be "tappable" * Actually rerun queries during retry * Update images for package deployment * Allow the tests to restart the Control Gallery if it crashes * UWP tests can now activate context menus * Make double-tap (really double click) work for UWP desktop * Get some basic scroll up/down functions working * ScrollTo functions * Modify ListViewRenderer automation peer to prevent freezing on ListViews * Allow automation to find tabs * Temporarily ignore some of the tests which don't do much * Make ListViews with string/value type lists work * Add note about 29257/60478 * Use toggle button for test 30353 for UWP * Handle getting screen bounds consistently * Make test for G2414 use ActivateContextMenu extension method * Simplify UI test for 31330 and make it runnable on Windows * Add notes on failing tests * Add query for MoreButton on G2809 test * Ignore ActivityIndicator IsRunning test for UWP * Use ScrollDownTo instead of ScrollForElement method on Windows * CellsGalleryTestCellList now working on UWP * Cells tests working on UWP * Re-add Tap to ScrollAndTap * Get rid of custom automation peer stuff and just fix the tests * Viewport caching and multi-monitor support for scroll * Modified scroll values to hopefully get this running correctly on high density screen * Clear messages so Appearing tests don't freeze up automation on UWP * Make test for 32230 compatible with UWP * Make test 32615 compatible with UWP * Use ActivateContextMenu to simplify 34561 test * Add notes for 34912 failure * Make 36171 test compatible with UWP tests Add directions for running the tests locally * PR cleanup
2017-11-10 13:52:25 +03:00
using Xamarin.Forms.Core.UITests;
2016-03-22 23:02:25 +03:00
#endif
namespace Xamarin.Forms.Controls.Issues
2016-03-22 23:02:25 +03:00
{
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Bugzilla, 34561, "[A] Navigation.PushAsync crashes when used in Context Actions (legacy)", PlatformAffected.Android)]
public class Bugzilla34561 : TestContentPage
{
protected override void Init ()
{
var listView = new ListView () {
ItemsSource = new List<string> { "item" },
ItemTemplate = new DataTemplate (typeof(ContextActionTemplate))
};
Content = listView;
}
[Preserve (AllMembers = true)]
public class NextPage : TestContentPage
{
protected override void Init ()
{
Content = new Label {
AutomationId = "NextPageLabel",
Text = "See if I'm here"
};
}
}
[Preserve (AllMembers = true)]
public class ContextActionTemplate : ViewCell
{
public ContextActionTemplate ()
{
MenuItem newMenuItem = new MenuItem { Text = "Click" };
newMenuItem.Clicked += NewMenuItem_Clicked;
ContextActions.Add (newMenuItem);
View = new StackLayout {
Children = {
new Label {
Text = "Click and hold",
AutomationId = "ListViewItem",
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center
}
}
};
}
void NewMenuItem_Clicked (object sender, EventArgs e)
{
#pragma warning disable 618
2016-03-22 23:02:25 +03:00
ParentView.Navigation.PushAsync (new NextPage (), false);
#pragma warning restore 618
2016-03-22 23:02:25 +03:00
}
}
#if UITEST
[Test]
public void Bugzilla34561Test ()
{
RunningApp.WaitForElement (q => q.Marked ("ListViewItem"));
Add more UWP automated testing capabilities (#1252) * Implement Clear(marked) method * For Windows tests where we need to query a value we can't get, mark inconclusive * Fix queries for multi-line "marked" values * Force frames with text in them to be "tappable" * Actually rerun queries during retry * Update images for package deployment * Allow the tests to restart the Control Gallery if it crashes * UWP tests can now activate context menus * Make double-tap (really double click) work for UWP desktop * Get some basic scroll up/down functions working * ScrollTo functions * Modify ListViewRenderer automation peer to prevent freezing on ListViews * Allow automation to find tabs * Temporarily ignore some of the tests which don't do much * Make ListViews with string/value type lists work * Add note about 29257/60478 * Use toggle button for test 30353 for UWP * Handle getting screen bounds consistently * Make test for G2414 use ActivateContextMenu extension method * Simplify UI test for 31330 and make it runnable on Windows * Add notes on failing tests * Add query for MoreButton on G2809 test * Ignore ActivityIndicator IsRunning test for UWP * Use ScrollDownTo instead of ScrollForElement method on Windows * CellsGalleryTestCellList now working on UWP * Cells tests working on UWP * Re-add Tap to ScrollAndTap * Get rid of custom automation peer stuff and just fix the tests * Viewport caching and multi-monitor support for scroll * Modified scroll values to hopefully get this running correctly on high density screen * Clear messages so Appearing tests don't freeze up automation on UWP * Make test for 32230 compatible with UWP * Make test 32615 compatible with UWP * Use ActivateContextMenu to simplify 34561 test * Add notes for 34912 failure * Make 36171 test compatible with UWP tests Add directions for running the tests locally * PR cleanup
2017-11-10 13:52:25 +03:00
RunningApp.ActivateContextMenu("ListViewItem");
2016-03-22 23:02:25 +03:00
RunningApp.WaitForElement (q => q.Marked ("Click"));
RunningApp.Tap (q => q.Marked ("Click"));
RunningApp.WaitForElement (q => q.Marked ("NextPageLabel"));
RunningApp.Screenshot ("I see the next page");
}
#endif
}
}