-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
AppleTemplateTests.cs
54 lines (43 loc) · 1.91 KB
/
AppleTemplateTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using Microsoft.Maui.IntegrationTests.Apple;
namespace Microsoft.Maui.IntegrationTests
{
public class AppleTemplateTests : BaseBuildTest
{
Simulator TestSimulator = new Simulator();
[SetUp]
public void AppleTemplateSetup()
{
if (!TestEnvironment.IsMacOS)
Assert.Ignore("Running Apple templates is only supported on macOS.");
TestSimulator.Shutdown();
Assert.IsTrue(TestSimulator.Launch(), $"Failed to boot simulator with UDID '{TestSimulator.GetUDID()}'.");
TestSimulator.ShowWindow();
}
[OneTimeTearDown]
public void AppleTemplateFxtTearDown()
{
TestSimulator.Shutdown();
}
[Test]
[TestCase("maui", "Debug", DotNetPrevious)]
[TestCase("maui", "Release", DotNetPrevious)]
[TestCase("maui", "Debug", DotNetCurrent)]
[TestCase("maui", "Release", DotNetCurrent)]
[TestCase("maui-blazor", "Debug", DotNetPrevious)]
[TestCase("maui-blazor", "Release", DotNetPrevious)]
[TestCase("maui-blazor", "Debug", DotNetCurrent)]
[TestCase("maui-blazor", "Release", DotNetCurrent)]
public void RunOniOS(string id, string config, string framework)
{
var projectDir = TestDirectory;
var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj");
Assert.IsTrue(DotnetInternal.New(id, projectDir, framework),
$"Unable to create template {id}. Check test output for errors.");
Assert.IsTrue(DotnetInternal.Build(projectFile, config, framework: $"{framework}-ios", properties: BuildProps),
$"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
var appFile = Path.Combine(projectDir, "bin", config, $"{framework}-ios", "iossimulator-x64", $"{Path.GetFileName(projectDir)}.app");
Assert.IsTrue(XHarness.RunAppleForTimeout(appFile, Path.Combine(projectDir, "xh-results"), TestSimulator.XHarnessID),
$"Project {Path.GetFileName(projectFile)} failed to run. Check test output/attachments for errors.");
}
}
}