Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions UITests/UITests.App/DefaultPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Page
x:Class="UITests.App.DefaultPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>

</Grid>
</Page>
19 changes: 19 additions & 0 deletions UITests/UITests.App/DefaultPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Windows.UI.Xaml.Controls;

namespace UITests.App
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class DefaultPage : Page
{
public DefaultPage()
{
this.InitializeComponent();
}
}
}
7 changes: 2 additions & 5 deletions UITests/UITests.App/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Loaded="Page_Loaded"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>
<testhelpers:TestAutomationHelpersPanel />

<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="Click Me" Click="Button_Click"/>
<TextBlock x:Name="textBlock"/>
</StackPanel>
<Frame x:Name="navigationFrame" />
</Grid>
</Page>
65 changes: 63 additions & 2 deletions UITests/UITests.App/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,79 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using Windows.UI.Core;
using Windows.UI.Xaml;

namespace UITests.App
{
public sealed partial class MainPage
{
private static readonly string _pageNS = typeof(MainPage).Namespace + ".Pages.";
private NetworkStream clientStream;
private StreamWriter writer;

public MainPage()
{
InitializeComponent();
}

private void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
private void Page_Loaded(object sender, RoutedEventArgs e)
{
textBlock.Text = "Clicked";
navigationFrame.Navigate(typeof(DefaultPage));

Task.Run(ConnectToTestDriver);
}

private void ConnectToTestDriver()
{
var client = new TcpClient();
client.ConnectAsync(IPAddress.Loopback, 13000);

clientStream = client.GetStream();
writer = new StreamWriter(clientStream)
{
AutoFlush = true
};

writer.WriteLine("Ready");

var thread = new Thread(new ThreadStart(ListenForPageRequest));
thread.Start();
}

private void ListenForPageRequest()
{
var reader = new StreamReader(clientStream);

while (true)
{
try
{
if (reader.ReadLine() is string request)
{
var type = Type.GetType(_pageNS + request);
Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => navigationFrame.Navigate(type))
.AsTask()
.ContinueWith(_ => writer.WriteLine("Opened " + request));
}
else
{
// The server has disconnected
break;
}
}
catch
{
// A socket error has occurred
break;
}
}
}
}
}
1 change: 1 addition & 0 deletions UITests/UITests.App/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@

<Capabilities>
<Capability Name="internetClient" />
<Capability Name="privateNetworkClientServer"/>
</Capabilities>
</Package>
51 changes: 51 additions & 0 deletions UITests/UITests.App/Pages/Controls/TextBoxMaskTestPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<Page
x:Class="UITests.App.Pages.TextBoxMaskTestPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="10"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button
x:Name="ChangeButton"
Content="Change Target Value"
Click="ChangeButton_Click"
Grid.Column="0" Grid.Row="0"
/>
<TextBox
x:Name="TextBox"
Width="120"
Padding="0,4,0,0"
VerticalAlignment="Center"
extensions:TextBoxMask.CustomMask="5:[0-5]"
extensions:TextBoxMask.Mask="99:59:59"
TextAlignment="Center"
Text="{x:Bind Value, Mode=OneWay}"
Grid.Column="2" Grid.Row="0"
/>
<TextBlock
x:Name="InitialValueTextBlock"
Text="{x:Bind InitialValue}"
HorizontalAlignment="Center"
Grid.Column="0" Grid.Row="2"
/>
<TextBlock
x:Name="NewValueTextBlock"
Text="{x:Bind NewValue}"
HorizontalAlignment="Center"
Grid.Column="2" Grid.Row="2"
/>
</Grid>
</Page>
41 changes: 41 additions & 0 deletions UITests/UITests.App/Pages/Controls/TextBoxMaskTestPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace UITests.App.Pages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class TextBoxMaskTestPage : Page
{
private const string INITIAL_VALUE = "12:50:59";
private const string NEW_VALUE = "00:00:00";

public string InitialValue => INITIAL_VALUE;

public string NewValue => NEW_VALUE;

public string Value
{
get { return (string)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}

public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register(nameof(Value), typeof(string), typeof(TextBoxMaskTestPage), new PropertyMetadata(INITIAL_VALUE));

public TextBoxMaskTestPage()
{
this.InitializeComponent();
}

private void ChangeButton_Click(object sender, RoutedEventArgs e)
{
Value = NEW_VALUE;
}
}
}
13 changes: 13 additions & 0 deletions UITests/UITests.App/Pages/SimpleTest.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Page
x:Class="UITests.App.Pages.SimpleTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="Click Me" Click="Button_Click"/>
<TextBlock x:Name="textBlock"/>
</StackPanel>
</Page>
25 changes: 25 additions & 0 deletions UITests/UITests.App/Pages/SimpleTest.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace UITests.App.Pages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class SimpleTest : Page
{
public SimpleTest()
{
this.InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
textBlock.Text = "Clicked";
}
}
}
31 changes: 30 additions & 1 deletion UITests/UITests.App/UITests.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
Expand All @@ -52,6 +53,7 @@
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -63,6 +65,7 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
Expand All @@ -75,6 +78,7 @@
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -87,6 +91,7 @@
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
<OutputPath>bin\ARM64\Release\</OutputPath>
Expand All @@ -99,6 +104,7 @@
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -110,6 +116,7 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
Expand All @@ -122,6 +129,7 @@
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
Expand All @@ -130,9 +138,18 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="DefaultPage.xaml.cs">
<DependentUpon>DefaultPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SimpleTest.xaml.cs">
<DependentUpon>SimpleTest.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Controls\TextBoxMaskTestPage.xaml.cs">
<DependentUpon>TextBoxMaskTestPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
Expand All @@ -155,10 +172,22 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="DefaultPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\SimpleTest.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Controls\TextBoxMaskTestPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
Expand Down Expand Up @@ -252,4 +281,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
Loading