Skip to content

Commit

Permalink
Setup lane to run CV2 and CV1 tests (#25719)
Browse files Browse the repository at this point in the history
* Setup lane to run CV2 and CV1 tests

* - fix cake

* - fix args

* - fix

* - yaml

* - maybe

* - force CV2 for failing CV1 scenarios

* Update CarouselViewLoopNoFreeze.cs

* Update Issue12574.cs

* - force CV2
  • Loading branch information
PureWeen authored Nov 11, 2024
1 parent c3c192b commit fad03e7
Show file tree
Hide file tree
Showing 18 changed files with 202 additions and 51 deletions.
4 changes: 4 additions & 0 deletions eng/devices/ios.cake
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ void ExecuteUITests(string project, string app, string device, string resultsDir
.Append("/bl:" + binlog)
});

var TEST_CONFIGURATION_ARGS = Argument("TEST_CONFIGURATION_ARGS", EnvironmentVariable("TEST_CONFIGURATION_ARGS") ?? "");

Information("TEST_CONFIGURATION_ARGS {0}", TEST_CONFIGURATION_ARGS);
SetEnvironmentVariable("TEST_CONFIGURATION_ARGS", TEST_CONFIGURATION_ARGS);
SetEnvironmentVariable("APPIUM_LOG_FILE", appiumLog);

Information("Run UITests project {0}", project);
Expand Down
5 changes: 5 additions & 0 deletions eng/pipelines/common/ui-tests-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ parameters:
configuration : "Release"
runtimeVariant : "Mono"
testFilter: ''
testConfigurationArgs: ''

steps:
- task: DownloadPipelineArtifact@2
Expand Down Expand Up @@ -95,6 +96,7 @@ steps:
$command += " --results=""$(TestResultsDirectory)"" --binlog=""$(LogDirectory)"" ${{ parameters.cakeArgs }} --verbosity=diagnostic"
$testFilter = ""
$testConfigrationArgs = "${{ parameters.testConfigurationArgs }}"
"${{ parameters.testFilter }}".Split(",") | ForEach {
$testFilter += "TestCategory=" + $_ + "|"
Expand All @@ -103,6 +105,9 @@ steps:
$testFilter = $testFilter.TrimEnd("|")
# Cake does not allow empty parameters, so check if our filter is empty before adding it
if ($testConfigrationArgs) {
$command += " --TEST_CONFIGURATION_ARGS=""$testConfigrationArgs"""
}
if ($testFilter) {
$command += " --test-filter ""$testFilter"""
}
Expand Down
37 changes: 37 additions & 0 deletions eng/pipelines/common/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,43 @@ stages:
runtimeVariant : "Mono"
testFilter: $(CATEGORYGROUP)

- stage: ios_ui_tests_mono_cv2
displayName: iOS UITests Mono CollectionView2
dependsOn: build_ui_tests
jobs:
- ${{ each project in parameters.projects }}:
- ${{ if ne(project.ios, '') }}:
- ${{ each version in parameters.iosVersions }}:
- ${{ if not(containsValue(project.iosVersionsExclude, version)) }}:
- job: ios_ui_tests_mono_${{ project.name }}_${{ replace(version, '.', '_') }}
timeoutInMinutes: 240 # how long to run the job before automatically cancelling
workspace:
clean: all
displayName: ${{ coalesce(project.desc, project.name) }} (v${{ version }})
pool: ${{ parameters.iosPool }}
variables:
REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE)
APPIUM_HOME: $(System.DefaultWorkingDirectory)/.appium/
steps:
- template: ui-tests-steps.yml
parameters:
platform: ios
${{ if eq(version, 'latest') }}:
version: 16.4
${{ if ne(version, 'latest') }}:
version: ${{ version }}
path: ${{ project.ios }}
app: ${{ project.app }}
${{ if eq(version, 'latest') }}:
device: ios-simulator-64
${{ if ne(version, 'latest') }}:
device: ios-simulator-64_${{ version }}
provisionatorChannel: ${{ parameters.provisionatorChannel }}
agentPoolAccessToken: ${{ parameters.agentPoolAccessToken }}
runtimeVariant : "Mono"
testFilter: "CollectionView"
testConfigurationArgs: "CollectionView2"

- ${{ if or(parameters.BuildEverything, and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'devdiv'))) }}:
- stage: ios_ui_tests_nativeaot
displayName: iOS UITests NativeAOT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
Expand Down Expand Up @@ -47,6 +47,7 @@ protected override void Init()
};
_btn2.SetBinding(Button.CommandProperty, "RemoveAllItemsCommand");

