-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - add timeouts for test that's occasionally freezing * Reenable RefreshView Tests * - disable touch for catalyst as well * - add category * - move buttons around * - make click recover better * - fix
- Loading branch information
Showing
6 changed files
with
162 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/Controls/tests/TestCases.HostApp/Issues/Issue16910.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Issues.Issue16910"> | ||
<ContentPage.Content> | ||
<Grid RowDefinitions="Auto,100,*,50,50" x:Name="grid"> | ||
<Label Grid.Row="1" Text="Interact with the RefreshView and make sure the IsRefreshing Label correctly Represents current state." /> | ||
<RefreshView x:Name="refreshView" Grid.Row="2" IsRefreshing="{Binding IsRefreshing, Mode=TwoWay}"> | ||
<CollectionView ItemsSource="{Binding ItemSource}" AutomationId="CollectionView"> | ||
<CollectionView.ItemTemplate> | ||
<DataTemplate> | ||
<Label Text="{Binding Text}" AutomationId="{Binding AutomationId}" /> | ||
</DataTemplate> | ||
</CollectionView.ItemTemplate> | ||
</CollectionView> | ||
</RefreshView> | ||
<Button x:Name="StopRefreshing" AutomationId="StopRefreshing" Grid.Row="3" Text="Stop Refresh" Clicked="OnStopRefreshClicked" /> | ||
<Button x:Name="StartRefreshing" AutomationId="StartRefreshing" Grid.Row="4" Text="Refresh" Clicked="OnRefreshClicked" /> | ||
</Grid> | ||
</ContentPage.Content> | ||
</ContentPage> |
72 changes: 72 additions & 0 deletions
72
src/Controls/tests/TestCases.HostApp/Issues/Issue16910.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Linq; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Xaml; | ||
using Microsoft.Maui.Platform; | ||
|
||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[Issue(IssueTracker.Github, 16910, "IsRefreshing binding works", PlatformAffected.All)] | ||
public partial class Issue16910 : ContentPage | ||
{ | ||
Label _isRefreshingLabel = new Label(){Text = "Is Refreshing", AutomationId = "IsRefreshing"}; | ||
Label _isNotRefreshingLabel = new Label(){Text = "Is Not Refreshing", AutomationId = "IsNotRefreshing"}; | ||
|
||
bool _isRefreshing; | ||
|
||
public IEnumerable ItemSource {get; set;} | ||
|
||
public bool IsRefreshing | ||
{ | ||
get => _isRefreshing; | ||
set | ||
{ | ||
_isRefreshing = value; | ||
OnPropertyChanged(nameof(IsRefreshing)); | ||
UpdateRefreshingLabels(); | ||
} | ||
} | ||
|
||
void UpdateRefreshingLabels() | ||
{ | ||
if (IsRefreshing) | ||
{ | ||
grid.Remove(_isNotRefreshingLabel); | ||
grid.Insert(0, _isRefreshingLabel); | ||
StartRefreshing.IsVisible = false; | ||
StopRefreshing.IsVisible = true; | ||
} | ||
else | ||
{ | ||
grid.Remove(_isRefreshingLabel); | ||
grid.Insert(0, _isNotRefreshingLabel); | ||
StartRefreshing.IsVisible = true; | ||
StopRefreshing.IsVisible = false; | ||
} | ||
} | ||
|
||
public Issue16910() | ||
{ | ||
InitializeComponent(); | ||
UpdateRefreshingLabels(); | ||
ItemSource = | ||
Enumerable.Range(0,100) | ||
.Select(x => new { Text = $"Item {x}", AutomationId = $"Item{x}" }) | ||
.ToList(); | ||
|
||
this.BindingContext = this; | ||
} | ||
|
||
|
||
void OnStopRefreshClicked(object sender, EventArgs e) | ||
{ | ||
refreshView.IsRefreshing = false; | ||
} | ||
|
||
void OnRefreshClicked(object sender, EventArgs e) | ||
{ | ||
refreshView.IsRefreshing = true; | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16910.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
||
public class Issue16910 : _IssuesUITest | ||
{ | ||
public override string Issue => "IsRefreshing binding works"; | ||
|
||
protected override bool ResetAfterEachTest => true; | ||
public Issue16910(TestDevice device) | ||
: base(device) | ||
{ | ||
|
||
} | ||
|
||
[Test] | ||
public void BindingUpdatesFromProgrammaticRefresh() | ||
{ | ||
_ = App.WaitForElement("StartRefreshing"); | ||
App.Tap("StartRefreshing"); | ||
App.WaitForElement("IsRefreshing"); | ||
App.Click("StopRefreshing"); | ||
App.WaitForElement("IsNotRefreshing"); | ||
} | ||
|
||
// Windows only works with touch inputs which we don't have running on the test server | ||
#if !WINDOWS && !MACCATALYST | ||
[Test] | ||
[Category(UITestCategories.RefreshView)] | ||
public void BindingUpdatesFromInteractiveRefresh() | ||
{ | ||
_ = App.WaitForElement("CollectionView"); | ||
App.ScrollUp("CollectionView"); | ||
App.WaitForElement("IsRefreshing"); | ||
App.Tap("StopRefreshing"); | ||
App.WaitForElement("IsNotRefreshing"); | ||
} | ||
#endif | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters