Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ability to control visibility of teh secondary app (only th… #166

Merged
merged 1 commit into from
Jan 16, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ public static void AutoStartTests()
if (Environment.GetEnvironmentVariable("UNO_RUNTIME_TESTS_RUN_TESTS") is { } testsConfig
&& Environment.GetEnvironmentVariable("UNO_RUNTIME_TESTS_OUTPUT_PATH") is { } outputPath)
{
if (bool.TryParse(testsConfig, out var runTests))
{
if (runTests)
{
testsConfig = string.Empty; // Do not treat "true" as a filter.
}
else
{
Trace("Application has been configured to **NOT** start runtime-test, aborting runtime-test embedded runner.");
return;
}
}

Trace($"Application configured to start runtime-tests (Output={outputPath} | Config={testsConfig}).");

var outputKind = Enum.TryParse<TestResultKind>(Environment.GetEnvironmentVariable("UNO_RUNTIME_TESTS_OUTPUT_KIND"), ignoreCase: true, out var kind)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ internal static partial class SecondaryApp
childStartInfo.EnvironmentVariables["UNO_RUNTIME_TESTS_RUN_TESTS"] = configJson;
childStartInfo.EnvironmentVariables["UNO_RUNTIME_TESTS_OUTPUT_PATH"] = testOutput;
childStartInfo.EnvironmentVariables["UNO_RUNTIME_TESTS_OUTPUT_KIND"] = "UnoRuntimeTests"; // "NUnit"
childStartInfo.EnvironmentVariables["UNO_RUNTIME_TESTS_IS_SECONDARY_APP"] = "true"; // "NUnit"
childStartInfo.EnvironmentVariables["UNO_RUNTIME_TESTS_IS_SECONDARY_APP"] = "true";

var childProcess = new global::System.Diagnostics.Process { StartInfo = childStartInfo };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
Text = $"{testClass.Name} ({testClass.Assembly.GetName().Name})",
Foreground = new SolidColorBrush(Colors.White),
FontSize = 16d,
IsTextSelectionEnabled = true

Check warning on line 326 in src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/UnitTestsControl.cs

View workflow job for this annotation

GitHub Actions / build

Microsoft.UI.Xaml.Controls.TextBlock.IsTextSelectionEnabled is not implemented in Uno (https://aka.platform.uno/notimplemented?m=Microsoft.UI.Xaml.Controls.TextBlock.IsTextSelectionEnabled) (https://aka.platform.uno/notimplemented)

Check warning on line 326 in src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/UnitTestsControl.cs

View workflow job for this annotation

GitHub Actions / build

Microsoft.UI.Xaml.Controls.TextBlock.IsTextSelectionEnabled is not implemented in Uno (https://aka.platform.uno/notimplemented?m=Microsoft.UI.Xaml.Controls.TextBlock.IsTextSelectionEnabled) (https://aka.platform.uno/notimplemented)
};

testResults.Children.Add(testResultBlock);
Expand Down Expand Up @@ -378,7 +378,7 @@
FontFamily = new FontFamily("Courier New"),
Margin = new Thickness(8, 0, 0, 0),
Foreground = new SolidColorBrush(Colors.LightGray),
IsTextSelectionEnabled = true

Check warning on line 381 in src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/UnitTestsControl.cs

View workflow job for this annotation

GitHub Actions / build

Microsoft.UI.Xaml.Controls.TextBlock.IsTextSelectionEnabled is not implemented in Uno (https://aka.platform.uno/notimplemented?m=Microsoft.UI.Xaml.Controls.TextBlock.IsTextSelectionEnabled) (https://aka.platform.uno/notimplemented)

Check warning on line 381 in src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/UnitTestsControl.cs

View workflow job for this annotation

GitHub Actions / build

Microsoft.UI.Xaml.Controls.TextBlock.IsTextSelectionEnabled is not implemented in Uno (https://aka.platform.uno/notimplemented?m=Microsoft.UI.Xaml.Controls.TextBlock.IsTextSelectionEnabled) (https://aka.platform.uno/notimplemented)
};

var retriesText = _currentRun.CurrentRepeatCount != 0 ? $" (Retried {_currentRun.CurrentRepeatCount} time(s))" : "";
Expand Down Expand Up @@ -527,6 +527,7 @@
{
consoleOutput.IsChecked = config.IsConsoleOutputEnabled;
runIgnored.IsChecked = config.IsRunningIgnored;
showSecondaryApp.IsChecked = config.IsSecondaryAppVisible;
retry.IsChecked = config.Attempts > 1;
testFilter.Text = config.Filter;
}
Expand All @@ -548,6 +549,8 @@
runIgnored.Unchecked += (snd, e) => StoreConfig();
retry.Checked += (snd, e) => StoreConfig();
retry.Unchecked += (snd, e) => StoreConfig();
showSecondaryApp.Checked += (snd, e) => StoreConfig();
showSecondaryApp.Unchecked += (snd, e) => StoreConfig();
testFilter.TextChanged += (snd, e) => StoreConfig();

void StoreConfig()
Expand All @@ -561,6 +564,7 @@
{
var isConsoleOutput = consoleOutput.IsChecked ?? false;
var isRunningIgnored = runIgnored.IsChecked ?? false;
var isSecondaryAppVisible = showSecondaryApp.IsChecked;
var attempts = (retry.IsChecked ?? true) ? UnitTestEngineConfig.DefaultRepeatCount : 1;
var filter = testFilter.Text.Trim();
if (string.IsNullOrEmpty(filter))
Expand All @@ -573,6 +577,7 @@
Filter = filter,
IsConsoleOutputEnabled = isConsoleOutput,
IsRunningIgnored = isRunningIgnored,
IsSecondaryAppVisible = isSecondaryAppVisible,
Attempts = attempts,
};
}
Expand Down Expand Up @@ -749,7 +754,7 @@

config = config with { Filter = $"{testClassInfo.Type.FullName} & ({config.Filter})" };

var results = await SecondaryApp.RunTest(config, ct, isAppVisible: Debugger.IsAttached);
var results = await SecondaryApp.RunTest(config, ct, isAppVisible: config.IsSecondaryAppVisible ?? Debugger.IsAttached);
foreach (var result in results)
{
ReportTestResult(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
IsChecked="True"
not_skia:Content="➰ Auto retry"
skia:Content="Auto retry" />
<ToggleButton
x:Name="showSecondaryApp"
IsThreeState="True"
not_skia:Content="🪟 Show 2nd app"
skia:Content="Show 2nd app" />
</StackPanel>
</Flyout>
</Button.Flyout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public record UnitTestEngineConfig
public bool IsConsoleOutputEnabled { get; init; }

public bool IsRunningIgnored { get; init; }

public bool? IsSecondaryAppVisible { get; init; }
}

#endif
Loading