maui-linux/Xamarin.Forms.Core.UITests..../Tests/RootGalleryUITests.cs

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

using NUnit.Framework;
using System.Collections.Generic;
using System.Linq;
namespace Xamarin.Forms.Core.UITests
{
internal sealed class RootPageModel
{
public string ButtonId { get; private set; }
public string PageId { get; private set; }
public bool IsModal { get; private set; }
public RootPageModel(string buttonId, string pageId, bool isModal = false)
{
ButtonId = buttonId;
PageId = pageId;
IsModal = isModal;
}
}
[TestFixture]
[Category(UITestCategories.RootGallery)]
internal class RootGalleryUITests : BaseTestFixture
{
readonly IEnumerable<RootPageModel> rootPages;
public RootGalleryUITests()
{
string[] ids =
{
"Content",
"Nav->Content",
"MDP->Nav->Content",
"Tab->Content",
"Tab->MDP->Nav->Content",
"Tab->Nav->Content",
"Tab(Many)->Nav->Content",
"Nav->Tab->Content(BAD IDEA)",
"Nav->Tab(Many)->Content(BAD IDEA)",
"MDP->Nav->Tab->Content(BAD IDEA)"
};
string[] modalIds =
{
"(Modal)Content",
"(Modal)Nav->Content",
"(Modal)MDP->Nav->Content",
"(Modal)Tab->Content",
"(Modal)Tab->MDP->Nav->Content",
"(Modal)Tab->Nav->Content",
"(Modal)Tab(Many)->Nav->Content",
"(Modal)Nav->Tab->Content(BAD IDEA)",
"(Modal)Nav->Tab(Many)->Content(BAD IDEA)",
"(Modal)MDP->Nav->Tab->Content(BAD IDEA)",
};
rootPages =
(from id in ids
select new RootPageModel(id + "ButtonId", id + "PageId")).Union(
from id in modalIds
select new RootPageModel(id + "ButtonId", id + "PageId", true));
}
protected override void NavigateToGallery()
{
App.NavigateToGallery(GalleryQueries.RootPagesGallery);
}
[Test]
[Ignore("Ignore while we dont't have a response from XTC team why this fails some times")]
public void VisitEachPage()
{
foreach (var page in rootPages)
{
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
#if __WINDOWS__
App.ScrollDownTo(page.ButtonId, "ChoosePageScrollView");
#else
var scrollViewArea = App.Query(q => q.Marked("ChoosePageScrollView")).First().Rect;
App.ScrollForElement(string.Format("* marked:'{0}'", page.ButtonId),
new Drag(scrollViewArea, Drag.Direction.BottomToTop, Drag.DragLength.Long));
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
#endif
App.Tap(q => q.Marked(page.ButtonId));
bool ios = false;
#if __IOS__
ios = true;
#endif
if (!page.IsModal || ios)
App.WaitForElement(q => q.Marked(page.PageId));
App.Screenshot("Page: " + page.PageId);
}
}
}
}