summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.iOS.UITests/Tests/ContextActionsUITests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Core.iOS.UITests/Tests/ContextActionsUITests.cs')
-rw-r--r--Xamarin.Forms.Core.iOS.UITests/Tests/ContextActionsUITests.cs91
1 files changed, 43 insertions, 48 deletions
diff --git a/Xamarin.Forms.Core.iOS.UITests/Tests/ContextActionsUITests.cs b/Xamarin.Forms.Core.iOS.UITests/Tests/ContextActionsUITests.cs
index 7691dd46..fc80937f 100644
--- a/Xamarin.Forms.Core.iOS.UITests/Tests/ContextActionsUITests.cs
+++ b/Xamarin.Forms.Core.iOS.UITests/Tests/ContextActionsUITests.cs
@@ -31,58 +31,56 @@ namespace Xamarin.Forms.Core.UITests
const string clear = "Clear Items";
const string mark = "Mark";
+
+#if __ANDROID__
[Test]
public void ContextActionsShow ()
{
- if (App is AndroidApp) {
- // mark is an icon on android
- App.TouchAndHold (q => q.Marked (cell0));
- App.WaitForElement (q => q.Marked (delete));
- App.Screenshot ("I have actions!");
- } else if (App is iOSApp) {
- Assert.Inconclusive ("Not tested on iOS yet");
- }
+ // mark is an icon on android
+ App.TouchAndHold (q => q.Marked (cell0));
+ App.WaitForElement (q => q.Marked (delete));
+ App.Screenshot ("I have actions!");
}
[Test]
public void ContextActionsDelete ()
{
- if (App is AndroidApp) {
- // mark is an icon on android
- App.TouchAndHold (q => q.Marked (cell0));
- App.WaitForElement (q => q.Marked (delete));
- App.Screenshot ("I have actions!");
-
- App.Tap (q => q.Marked (delete));
- App.WaitForNoElement (q => q.Marked (cell0));
- App.Screenshot ("Deleted cell 0");
-
- } else if (App is iOSApp) {
- Assert.Inconclusive ("Not tested on iOS yet");
- }
+ // mark is an icon on android
+ App.TouchAndHold (q => q.Marked (cell0));
+ App.WaitForElement (q => q.Marked (delete));
+ App.Screenshot ("I have actions!");
+
+ App.Tap (q => q.Marked (delete));
+ App.WaitForNoElement (q => q.Marked (cell0));
+ App.Screenshot ("Deleted cell 0");
}
+#endif
+#if __IOS__
[Test]
public void PopoverDismiss()
{
- if (App is iOSApp) {
- var app = ((iOSApp)App);
- if (app.Device.IsTablet) {
- var screenBounds = App.Query (PlatformQueries.Root)[0].Rect;
- var cellBounds = App.Query (q => q.Marked (cell0))[0].Rect;
- App.DragCoordinates (screenBounds.Width - 10, cellBounds.CenterY, 10, cellBounds.CenterY);
- App.Screenshot("I see context actions");
- App.Tap (q => q.Marked ("More"));
- App.Screenshot ("Should see Popover");
- App.TapCoordinates (50, 50);
- App.Screenshot ("I should not crash");
- } else {
- Assert.Inconclusive("Not testing iOS Phone");
- }
+ var device = App.Device as iOSDevice;
+
+ if (device == null)
+ {
+ return;
+ }
+
+ if (device.IsTablet) {
+ var screenBounds = App.Query (PlatformQueries.Root)[0].Rect;
+ var cellBounds = App.Query (q => q.Marked (cell0))[0].Rect;
+ App.DragCoordinates (screenBounds.Width - 10, cellBounds.CenterY, 10, cellBounds.CenterY);
+ App.Screenshot("I see context actions");
+ App.Tap (q => q.Marked ("More"));
+ App.Screenshot ("Should see Popover");
+ App.TapCoordinates (50, 50);
+ App.Screenshot ("I should not crash");
} else {
- Assert.Inconclusive ("Not testing on Android");
+ Assert.Inconclusive("Not testing iOS Phone");
}
}
+#endif
}
[TestFixture]
@@ -107,23 +105,20 @@ namespace Xamarin.Forms.Core.UITests
const string mark = "Mark";
const string cellWithNoContextActions = "I have no ContextActions";
+#if __ANDROID__
[Test]
public void ContextActionsShowAndReset ()
{
- if (App is AndroidApp) {
- // mark is an icon on android
- App.TouchAndHold (q => q.Marked (cell0));
- App.WaitForElement (q => q.Marked (delete));
- App.Screenshot ("I have actions!");
+ // mark is an icon on android
+ App.TouchAndHold (q => q.Marked (cell0));
+ App.WaitForElement (q => q.Marked (delete));
+ App.Screenshot ("I have actions!");
- App.Tap (q => q.Marked (cellWithNoContextActions));
- App.WaitForNoElement (q => q.Marked (delete));
- App.Screenshot ("Actions should be gone");
-
- } else if (App is iOSApp) {
- Assert.Inconclusive ("Not tested on iOS yet");
- }
+ App.Tap (q => q.Marked (cellWithNoContextActions));
+ App.WaitForNoElement (q => q.Marked (delete));
+ App.Screenshot ("Actions should be gone");
}
+#endif
}
}