Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit ebf6c75

Browse files
committed
[UITests] Add Uitest for #12497
1 parent 1bfd5ac commit ebf6c75

File tree

1 file changed

+33
-7
lines changed
  • Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared

1 file changed

+33
-7
lines changed

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue12497.cs

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ namespace Xamarin.Forms.Controls.Issues
1616
#endif
1717
[Preserve(AllMembers = true)]
1818
[Issue(IssueTracker.Github, 12497, "Calling Focus() on a WebView on UWP does not move the focus to the WebView", PlatformAffected.UWP)]
19-
public class Issue12497 : TestContentPage // or TestFlyoutPage, etc ...
19+
public class Issue12497 : TestContentPage
2020
{
2121
bool _firstTimeOnAppearing = true;
2222
Button _button1;
2323
Button _button2;
2424
Button _button3;
2525
WebView _webView;
26+
Label _label;
27+
28+
const string FAIL = "Fail";
29+
const string SUCCESS = "Success";
30+
const string btnAutomationId = "btn3";
2631

2732
protected override void Init()
2833
{
@@ -56,6 +61,11 @@ void PopulatePage()
5661
{
5762
int defaultTabIndex = Int32.MaxValue; // UWP says this should be the max int. Xamarin.Forms docs say it should be 0;
5863

64+
_label = new Label
65+
{
66+
Text = FAIL
67+
};
68+
5969
_button1 = new Button
6070
{
6171
Text = "Button 1 (should be first in tab order)",
@@ -77,6 +87,11 @@ void PopulatePage()
7787
}
7888
};
7989

90+
_webView.Focused += (s, e) =>
91+
{
92+
_label.Text = SUCCESS;
93+
};
94+
8095
_button2 = new Button
8196
{
8297
Text = "Button 2 (should be third in tab order)",
@@ -88,6 +103,7 @@ void PopulatePage()
88103

89104
_button3 = new Button
90105
{
106+
AutomationId = btnAutomationId,
91107
Text = "Button 3 (press to set focus to WebView)",
92108
TextColor = Color.Black,
93109
BackgroundColor = Color.White,
@@ -105,13 +121,23 @@ void PopulatePage()
105121
VerticalOptions = LayoutOptions.Fill,
106122
BackgroundColor = Color.Pink,
107123
Children =
108-
{
109-
_button1,
110-
_webView,
111-
_button2,
112-
_button3
113-
}
124+
{
125+
_button1,
126+
_webView,
127+
_button2,
128+
_button3,
129+
_label
130+
}
114131
};
115132
}
133+
134+
#if UITEST
135+
[Test]
136+
public void Issue12497Test()
137+
{
138+
RunningApp.Tap(btnAutomationId);
139+
RunningApp.WaitForElement(SUCCESS);
140+
}
141+
#endif
116142
}
117143
}

0 commit comments

Comments
 (0)