Skip to content

Commit

Permalink
Update to vs test 17.9.X to fix JAVA_HOME environement not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Iguins committed May 3, 2024
1 parent 9669fd2 commit b9896ef
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 38 deletions.
9 changes: 5 additions & 4 deletions src/Sample/Sample.UITests/AppDataModeTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
using NUnit.Framework.Legacy;
using Uno.UITest;
using Uno.UITest.Helpers;
using Uno.UITest.Helpers.Queries;
Expand All @@ -21,18 +22,18 @@ public void AppDataModeTest()
}

var app = OpenSample(AppDataMode.Clear);
Assert.AreEqual("<INITIAL_VALUE>", app.Marked("LocalSettingValueTextBlock").GetDependencyPropertyValue<string>("Text"));
ClassicAssert.AreEqual("<INITIAL_VALUE>", app.Marked("LocalSettingValueTextBlock").GetDependencyPropertyValue<string>("Text"));
app.Marked("SetLocalSettingButton").Tap();
app.Marked("GetLocalSettingButton").Tap();
Assert.AreEqual("MyValue", app.Marked("LocalSettingValueTextBlock").GetDependencyPropertyValue<string>("Text"));
ClassicAssert.AreEqual("MyValue", app.Marked("LocalSettingValueTextBlock").GetDependencyPropertyValue<string>("Text"));

app = OpenSample(AppDataMode.DoNotClear);
app.Marked("GetLocalSettingButton").Tap();
Assert.AreEqual("MyValue", app.Marked("LocalSettingValueTextBlock").GetDependencyPropertyValue<string>("Text"));
ClassicAssert.AreEqual("MyValue", app.Marked("LocalSettingValueTextBlock").GetDependencyPropertyValue<string>("Text"));

app = OpenSample(AppDataMode.Clear);
app.Marked("GetLocalSettingButton").Tap();
Assert.AreEqual("<NOT_SET>", app.Marked("LocalSettingValueTextBlock").GetDependencyPropertyValue<string>("Text"));
ClassicAssert.AreEqual("<NOT_SET>", app.Marked("LocalSettingValueTextBlock").GetDependencyPropertyValue<string>("Text"));
}

private static IApp OpenSample(AppDataMode mode = AppDataMode.Clear)
Expand Down
11 changes: 6 additions & 5 deletions src/Sample/Sample.UITests/CheckBox_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using NUnit.Framework.Legacy;
using Uno.UITest.Helpers.Queries;
using Query = System.Func<Uno.UITest.IAppQuery, Uno.UITest.IAppQuery>;

Expand All @@ -24,25 +25,25 @@ public void CheckBox01()
App.WaitForElement(cb2);

var value = App.Query(q => cb1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First();
Assert.IsFalse(value);
ClassicAssert.IsFalse(value);

var value2 = App.Query(q => cb2(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First();
Assert.IsFalse(value2);
ClassicAssert.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);
ClassicAssert.IsTrue(value3);

App.WaitForElement("rect1");

App.Tap(cb2);

var value4 = App.Query(q => cb1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First();
Assert.IsTrue(value4);
ClassicAssert.IsTrue(value4);

App.WaitForElement("rect2");

Expand All @@ -67,7 +68,7 @@ public void CheckBox01_RawQuery()
App.Tap(cb1);

var value3 = App.Query(q => cb1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First();
Assert.IsTrue(value3);
ClassicAssert.IsTrue(value3);
}
}
}
3 changes: 2 additions & 1 deletion src/Sample/Sample.UITests/DoubleTapped_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using NUnit.Framework.Legacy;
using Uno.UITest.Helpers.Queries;
using Uno.UITests.Helpers;

Expand All @@ -25,7 +26,7 @@ public void DoubleTap()

// Sanity in case of timeout without exception!
var result = App.Query(q => q.Marked("Result").GetDependencyPropertyValue("Text").Value<string>()).Single();
Assert.AreEqual("Double tapped!", result);
ClassicAssert.AreEqual("Double tapped!", result);
}
}
}
3 changes: 2 additions & 1 deletion src/Sample/Sample.UITests/DragCoordinates_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using NUnit.Framework.Legacy;
using Uno.UITest.Helpers.Queries;
using Uno.UITests.Helpers;
using Query = System.Func<Uno.UITest.IAppQuery, Uno.UITest.IAppQuery>;
Expand Down Expand Up @@ -64,7 +65,7 @@ public void DragBorder01()

var movedCount = int.Parse(movedCountText);

Assert.Greater(movedCount, 1);
ClassicAssert.Greater(movedCount, 1);
}
}
}
33 changes: 17 additions & 16 deletions src/Sample/Sample.UITests/RadioButton_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using NUnit.Framework.Legacy;
using Uno.UITest.Helpers.Queries;
using Query = System.Func<Uno.UITest.IAppQuery, Uno.UITest.IAppQuery>;

