From 6be88f6cae5a258702c294a543fc8f57c28e20cf Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Mon, 8 Apr 2019 12:17:49 -0300 Subject: [PATCH] Create UITest for Bugzilla41619 (#5829) * - create UITest for Bugzilla41619 * - remove the hard code --- .../Bugzilla41619.cs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41619.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41619.cs index 5c1081e9d..ad9a0f85f 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41619.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41619.cs @@ -3,20 +3,27 @@ using Xamarin.Forms.Internals; using System.ComponentModel; using System.Runtime.CompilerServices; + #if UITEST using Xamarin.UITest; using NUnit.Framework; +using Xamarin.Forms.Core.UITests; #endif namespace Xamarin.Forms.Controls.Issues { [Preserve(AllMembers = true)] [Issue(IssueTracker.Bugzilla, 41619, "[WinRT/UWP] Slider binding works incorrectly", PlatformAffected.WinRT)] + +#if UITEST + [NUnit.Framework.Category(UITestCategories.Slider)] +#endif public class Bugzilla41619 : TestContentPage { + const double _success = 6; protected override void Init() { - var vm = new Bugzilla41619ViewModel { SliderValue = 5 }; + var vm = new Bugzilla41619ViewModel(); BindingContext = vm; var label = new Label(); label.SetBinding(Label.TextProperty, "SliderValue"); @@ -32,7 +39,7 @@ namespace Xamarin.Forms.Controls.Issues { label, slider, - new Label { Text = "The initial slider value above should be 5." } + new Label { Text = $"The initial slider value above should be {_success}." } } }; } @@ -40,7 +47,7 @@ namespace Xamarin.Forms.Controls.Issues [Preserve(AllMembers = true)] class Bugzilla41619ViewModel : INotifyPropertyChanged { - private double _sliderValue; + private double _sliderValue = _success; public double SliderValue { @@ -59,5 +66,14 @@ namespace Xamarin.Forms.Controls.Issues PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } + + +#if UITEST + [Test] + public void SliderBinding() + { + RunningApp.WaitForElement(_success.ToString()); + } +#endif } } \ No newline at end of file