-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move 10234 to Appium * - fix scroll direction * - increase timeout and remove WinUI test completely * - add logging * Update Issue17347.cs * - add more data
- Loading branch information
Showing
8 changed files
with
258 additions
and
18 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
157 changes: 157 additions & 0 deletions
157
src/Controls/samples/Controls.Sample.UITests/Issues/Issue10234.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,157 @@ | ||
| ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.Maui.Controls; | ||
|
||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[Issue(IssueTracker.None, 10234, "CarouselView disposed on iOS when navigating back in Shell", PlatformAffected.iOS)] | ||
public class Issue10234Test : ContentPage | ||
{ | ||
public Issue10234Test() | ||
{ | ||
Content = new VerticalStackLayout() | ||
{ | ||
Children = | ||
{ | ||
new Button() | ||
{ | ||
Text = "Go To Test", | ||
AutomationId = "GoToTest", | ||
Command = new Command(() => Application.Current.MainPage = new Issue10234()) | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
|
||
public class Issue10234 : Shell | ||
{ | ||
public Issue10234() | ||
{ | ||
TabBar tabBar = new TabBar | ||
{ | ||
Title = "Main", | ||
Route = "main", | ||
Items = | ||
{ | ||
new Tab | ||
{ | ||
Route = "tab1", | ||
Title = "Tab 1", | ||
Items = | ||
{ | ||
new ShellContent() | ||
{ | ||
ContentTemplate = new DataTemplate(() => new ContentPage | ||
{ | ||
Content = new StackLayout | ||
{ | ||
Children = | ||
{ | ||
new Label { Text = "Hej" }, | ||
new Button { | ||
AutomationId = "goToShow", | ||
Text = "Show", | ||
Command = new Command(async () => await GoToAsync("//photos?id=1")) | ||
} | ||
} | ||
} | ||
}), | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
TabBar photosTab = new TabBar() | ||
{ | ||
Title = "Photos", | ||
Route = "photos", | ||
Items = | ||
{ | ||
new ShellSection() | ||
{ | ||
Items = | ||
{ | ||
new ShellContent() | ||
{ | ||
ContentTemplate = new DataTemplate(() => new PhotosPage()), | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
Items.Add(tabBar); | ||
Items.Add(photosTab); | ||
} | ||
|
||
class PhotosPage : ContentPage | ||
{ | ||
|
||
CarouselView Photos; | ||
public PhotosPage() | ||
{ | ||
Photos = new CarouselView | ||
{ | ||
AutomationId = "carouselView", | ||
ItemTemplate = new DataTemplate( | ||
() => | ||
{ | ||
var image = new Image(); | ||
image.SetBinding(Image.SourceProperty, new Binding(".")); | ||
return image; | ||
} | ||
) | ||
}; | ||
|
||
var grid = new Grid(); | ||
grid.RowDefinitions.Add(new RowDefinition()); | ||
grid.RowDefinitions.Add(new RowDefinition()); | ||
var btn = new Button | ||
{ | ||
Text = "Go back", | ||
AutomationId = "goToBack", | ||
Command = new Command(async () => await Shell.Current.GoToAsync("//main")) | ||
}; | ||
Grid.SetRow(Photos, 0); | ||
Grid.SetRow(btn, 1); | ||
grid.Children.Add(Photos); | ||
grid.Children.Add(btn); | ||
Content = grid; | ||
} | ||
|
||
public ObservableCollection<string> Items { get; set; } | ||
|
||
public void LoadData() | ||
{ | ||
var images = new List<string>(); | ||
|
||
images.Add("oasis.jpg"); | ||
images.Add("dotnet_bot.jpg"); | ||
images.Add("shopping_cart.jpg"); | ||
images.Add("groceries.png"); | ||
|
||
|
||
Items = new ObservableCollection<string>(images); | ||
Photos.ItemsSource = Items; | ||
} | ||
|
||
protected override void OnAppearing() | ||
{ | ||
base.OnAppearing(); | ||
|
||
LoadData(); | ||
} | ||
|
||
public int PageId | ||
{ | ||
get; set; | ||
} | ||
} | ||
} | ||
} |
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
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,46 @@ | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.AppiumTests.Issues | ||
{ | ||
public class Issue10234 : _IssuesUITest | ||
{ | ||
public override string Issue => "CarouselView disposed on iOS when navigating back in Shell"; | ||
|
||
public Issue10234(TestDevice device) : base(device) | ||
{ | ||
} | ||
|
||
[Test] | ||
public void ScrollCarouselViewAfterDispose() | ||
{ | ||
this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows }); | ||
|
||
try | ||
{ | ||
_ = App.WaitForElement("GoToTest"); | ||
App.Click("GoToTest"); | ||
App.WaitForElement("goToShow"); | ||
App.Click("goToShow"); | ||
App.WaitForElement("goToBack"); | ||
ScrollNextItem(); | ||
App.Click("goToBack"); | ||
App.WaitForElement("goToShow"); | ||
App.Click("goToShow"); | ||
ScrollNextItem(); | ||
App.WaitForElement("goToBack"); | ||
App.Click("goToBack"); | ||
App.WaitForElement("goToShow"); | ||
} | ||
finally{ | ||
Reset(); | ||
} | ||
} | ||
|
||
void ScrollNextItem() | ||
{ | ||
App.ScrollRight("carouselView"); | ||
} | ||
} | ||
} |
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
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