Expand All @@ -30,34 +31,34 @@ public void RadioButton01()

App.Screenshot("RadioButton01 - Initial");

Assert.IsFalse(App.Query(q => radio1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.IsFalse(App.Query(q => radio2(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.IsFalse(App.Query(q => radio3(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.AreEqual("", App.Query(q => results(q).GetDependencyPropertyValue("Text").Value<string>()).First());
ClassicAssert.IsFalse(App.Query(q => radio1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.IsFalse(App.Query(q => radio2(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.IsFalse(App.Query(q => radio3(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.AreEqual("", App.Query(q => results(q).GetDependencyPropertyValue("Text").Value<string>()).First());

App.Tap(radio1);
App.Screenshot("RadioButton01 - Step 1");

Assert.IsTrue(App.Query(q => radio1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.IsFalse(App.Query(q => radio2(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.IsFalse(App.Query(q => radio3(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.AreEqual("Radio 01", App.Query(q => results(q).GetDependencyPropertyValue("Text").Value<string>()).First());
ClassicAssert.IsTrue(App.Query(q => radio1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.IsFalse(App.Query(q => radio2(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.IsFalse(App.Query(q => radio3(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.AreEqual("Radio 01", App.Query(q => results(q).GetDependencyPropertyValue("Text").Value<string>()).First());

App.Tap(radio2);
App.Screenshot("RadioButton01 - Step 2");

Assert.IsFalse(App.Query(q => radio1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.IsTrue(App.Query(q => radio2(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.IsFalse(App.Query(q => radio3(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.AreEqual("Radio 02", App.Query(q => results(q).GetDependencyPropertyValue("Text").Value<string>()).First());
ClassicAssert.IsFalse(App.Query(q => radio1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.IsTrue(App.Query(q => radio2(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.IsFalse(App.Query(q => radio3(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.AreEqual("Radio 02", App.Query(q => results(q).GetDependencyPropertyValue("Text").Value<string>()).First());

App.Tap(radio3);
App.Screenshot("RadioButton01 - Step 3");

Assert.IsFalse(App.Query(q => radio1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.IsFalse(App.Query(q => radio2(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.IsTrue(App.Query(q => radio3(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
Assert.AreEqual("Radio 03", App.Query(q => results(q).GetDependencyPropertyValue("Text").Value<string>()).First());
ClassicAssert.IsFalse(App.Query(q => radio1(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.IsFalse(App.Query(q => radio2(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.IsTrue(App.Query(q => radio3(q).GetDependencyPropertyValue("IsChecked").Value<bool>()).First());
ClassicAssert.AreEqual("Radio 03", App.Query(q => results(q).GetDependencyPropertyValue("Text").Value<string>()).First());
}
}
}
6 changes: 3 additions & 3 deletions src/Sample/Sample.UITests/Sample.UITests.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net47</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" Version="3.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
</ItemGroup>

Expand Down
9 changes: 5 additions & 4 deletions src/Sample/Sample.UITests/SetPropertyValue_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using NUnit.Framework.Legacy;
using Uno.UITest.Helpers.Queries;
using Query = System.Func<Uno.UITest.IAppQuery, Uno.UITest.IAppQuery>;

Expand All @@ -24,16 +25,16 @@ public void SetValue01()
App.WaitForElement(tb2);

var tb1Value = App.Query(q => tb1(q).GetDependencyPropertyValue("Text").Value<string>()).First();
Assert.AreEqual("None", tb1Value);
ClassicAssert.AreEqual("None", tb1Value);

var tb2Value = App.Query(q => tb2(q).GetDependencyPropertyValue("Text").Value<string>()).First();
Assert.AreEqual("None", tb2Value);
ClassicAssert.AreEqual("None", tb2Value);

var assignedValue = App.Query(q => tb1(q).SetDependencyPropertyValue("Text", "test value").Value<string>()).First();
tb2Value = App.Query(q => tb2(q).GetDependencyPropertyValue("Text").Value<string>()).First();

Assert.AreEqual("test value", assignedValue);
Assert.AreEqual("test value", tb2Value);
ClassicAssert.AreEqual("test value", assignedValue);
ClassicAssert.AreEqual("test value", tb2Value);
}
}
}
2 changes: 1 addition & 1 deletion src/Sample/Sample.UWP/Sample.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<AssemblyName>Sample</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.22621.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
Expand Down
4 changes: 2 additions & 2 deletions src/Uno.UITest.Helpers/Uno.UITest.Helpers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" Version="3.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UITest.Xamarin/Uno.UITest.Xamarin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Xamarin.UITest" Version="4.1.2" />
<PackageReference Include="Xamarin.UITest" Version="4.3.4" />

<!-- Workaround for missing cecil binary in Xamarin.UITest -->
<PackageReference Include="mono.cecil" Version="0.11.4" />
Expand Down

0 comments on commit b9896ef

Please sign in to comment.