Merge pull request #21 from unoplatform/dev/jela/misc-updates
Misc updates
This commit is contained in:
Коммит
d9e40509e7
|
@ -20,10 +20,10 @@
|
|||
<AndroidUseIntermediateDesignerFile>True</AndroidUseIntermediateDesignerFile>
|
||||
<ResourcesDirectory>..\Sample.Shared\Strings</ResourcesDirectory>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<IsUiAutomationMappingEnabled>true</IsUiAutomationMappingEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PropertyGroup>
|
||||
<IsUiAutomationMappingEnabled>true</IsUiAutomationMappingEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
|
@ -60,7 +60,7 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Uno.UI" Version="1.46.0-dev.1991" />
|
||||
<PackageReference Include="Uno.UI" Version="2.0.512-dev.3360" />
|
||||
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.32" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -89,4 +89,4 @@
|
|||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<!-- This will force the generation of the APK when not buildig inside visual studio -->
|
||||
<Target Name="GenerateBuild" DependsOnTargets="SignAndroidPackage" AfterTargets="Build" Condition="'$(BuildingInsideVisualStudio)'==''" />
|
||||
</Project>
|
||||
</Project>
|
|
@ -1,16 +1,18 @@
|
|||
<UserControl
|
||||
x:Class="Sample.Shared.Tests.CheckBox_Tests"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Sample.Shared.Tests"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400">
|
||||
x:Class="Sample.Shared.Tests.CheckBox_Tests"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Sample.Shared.Tests"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400">
|
||||
|
||||
<StackPanel>
|
||||
<StackPanel>
|
||||
<CheckBox x:Name="cb1" Content="Test 1"/>
|
||||
<CheckBox x:Name="cb2" Content="Test 2"/>
|
||||
<Border x:Name="checked1" Width="200" Height="30" />
|
||||
<Border x:Name="checked2" Width="200" Height="30" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
|
@ -12,6 +13,7 @@ using Windows.UI.Xaml.Data;
|
|||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using Windows.UI.Xaml.Shapes;
|
||||
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
|
@ -22,6 +24,16 @@ namespace Sample.Shared.Tests
|
|||
public CheckBox_Tests()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
cb1.Checked += (snd, evt) =>
|
||||
checked1.Child = new Rectangle {Name = "rect1", Fill = new SolidColorBrush(Colors.Red)};
|
||||
cb1.Unchecked += (snd, evt) =>
|
||||
checked1.Child = null;
|
||||
|
||||
cb2.Checked += (snd, evt) =>
|
||||
checked2.Child = new Rectangle {Name = "rect2", Fill = new SolidColorBrush(Colors.Blue)};
|
||||
cb2.Unchecked += (snd, evt) =>
|
||||
checked2.Child = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,15 +29,45 @@ namespace Sample.UITests
|
|||
var value2 = App.Query(q => cb2(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First();
|
||||
Assert.IsFalse(value2);
|
||||
|
||||
App.WaitForNoElement("rect1");
|
||||
App.WaitForNoElement("rect2");
|
||||
|
||||
App.Tap(cb1);
|
||||
|
||||
var value3 = App.Query(q => cb1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First();
|
||||
Assert.IsTrue(value3);
|
||||
|
||||
App.WaitForElement("rect1");
|
||||
|
||||
App.Tap(cb2);
|
||||
|
||||
var value4 = App.Query(q => cb1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First();
|
||||
Assert.IsTrue(value4);
|
||||
|
||||
App.WaitForElement("rect2");
|
||||
|
||||
App.Tap(cb1);
|
||||
App.Tap(cb2);
|
||||
|
||||
App.WaitForNoElement("rect1");
|
||||
App.WaitForNoElement("rect2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckBox01_RawQuery()
|
||||
{
|
||||
Query checkBoxSelector = q => q.Raw("* marked:'CheckBox01'");
|
||||
App.WaitForElement(checkBoxSelector);
|
||||
|
||||
App.Tap(checkBoxSelector);
|
||||
|
||||
Query cb1 = q => q.Raw("* marked:'cb1'");
|
||||
App.WaitForElement(cb1);
|
||||
|
||||
App.Tap(cb1);
|
||||
|
||||
var value3 = App.Query(q => cb1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First();
|
||||
Assert.IsTrue(value3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,10 @@ namespace Sample.UITests
|
|||
AppInitializer.TestEnvironment.iOSDeviceNameOrId = Constants.iOSDeviceNameOrId;
|
||||
AppInitializer.TestEnvironment.CurrentPlatform = Constants.CurrentPlatform;
|
||||
|
||||
#if DEBUG
|
||||
AppInitializer.TestEnvironment.WebAssemblyHeadless = false;
|
||||
#endif
|
||||
|
||||
// Start the app only once, so the tests runs don't restart it
|
||||
// and gain some time for the tests.
|
||||
AppInitializer.ColdStartApp();
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
<Content Include="LinkerConfig.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Uno.UI" Version="1.46.0-dev.1991" />
|
||||
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.0.0-dev.298" />
|
||||
<PackageReference Include="Uno.UI" Version="2.0.512-dev.3360" />
|
||||
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.0.0-dev.302" />
|
||||
<DotNetCliToolReference Include="Uno.Wasm.Bootstrap.Cli" Version="1.0.0-dev.137" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\Sample.Shared\Sample.Shared.projitems" Label="Shared" Condition="Exists('..\Sample.Shared\Sample.Shared.projitems')" />
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
<BundleResource Include="Resources\Fonts\winjs-symbols.ttf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Uno.UI" Version="1.46.0-dev.1991" />
|
||||
<PackageReference Include="Uno.UI" Version="2.0.512-dev.3360" />
|
||||
<PackageReference Include="Xamarin.TestCloud.Agent">
|
||||
<Version>0.21.8</Version>
|
||||
</PackageReference>
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace Uno.UITest.Selenium
|
|||
|
||||
void IApp.ClearText(Func<IAppQuery, IAppWebQuery> query) => throw new NotSupportedException();
|
||||
|
||||
void IApp.DismissKeyboard() => throw new NotSupportedException();
|
||||
void IApp.DismissKeyboard() => Console.WriteLine("DismissKeybord has no effect on this platform");
|
||||
|
||||
void IApp.DoubleTap(Func<IAppQuery, IAppQuery> query)
|
||||
{
|
||||
|
@ -367,8 +367,8 @@ namespace Uno.UITest.Selenium
|
|||
return new FileInfo(fileName);
|
||||
}
|
||||
|
||||
void IApp.SetOrientationLandscape() => throw new NotSupportedException();
|
||||
void IApp.SetOrientationPortrait() => throw new NotSupportedException();
|
||||
void IApp.SetOrientationLandscape() => Console.WriteLine($"SetOrientationLandscape is not supported by this platform");
|
||||
void IApp.SetOrientationPortrait() => Console.WriteLine($"SetOrientationPortrait is not supported by this platform");
|
||||
void IApp.SetSliderValue(string marked, double value) => throw new NotSupportedException();
|
||||
void IApp.SetSliderValue(Func<IAppQuery, IAppQuery> query, double value) => throw new NotSupportedException();
|
||||
void IApp.SwipeLeftToRight(Func<IAppQuery, IAppWebQuery> query, double swipePercentage, int swipeSpeed, bool withInertia) => throw new NotSupportedException();
|
||||
|
@ -379,7 +379,7 @@ namespace Uno.UITest.Selenium
|
|||
void IApp.SwipeRightToLeft(Func<IAppQuery, IAppWebQuery> query, double swipePercentage, int swipeSpeed, bool withInertia) => throw new NotSupportedException();
|
||||
void IApp.SwipeRightToLeft(Func<IAppQuery, IAppQuery> query, double swipePercentage, int swipeSpeed, bool withInertia) => throw new NotSupportedException();
|
||||
void IApp.SwipeRightToLeft(string marked, double swipePercentage, int swipeSpeed, bool withInertia) => throw new NotSupportedException();
|
||||
void IApp.Tap(string marked) => throw new NotSupportedException();
|
||||
void IApp.Tap(string marked) => ((IApp)this).Tap(q => q.Marked(marked));
|
||||
void IApp.Tap(Func<IAppQuery, IAppWebQuery> query) => throw new NotSupportedException();
|
||||
|
||||
void IApp.Tap(Func<IAppQuery, IAppQuery> query)
|
||||
|
@ -407,15 +407,15 @@ namespace Uno.UITest.Selenium
|
|||
}
|
||||
}
|
||||
|
||||
void IApp.TapCoordinates(float x, float y)
|
||||
{
|
||||
PerformActions(a => a
|
||||
void IApp.TapCoordinates(float x, float y)
|
||||
{
|
||||
PerformActions(a => a
|
||||
.MoveToElement(_driver.FindElementByTagName("body"), 0, 0)
|
||||
.MoveByOffset((int)x, (int)y)
|
||||
.Click());
|
||||
}
|
||||
}
|
||||
|
||||
void IApp.TouchAndHold(Func<IAppQuery, IAppQuery> query) => throw new NotSupportedException();
|
||||
void IApp.TouchAndHold(Func<IAppQuery, IAppQuery> query) => throw new NotSupportedException();
|
||||
void IApp.TouchAndHold(string marked) => throw new NotSupportedException();
|
||||
void IApp.TouchAndHoldCoordinates(float x, float y) => throw new NotSupportedException();
|
||||
void IApp.WaitFor(Func<bool> predicate, string timeoutMessage, TimeSpan? timeout, TimeSpan? retryFrequency, TimeSpan? postTimeout)
|
||||
|
@ -463,7 +463,7 @@ namespace Uno.UITest.Selenium
|
|||
{
|
||||
var results = (this as IApp).Query(query);
|
||||
|
||||
if(results.Count() != 0)
|
||||
if(results.Any())
|
||||
{
|
||||
return results;
|
||||
}
|
||||
|
@ -475,10 +475,35 @@ namespace Uno.UITest.Selenium
|
|||
}
|
||||
|
||||
void IApp.WaitForNoElement(Func<IAppQuery, IAppQuery> query, string timeoutMessage, TimeSpan? timeout, TimeSpan? retryFrequency, TimeSpan? postTimeout)
|
||||
=> throw new NotSupportedException();
|
||||
{
|
||||
var sw = Stopwatch.StartNew();
|
||||
timeout = timeout ?? DefaultTimeout;
|
||||
retryFrequency = retryFrequency ?? DefaultRetry;
|
||||
timeoutMessage = timeoutMessage ?? "Timed out waiting for element...";
|
||||
|
||||
void IApp.WaitForNoElement(string marked, string timeoutMessage, TimeSpan? timeout, TimeSpan? retryFrequency, TimeSpan? postTimeout)
|
||||
=> throw new NotSupportedException();
|
||||
while(sw.Elapsed < timeout)
|
||||
{
|
||||
var results = (this as IApp).Query(query);
|
||||
|
||||
if(!results.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Thread.Sleep(retryFrequency.Value);
|
||||
}
|
||||
|
||||
throw new TimeoutException(timeoutMessage);
|
||||
}
|
||||
|
||||
void IApp.WaitForNoElement(string marked, string timeoutMessage, TimeSpan? timeout, TimeSpan? retryFrequency,
|
||||
TimeSpan? postTimeout)
|
||||
=> (this as IApp).WaitForNoElement(
|
||||
query: q => q.Marked(marked),
|
||||
timeoutMessage: timeoutMessage,
|
||||
timeout: timeout,
|
||||
retryFrequency: retryFrequency,
|
||||
postTimeout: postTimeout);
|
||||
|
||||
void IApp.WaitForNoElement(
|
||||
Func<IAppQuery, IAppWebQuery> query,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Uno.UITest.Selenium
|
||||
{
|
||||
|
@ -108,7 +110,7 @@ namespace Uno.UITest.Selenium
|
|||
IInvokeJSAppQuery IAppQuery.InvokeJS(string javascript) => throw new System.NotImplementedException();
|
||||
|
||||
IAppQuery IAppQuery.Marked(string text)
|
||||
=> Apply(() => _queryItems.Add(new SearchQueryItem($"//*[@xamlname='{text}' or @xuid='{text}']")));
|
||||
=> Apply(() => _queryItems.Add(new SearchQueryItem($"//*[@xamlname='{text}' or @xuid='{text}' or @xamlautomationid='{text}']")));
|
||||
|
||||
IAppQuery IAppQuery.Parent(string className)
|
||||
=> Apply(() => _queryItems.Add(new SearchQueryItem($"./ancestor::*[ends-with(@xamltype, {className})]")));
|
||||
|
@ -136,7 +138,28 @@ namespace Uno.UITest.Selenium
|
|||
IAppTypedSelector<string> IAppQuery.Raw(string calabashQuery, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6) => throw new System.NotImplementedException();
|
||||
IAppTypedSelector<string> IAppQuery.Raw(string calabashQuery, object arg1, object arg2, object arg3) => throw new System.NotImplementedException();
|
||||
IAppTypedSelector<string> IAppQuery.Raw(string calabashQuery, object arg1, object arg2) => throw new System.NotImplementedException();
|
||||
IAppQuery IAppQuery.Raw(string calabashQuery) => throw new System.NotImplementedException();
|
||||
IAppQuery IAppQuery.Raw(string calabashQuery)
|
||||
{
|
||||
var match = Regex.Match(calabashQuery, @"(.*)\s(marked|text):'((.|\n)*)'");
|
||||
|
||||
var controlType = match.Groups[1].Captures[0].Value;
|
||||
var type = match.Groups[2].Captures[0].Value;
|
||||
var value = match.Groups[3].Captures[0].Value;
|
||||
|
||||
if(controlType == "*")
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case "marked":
|
||||
return ((IAppQuery)this).Marked(value);
|
||||
case "text":
|
||||
return ((IAppQuery)this).Text(value);
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotSupportedException($"Raw Query is not supported [{calabashQuery}]");
|
||||
}
|
||||
|
||||
IAppTypedSelector<string> IAppQuery.Raw(string calabashQuery, object arg1, object arg2, object arg3, object arg4) => throw new System.NotImplementedException();
|
||||
IAppTypedSelector<string> IAppQuery.Raw(string calabashQuery, object arg1) => throw new System.NotImplementedException();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.UITest" Version="3.0.4-dev1" />
|
||||
<PackageReference Include="Xamarin.UITest" Version="3.0.4-dev2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Загрузка…
Ссылка в новой задаче