diff options
author | Rui Marinho <me@ruimarinho.net> | 2017-01-30 12:29:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-30 12:29:27 +0000 |
commit | 0b7623b5e6dea1a4ab0257b94b6ce6c67864f34b (patch) | |
tree | e85e8fd0c2e3d2f346ac03d2367d98e77f76728b /Xamarin.Forms.Core.macOS.UITests | |
parent | 11331bc10e854c06c45cb9a6f860fcde2b71667f (diff) | |
download | xamarin-forms-0b7623b5e6dea1a4ab0257b94b6ce6c67864f34b.tar.gz xamarin-forms-0b7623b5e6dea1a4ab0257b94b6ce6c67864f34b.tar.bz2 xamarin-forms-0b7623b5e6dea1a4ab0257b94b6ce6c67864f34b.zip |
[MacOS] Fixes to ToolbarItems (#728)
* [MacOS] Support toolbar item property changes
* [UITest,MacOS] Support query by button hardcoded
* [UITests] Add and fix more toolbar tests
Diffstat (limited to 'Xamarin.Forms.Core.macOS.UITests')
-rw-r--r-- | Xamarin.Forms.Core.macOS.UITests/MacOSApp.cs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/Xamarin.Forms.Core.macOS.UITests/MacOSApp.cs b/Xamarin.Forms.Core.macOS.UITests/MacOSApp.cs index 08c3118d..bb0e9a6b 100644 --- a/Xamarin.Forms.Core.macOS.UITests/MacOSApp.cs +++ b/Xamarin.Forms.Core.macOS.UITests/MacOSApp.cs @@ -290,6 +290,15 @@ namespace Xamarin.Forms.Core.macOS.UITests var result = allREsults[0].Children[0].Children[0].Children[1]; results.Add(result.ToUITestResult()); } + else if (queryStr.Contains("button")) + { + var allREsults = _cocoaApp.QueryByType("button"); + foreach (var item in allREsults) + { + results.Add(item.ToUITestResult()); + } + + } return results.ToArray(); } @@ -615,6 +624,7 @@ namespace Xamarin.Forms.Core.macOS.UITests indexMarked = 0; markedWord = string.Empty; var isSuccess = false; + var queryStr = query(new AppQuery(QueryPlatform.iOS)).ToString(); var isIndex = System.Text.RegularExpressions.Regex.IsMatch(queryStr, @"\bindex\b"); if (isIndex) @@ -641,14 +651,26 @@ namespace Xamarin.Forms.Core.macOS.UITests markedWord = markedWords[1].Replace("'", "").Trim(); isSuccess = true; } + if (!isSuccess) + { + if (queryStr == "button") + { + isSuccess = true; + } + } return isSuccess; } void Tap(string marked, int index) { var safeIndex = Math.Max(index, 0); - var queryById = _cocoaApp.QueryById(marked.Trim())[safeIndex]; - _cocoaApp.Click(queryById.Rect.CenterX, queryById.Rect.CenterY); + var all = _cocoaApp.Query(); + var centerPoint = new PointF(); + if (!string.IsNullOrEmpty(marked)) + centerPoint = _cocoaApp.QueryById(marked.Trim())[safeIndex].Rect.Center; + else + centerPoint = _cocoaApp.QueryByType("Button")[safeIndex].Rect.Center; + _cocoaApp.Click(centerPoint.X, centerPoint.Y); Thread.Sleep(1000); } |