Fix Issue 774 test so it works with wrapped IApp on phone and tablet

This commit is contained in:
E.Z. Hart 2016-11-30 11:08:30 -07:00
Родитель e648192af7
Коммит 2600a02543
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 1196DD903A2F7606
1 изменённых файлов: 12 добавлений и 35 удалений

Просмотреть файл

@ -34,48 +34,25 @@ namespace Xamarin.Forms.Controls.Issues
[Test]
public void Issue774TestsDismissActionSheetAfterRotation ()
{
RunningApp.Tap(q => q.Button("Show ActionSheet"));
RunningApp.Screenshot("Show ActionSheet");
RunningApp.Tap (q => q.Button ("Show ActionSheet"));
RunningApp.Screenshot ("Show ActionSheet");
RunningApp.SetOrientationLandscape();
RunningApp.Screenshot("Rotate Device");
RunningApp.SetOrientationLandscape ();
RunningApp.Screenshot ("Rotate Device");
var app = (RunningApp as iOSApp);
// Wait for the action sheet element to show up
RunningApp.WaitForElement(q => q.Marked("What's up"));
if (app != null) {
var dismiss = RunningApp.Query("Dismiss");
if (!app.Device.IsTablet)
RunningApp.Tap (q => q.Marked ("Dismiss"));
else // iPad does not have dismiss option
RunningApp.Tap (q => q.Marked ("Destroy"));
var target = dismiss.Length > 0 ? "Dismiss" : "Destroy";
if(app.Device.IsTablet)
RunningApp.WaitForNoElement (q => q.Marked ("Destroy"));
else
RunningApp.WaitForNoElement (q => q.Marked ("Dismiss"));
RunningApp.Screenshot ("Dismiss ActionSheet");
RunningApp.Tap(q => q.Marked(target));
RunningApp.WaitForNoElement(q => q.Marked(target));
RunningApp.Screenshot("Dismiss ActionSheet");
// App.SetOrientationPortrait ();
// App.Tap (q => q.Button ("Show ActionSheet"));
// App.Screenshot ("Rotate and show ActionSheet");
//
// if (!app.Device.IsTablet)
// App.Tap (q => q.Button ("Dismiss"));
// else // iPad does not have dismiss option
// App.Tap (q => q.Marked ("Destroy"));
//
// if (app.Device.IsTablet)
// App.WaitForNoElement (q => q.Marked ("Destroy"));
// else // iPad does not have dismiss option
// App.WaitForNoElement (q => q.Marked ("Dismiss"));
}
else
{
RunningApp.Tap(q => q.Marked("Dismiss"));
}
}
[TearDown]