diff options
author | Rui Marinho <me@ruimarinho.net> | 2017-03-23 11:03:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-23 11:03:48 +0000 |
commit | 2be80a55a514a050ab5ab07a201d13c111f49f63 (patch) | |
tree | a9cc64903a830e4b754ae6eee3fcc2ebb3ba200d /Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs | |
parent | 16fcac8cf52ab960e7354a52864b0a72aefdfc1f (diff) | |
download | xamarin-forms-2be80a55a514a050ab5ab07a201d13c111f49f63.tar.gz xamarin-forms-2be80a55a514a050ab5ab07a201d13c111f49f63.tar.bz2 xamarin-forms-2be80a55a514a050ab5ab07a201d13c111f49f63.zip |
[UITests]Add Xamarin.Forms.Core.UITests.Shared (#711)
* [UITests]Add Xamarin.Forms.Core.UITests.Shared
* fix
* [UITests]Use shared UITest project on macOS
* [UITests] Add correct platform queries
* [Controls] Add missing Preserve
Diffstat (limited to 'Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs')
-rw-r--r-- | Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs b/Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs new file mode 100644 index 00000000..b5f52b9c --- /dev/null +++ b/Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs @@ -0,0 +1,35 @@ +using System; +using System.Linq; + +using Xamarin.UITest; +using Xamarin.UITest.Queries; +using System.Text.RegularExpressions; + +namespace Xamarin.Forms.Core.UITests +{ + internal static class AppExtensions + { + public static AppRect ScreenBounds (this IApp app) + { + return app.Query (Queries.Root ()).First().Rect; + } + + public static void NavigateBack (this IApp app) + { + app.Tap (Queries.NavigationBarBackButton ()); + } + + public static void NavigateToGallery (this IApp app, string page) + { + const string goToTestButtonQuery = "* marked:'GoToTestButton'"; + + var text = Regex.Match (page, "'(?<text>[^']*)'").Groups["text"].Value; + app.EnterText (q => q.Raw ("* marked:'SearchBar'"), text); + + app.WaitForElement(q => q.Raw(goToTestButtonQuery), "Timed out waiting for Go To Test button to disappear", TimeSpan.FromSeconds(10)); + + app.Tap (q => q.Raw (goToTestButtonQuery)); + app.WaitForNoElement (o => o.Raw (goToTestButtonQuery), "Timed out waiting for Go To Test button to disappear", TimeSpan.FromMinutes(2)); + } + } +} |