-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Bugzilla28498.cs
97 lines (85 loc) · 2.57 KB
/
Bugzilla28498.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
using System.Threading.Tasks;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(Core.UITests.UITestCategories.Bugzilla)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 28498, "App crashes when switching between NavigationPages on a MasterDetailPage when In-Call Status Bar is visible")]
public class Bugzilla28498 : TestMasterDetailPage
{
protected override void Init()
{
var carrouselChildPage = new ContentPage
{
Content = new StackLayout
{
Orientation = StackOrientation.Vertical,
Children = {
new Label { Text = "Carousel Page" },
new Button { Text = "Open", AutomationId="btnOpen", Command = new Command (() => IsPresented = true) },
},
Padding = 10
}
};
var otherPage = new ContentPage
{
Content = new StackLayout
{
Orientation = StackOrientation.Vertical,
Children = {
new Label { Text = "Other" },
new Button { Text = "Open", AutomationId="btnOpen", Command = new Command (() => IsPresented = true) },
},
Padding = 10
}
};
var carousel = new NavigationPage(new CarouselPage { Children = { carrouselChildPage } });
var other = new NavigationPage(otherPage);
Detail = carousel;
Master = new ContentPage
{
Title = "Menu",
Content = new StackLayout
{
Orientation = StackOrientation.Vertical,
Children = {
new Button { Text = "Page 1 (Carousel)", AutomationId="btnCarousel", Command = new Command(() => Detail = carousel) },
new Button { Text = "Page 2 (Other)", AutomationId="btnOther", Command = new Command(() => Detail = other) },
},
Padding = 10
}
};
}
#if UITEST
[Test]
[Ignore("This test doesn't make a lot of sense and crashes 50% of the time; need to re-investigate it.")]
public void Bugzilla28498Test()
{
RunningApp.SetOrientationPortrait();
RunningApp.Tap(q => q.Marked("btnOpen"));
RunningApp.Tap(q => q.Marked("btnOther"));
RunningApp.SetOrientationLandscape();
RunningApp.Tap(q => q.Marked("btnOpen"));
RunningApp.Screenshot("Detail open");
if (RunningApp.Query(c => c.Marked("btnCarousel")).Length > 0)
Assert.DoesNotThrow(() => RunningApp.Tap(q => q.Marked("btnCarousel")));
else
Assert.Inconclusive("Should be button here, but rotation could take some time on XTC");
}
[TearDown]
public override void TearDown()
{
RunningApp.SetOrientationPortrait();
base.TearDown();
}
#endif
}
}