// https://github.com/dotnet/maui/pull/25692
_carouselView = new CarouselView
{
AutomationId = carouselAutomationId,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

#if IOS || MACCATALYST
using Foundation;
#endif

namespace Maui.Controls.Sample
{

class CollectionView1 : CollectionView{}
class CollectionView2 : CollectionView{}


class CarouselView1 : CarouselView{}
class CarouselView2 : CarouselView{}

public static partial class CollectionViewHostBuilderExtentions
{
/// <summary>
/// Configure the .NET MAUI app to listen for fold-related events
/// in the Android lifecycle. Ensures <see cref="Microsoft.Maui.Controls.Foldable.TwoPaneView"/>
/// can detect and layout around a hinge or screen fold.
/// </summary>
/// <remarks>
/// Relies on Jetpack Window Manager to detect and respond to
/// foldable device features and capabilities.
/// </remarks>
public static MauiAppBuilder ConfigureCollectionViewHandlers(this MauiAppBuilder builder)
{

#if IOS || MACCATALYST
builder.ConfigureMauiHandlers(handlers =>
{
bool cv2Handlers = false;
foreach(var en in NSProcessInfo.ProcessInfo.Environment)
{
if ($"{en.Key}" == "TEST_CONFIGURATION_ARGS")
{
cv2Handlers = $"{en.Value}".Contains("CollectionView2", StringComparison.OrdinalIgnoreCase);
break;
}
}

if (cv2Handlers)
{
Console.WriteLine($"Using CollectionView2 handlers");
handlers.AddHandler<Microsoft.Maui.Controls.CollectionView, Microsoft.Maui.Controls.Handlers.Items2.CollectionViewHandler2>();
handlers.AddHandler<Microsoft.Maui.Controls.CarouselView, Microsoft.Maui.Controls.Handlers.Items2.CarouselViewHandler2>();
}
else
{
Console.WriteLine($"Using CollectionView handlers");
handlers.AddHandler<Microsoft.Maui.Controls.CollectionView, Microsoft.Maui.Controls.Handlers.Items.CollectionViewHandler>();
handlers.AddHandler<Microsoft.Maui.Controls.CarouselView, Microsoft.Maui.Controls.Handlers.Items.CarouselViewHandler>();
}

handlers.AddHandler<CollectionView1, Microsoft.Maui.Controls.Handlers.Items.CollectionViewHandler>();
handlers.AddHandler<CarouselView1, Microsoft.Maui.Controls.Handlers.Items.CarouselViewHandler>();


handlers.AddHandler<CollectionView2, Microsoft.Maui.Controls.Handlers.Items2.CollectionViewHandler2>();
handlers.AddHandler<CarouselView2, Microsoft.Maui.Controls.Handlers.Items2.CarouselViewHandler2>();
});
#endif

return builder;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Maui.Controls.Sample.CollectionViewGalleries.HeaderFooterGalleries.HeaderFooterGrid">
x:Class="Maui.Controls.Sample.CollectionViewGalleries.HeaderFooterGalleries.HeaderFooterGrid"
xmlns:local="clr-namespace:Maui.Controls.Sample">
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
Expand All @@ -15,27 +16,27 @@
<Button Text="Toggle Header" Clicked="ToggleHeader"></Button>
<Button Text="Toggle Footer" Clicked="ToggleFooter"></Button>
</StackLayout>
<CollectionView x:Name="CollectionView" Grid.Row="1" >
<CollectionView.ItemsLayout>
<local:CollectionView2 x:Name="CollectionView" Grid.Row="1" >
<local:CollectionView2.ItemsLayout>
<GridItemsLayout Span="3" Orientation="Vertical" HorizontalItemSpacing="4" VerticalItemSpacing="2"></GridItemsLayout>
</CollectionView.ItemsLayout>
<CollectionView.Header>
</local:CollectionView2.ItemsLayout>
<local:CollectionView2.Header>
<StackLayout BackgroundColor="Transparent">
<Image Source="oasis.jpg" Aspect="AspectFill" HeightRequest="60"></Image>
<Label Text="This Is A Header" TextColor="AntiqueWhite" HorizontalTextAlignment="Center"
FontAttributes="Bold" FontSize="36" />
<Button Text="Add Content" Clicked="AddContentClicked"></Button>
</StackLayout>
</CollectionView.Header>
<CollectionView.Footer>
</local:CollectionView2.Header>
<local:CollectionView2.Footer>
<StackLayout BackgroundColor="Transparent">
<Image Source="oasis.jpg" Aspect="AspectFill" HeightRequest="80"></Image>
<Label Text="This Is A Footer" TextColor="AntiqueWhite" HorizontalTextAlignment="Center" Rotation="10"
FontAttributes="Bold" FontSize="20" />
<Button Text="Add Content" Clicked="AddContentClicked"></Button>
</StackLayout>
</CollectionView.Footer>
</CollectionView>
</local:CollectionView2.Footer>
</local:CollectionView2>
</Grid>
</ContentPage.Content>
</ContentPage>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Maui.Controls.Sample.CollectionViewGalleries.HeaderFooterGalleries.HeaderFooterGridHorizontal">
x:Class="Maui.Controls.Sample.CollectionViewGalleries.HeaderFooterGalleries.HeaderFooterGridHorizontal"
xmlns:local="clr-namespace:Maui.Controls.Sample">
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
Expand All @@ -17,15 +18,15 @@
<Button Text="Toggle Footer"
Clicked="ToggleFooter"></Button>
</StackLayout>
<CollectionView Grid.Row="1" x:Name="CollectionView">
<CollectionView.ItemsLayout>
<local:CollectionView2 Grid.Row="1" x:Name="CollectionView">
<local:CollectionView2.ItemsLayout>
<GridItemsLayout Span="3"
Orientation="Horizontal"
HorizontalItemSpacing="4"
VerticalItemSpacing="2"></GridItemsLayout>
</CollectionView.ItemsLayout>
</local:CollectionView2.ItemsLayout>

<CollectionView.Header>
<local:CollectionView2.Header>

<StackLayout>
<Image Source="oasis.jpg"
Expand All @@ -42,9 +43,9 @@
</StackLayout>
</StackLayout>

</CollectionView.Header>
</local:CollectionView2.Header>

<CollectionView.Footer>
<local:CollectionView2.Footer>

<StackLayout>
<Image Source="cover1.jpg"
Expand All @@ -62,9 +63,9 @@
</StackLayout>
</StackLayout>

</CollectionView.Footer>
</local:CollectionView2.Footer>

</CollectionView>
</local:CollectionView2>
</Grid>
</ContentPage.Content>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;

Expand All @@ -13,7 +13,7 @@ public class CarouselViewLoopNoFreeze : ContentPage
readonly string _btnRemoveAllAutomationId = "btnRemoveAll";

readonly ViewModelIssue12574 _viewModel;
readonly CarouselView _carouselView;
readonly CarouselView2 _carouselView;
readonly Button _btn;
readonly Button _btn2;

Expand All @@ -33,7 +33,7 @@ public CarouselViewLoopNoFreeze()
};
_btn2.SetBinding(Button.CommandProperty, "RemoveAllItemsCommand");

_carouselView = new CarouselView
_carouselView = new CarouselView2
{
AutomationId = _carouselAutomationId,
Margin = new Thickness(30),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Maui.Controls.Sample.Issues
[Issue(IssueTracker.None, 10300, "ObservableCollection.RemoveAt(index) with a valid index raises ArgumentOutOfRangeException", PlatformAffected.iOS)]
public class CarouselViewRemoveAt : ContentPage
{
readonly CarouselView _carousel;
readonly CarouselView2 _carousel;

public class ModalPage : ContentPage
{
Expand Down Expand Up @@ -47,7 +47,7 @@ public CarouselViewRemoveAt()
new ModelCarouselViewRemoveAt("8", Colors.IndianRed),
new ModelCarouselViewRemoveAt("9", Colors.Khaki),
});
_carousel = new CarouselView
_carousel = new CarouselView2
{
ItemTemplate = new DataTemplate(() =>
{
Expand Down
24 changes: 12 additions & 12 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue11896.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue11896"
xmlns:local="clr-namespace:Maui.Controls.Sample.Issues"
x:Name="ThisMainPage"
Title="Main Page">
Title="Main Page"
xmlns:local="clr-namespace:Maui.Controls.Sample">

<Grid RowDefinitions="Auto,*">

Expand All @@ -17,41 +17,41 @@
<Button Command="{Binding RemoveCommand}" Text="Remove item" AutomationId="RemoveButton" />
</HorizontalStackLayout>

<CollectionView Grid.Row="1" ItemsSource="{Binding ItemList}">
<local:CollectionView2 Grid.Row="1" ItemsSource="{Binding ItemList}">

<CollectionView.HeaderTemplate>
<local:CollectionView2.HeaderTemplate>
<DataTemplate>
<Label
Padding="10"
FontAttributes="Bold"
FontSize="Large"
Text="Cities" />
</DataTemplate>
</CollectionView.HeaderTemplate>
</local:CollectionView2.HeaderTemplate>

<CollectionView.ItemTemplate>
<local:CollectionView2.ItemTemplate>
<DataTemplate>
<Label Padding="20,5,5,5" Text="{Binding .}" />
</DataTemplate>
</CollectionView.ItemTemplate>
</local:CollectionView2.ItemTemplate>

<CollectionView.EmptyViewTemplate>
<local:CollectionView2.EmptyViewTemplate>
<DataTemplate>
<Label Padding="20,5,5,5" Text="Empty" />
</DataTemplate>
</CollectionView.EmptyViewTemplate>
</local:CollectionView2.EmptyViewTemplate>

<CollectionView.FooterTemplate>
<local:CollectionView2.FooterTemplate>
<DataTemplate>
<Label
Padding="10"
FontAttributes="Bold"
FontSize="Large"
Text="Hello world !!!" />
</DataTemplate>
</CollectionView.FooterTemplate>
</local:CollectionView2.FooterTemplate>

</CollectionView>
</local:CollectionView2>

</Grid>
</ContentPage>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ContentPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue22035Page1">
x:Class="Maui.Controls.Sample.Issues.Issue22035Page">
<VerticalStackLayout
Spacing="25"
Padding="30,0"
Expand Down
Loading

0 comments on commit fad03e7

Please sign in to comment.