✔ @assembly.Passed
@@ -93,14 +94,14 @@
}
}
- private string GetStatusColor(TestResultStatus status)
+ private string GetStatusCssClass(TestResultStatus status)
{
return status switch
{
- TestResultStatus.Passed => "#28a745",
- TestResultStatus.Failed => "#dc3545",
- TestResultStatus.Skipped => "#ffc107",
- _ => "#6c757d"
+ TestResultStatus.Passed => "test-result-status-passed",
+ TestResultStatus.Failed => "test-result-status-failed",
+ TestResultStatus.Skipped => "test-result-status-skipped",
+ _ => "test-result-status-notrun"
};
}
}
\ No newline at end of file
diff --git a/src/DeviceRunners.VisualRunners.Blazor/Components/Pages/TestAssembly.razor b/src/DeviceRunners.VisualRunners.Blazor/Components/Pages/TestAssembly.razor
index 0e3dbe4b..bfaf484e 100644
--- a/src/DeviceRunners.VisualRunners.Blazor/Components/Pages/TestAssembly.razor
+++ b/src/DeviceRunners.VisualRunners.Blazor/Components/Pages/TestAssembly.razor
@@ -1,6 +1,8 @@
-@page "/assembly/{id:int}"
+@page "/assembly/{assemblyName}"
@using DeviceRunners.VisualRunners
+@using System.IO
@inject NavigationManager Navigation
+@inject HomeViewModel HomeViewModel
@(ViewModel?.DisplayName ?? "Test Assembly")
@@ -39,16 +41,18 @@
@if (ViewModel?.TestCases != null && ViewModel.TestCases.Any())
{
@code {
- [Parameter] public int Id { get; set; }
+ [Parameter] public string AssemblyName { get; set; } = "";
private TestAssemblyViewModel? ViewModel { get; set; }
private string SearchQuery { get; set; } = "";
@@ -110,9 +114,9 @@
protected override void OnParametersSet()
{
- // In a real implementation, you would look up the TestAssemblyViewModel by ID
- // For now, this is just a placeholder structure
- // ViewModel = GetTestAssemblyById(Id);
+ // Look up the TestAssemblyViewModel by assembly name
+ ViewModel = HomeViewModel.TestAssemblies.FirstOrDefault(a =>
+ Uri.EscapeDataString(Path.GetFileNameWithoutExtension(a.TestAssemblyInfo.AssemblyFileName)) == AssemblyName);
}
private async Task RunFilteredTests()
@@ -131,14 +135,14 @@
}
}
- private string GetStatusColor(TestResultStatus status)
+ private string GetStatusCssClass(TestResultStatus status)
{
return status switch
{
- TestResultStatus.Passed => "#28a745",
- TestResultStatus.Failed => "#dc3545",
- TestResultStatus.Skipped => "#ffc107",
- _ => "#6c757d"
+ TestResultStatus.Passed => "test-result-status-passed",
+ TestResultStatus.Failed => "test-result-status-failed",
+ TestResultStatus.Skipped => "test-result-status-skipped",
+ _ => "test-result-status-notrun"
};
}
}
\ No newline at end of file
diff --git a/src/DeviceRunners.VisualRunners.Blazor/Components/Pages/TestResult.razor b/src/DeviceRunners.VisualRunners.Blazor/Components/Pages/TestResult.razor
index 5ccf6edb..4652ee9f 100644
--- a/src/DeviceRunners.VisualRunners.Blazor/Components/Pages/TestResult.razor
+++ b/src/DeviceRunners.VisualRunners.Blazor/Components/Pages/TestResult.razor
@@ -1,6 +1,8 @@
-@page "/result/{id:int}"
+@page "/result/{assemblyName}/{testIndex:int}"
@using DeviceRunners.VisualRunners
+@using System.IO
@inject NavigationManager Navigation
+@inject HomeViewModel HomeViewModel
Test Result
@@ -10,7 +12,7 @@
@@ -23,7 +25,7 @@
@code {
- [Parameter] public int Id { get; set; }
+ [Parameter] public string AssemblyName { get; set; } = "";
+ [Parameter] public int TestIndex { get; set; }
private TestResultViewModel? ViewModel { get; set; }
- private int AssemblyId { get; set; }
protected override void OnParametersSet()
{
- // In a real implementation, you would look up the TestResultViewModel by ID
- // For now, this is just a placeholder structure
- // ViewModel = GetTestResultById(Id);
- // AssemblyId = GetAssemblyIdForResult(Id);
+ // Look up the TestAssemblyViewModel by assembly name
+ var assemblyViewModel = HomeViewModel.TestAssemblies.FirstOrDefault(a =>
+ Uri.EscapeDataString(Path.GetFileNameWithoutExtension(a.TestAssemblyInfo.AssemblyFileName)) == AssemblyName);
+
+ if (assemblyViewModel != null && TestIndex >= 0 && TestIndex < assemblyViewModel.TestCases.Count())
+ {
+ var testCase = assemblyViewModel.TestCases.ElementAt(TestIndex);
+ ViewModel = testCase.TestResult;
+ }
}
- private string GetStatusColor(TestResultStatus status)
+ private string GetStatusCssClass(TestResultStatus status)
{
return status switch
{
- TestResultStatus.Passed => "#28a745",
- TestResultStatus.Failed => "#dc3545",
- TestResultStatus.Skipped => "#ffc107",
- _ => "#6c757d"
+ TestResultStatus.Passed => "test-result-status-passed",
+ TestResultStatus.Failed => "test-result-status-failed",
+ TestResultStatus.Skipped => "test-result-status-skipped",
+ _ => "test-result-status-notrun"
};
}
diff --git a/src/DeviceRunners.VisualRunners.Blazor/Components/App/Routes.razor b/src/DeviceRunners.VisualRunners.Blazor/Components/Routes.razor
similarity index 100%
rename from src/DeviceRunners.VisualRunners.Blazor/Components/App/Routes.razor
rename to src/DeviceRunners.VisualRunners.Blazor/Components/Routes.razor
diff --git a/src/DeviceRunners.VisualRunners.Blazor/WebAssemblyAppBuilderExtensions.cs b/src/DeviceRunners.VisualRunners.Blazor/WebAssemblyAppBuilderExtensions.cs
index c51335f0..c02cce7d 100644
--- a/src/DeviceRunners.VisualRunners.Blazor/WebAssemblyAppBuilderExtensions.cs
+++ b/src/DeviceRunners.VisualRunners.Blazor/WebAssemblyAppBuilderExtensions.cs
@@ -1,4 +1,5 @@
using DeviceRunners.Core;
+using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection;
@@ -15,6 +16,10 @@ public static WebAssemblyHostBuilder UseVisualTestRunner(this WebAssemblyHostBui
configurationBuilder?.Invoke(configBuilder);
var configuration = configBuilder.Build();
+ // register root components automatically
+ appBuilder.RootComponents.Add
("#app");
+ appBuilder.RootComponents.Add("head::after");
+
// register runner components
appBuilder.Services.AddSingleton(configuration);
appBuilder.Services.AddSingleton();
diff --git a/src/DeviceRunners.VisualRunners.Blazor/wwwroot/css/app.css b/src/DeviceRunners.VisualRunners.Blazor/wwwroot/css/app.css
index a75754d2..1df90889 100644
--- a/src/DeviceRunners.VisualRunners.Blazor/wwwroot/css/app.css
+++ b/src/DeviceRunners.VisualRunners.Blazor/wwwroot/css/app.css
@@ -124,6 +124,23 @@ main {
flex: 1;
}
+/* Test result status colors */
+.test-result-status-passed {
+ color: #28a745;
+}
+
+.test-result-status-failed {
+ color: #dc3545;
+}
+
+.test-result-status-skipped {
+ color: #ffc107;
+}
+
+.test-result-status-notrun {
+ color: #6c757d;
+}
+
#blazor-error-ui {
background: lightyellow;
bottom: 0;
diff --git a/src/DeviceRunners.VisualRunners.Maui/VisualTestRunnerUsage.cs b/src/DeviceRunners.VisualRunners.Maui/VisualTestRunnerUsage.cs
deleted file mode 100644
index 1a02472d..00000000
--- a/src/DeviceRunners.VisualRunners.Maui/VisualTestRunnerUsage.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace DeviceRunners.VisualRunners;
-
-public enum VisualTestRunnerUsage
-{
- Automatic,
- Always,
- Never
-}
diff --git a/src/DeviceRunners.VisualRunners.Blazor/VisualTestRunnerUsage.cs b/src/DeviceRunners.VisualRunners/VisualTestRunnerUsage.cs
similarity index 100%
rename from src/DeviceRunners.VisualRunners.Blazor/VisualTestRunnerUsage.cs
rename to src/DeviceRunners.VisualRunners/VisualTestRunnerUsage.cs
From cd6369c0596f32371faf7c972402f46c047ee7a4 Mon Sep 17 00:00:00 2001
From: Matthew Leibowitz
Date: Fri, 20 Jun 2025 01:47:01 +0200
Subject: [PATCH 5/8] Copied the contents from the .NET 10 templates
---
.../DeviceTestingKitApp.WasmTests.csproj | 8 -
.../DeviceTestingKitApp.WasmTests/Program.cs | 33 ++--
.../Properties/launchSettings.json | 25 +++
.../wwwroot/css/app.css | 64 ------
.../wwwroot/css/bootstrap/bootstrap.min.css | 57 ------
.../wwwroot/index.html | 18 +-
.../wwwroot/manifest.webmanifest | 21 --
.../wwwroot/service-worker.js | 4 -
.../App.razor | 12 ++
.../Components/App.razor | 47 -----
.../Components/Layout/MainLayout.razor | 17 +-
.../Components/Layout/MainLayout.razor.css | 77 ++++++++
.../Components/Layout/NavMenu.razor | 28 ++-
.../Components/Layout/NavMenu.razor.css | 83 ++++++++
.../Components/Routes.razor | 6 -
.../WebAssemblyAppBuilderExtensions.cs | 3 +-
.../_Imports.razor | 1 +
.../wwwroot/css/app.css | 184 ++++++++----------
.../wwwroot/css/bootstrap/bootstrap.min.css | 6 +
.../css/bootstrap/bootstrap.min.css.map | 1 +
.../wwwroot/wwwroot/favicon.png | Bin 0 -> 1148 bytes
21 files changed, 331 insertions(+), 364 deletions(-)
create mode 100644 sample/test/DeviceTestingKitApp.WasmTests/Properties/launchSettings.json
delete mode 100644 sample/test/DeviceTestingKitApp.WasmTests/wwwroot/css/app.css
delete mode 100644 sample/test/DeviceTestingKitApp.WasmTests/wwwroot/css/bootstrap/bootstrap.min.css
delete mode 100644 sample/test/DeviceTestingKitApp.WasmTests/wwwroot/manifest.webmanifest
delete mode 100644 sample/test/DeviceTestingKitApp.WasmTests/wwwroot/service-worker.js
create mode 100644 src/DeviceRunners.VisualRunners.Blazor/App.razor
delete mode 100644 src/DeviceRunners.VisualRunners.Blazor/Components/App.razor
create mode 100644 src/DeviceRunners.VisualRunners.Blazor/Components/Layout/MainLayout.razor.css
create mode 100644 src/DeviceRunners.VisualRunners.Blazor/Components/Layout/NavMenu.razor.css
delete mode 100644 src/DeviceRunners.VisualRunners.Blazor/Components/Routes.razor
create mode 100644 src/DeviceRunners.VisualRunners.Blazor/wwwroot/css/bootstrap/bootstrap.min.css
create mode 100644 src/DeviceRunners.VisualRunners.Blazor/wwwroot/css/bootstrap/bootstrap.min.css.map
create mode 100644 src/DeviceRunners.VisualRunners.Blazor/wwwroot/wwwroot/favicon.png
diff --git a/sample/test/DeviceTestingKitApp.WasmTests/DeviceTestingKitApp.WasmTests.csproj b/sample/test/DeviceTestingKitApp.WasmTests/DeviceTestingKitApp.WasmTests.csproj
index 039d2bf1..578655bd 100644
--- a/sample/test/DeviceTestingKitApp.WasmTests/DeviceTestingKitApp.WasmTests.csproj
+++ b/sample/test/DeviceTestingKitApp.WasmTests/DeviceTestingKitApp.WasmTests.csproj
@@ -5,10 +5,6 @@
enable
enable
$(DefineConstants);INCLUDE_FAILING_TESTS
- service-worker-assets.js
-
-
- DeviceTestingKitApp.WasmTests
@@ -24,8 +20,4 @@
-
-
-
-
\ No newline at end of file
diff --git a/sample/test/DeviceTestingKitApp.WasmTests/Program.cs b/sample/test/DeviceTestingKitApp.WasmTests/Program.cs
index 89823db6..e1f92575 100644
--- a/sample/test/DeviceTestingKitApp.WasmTests/Program.cs
+++ b/sample/test/DeviceTestingKitApp.WasmTests/Program.cs
@@ -1,29 +1,20 @@
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
-
using DeviceRunners.VisualRunners;
-namespace DeviceTestingKitApp.WasmTests;
-
-public class Program
-{
- public static async Task Main(string[] args)
- {
- Console.WriteLine("Creating the WASM test runner application:");
- Console.WriteLine(" - Blazor WASM visual test runner");
+Console.WriteLine("Creating the WASM test runner application:");
+Console.WriteLine(" - Blazor WASM visual test runner");
- var builder = WebAssemblyHostBuilder.CreateDefault(args);
+var builder = WebAssemblyHostBuilder.CreateDefault(args);
- // Add HttpClient for dependency injection
- builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
+// Add HttpClient for dependency injection
+builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
- // Configure the test runner
- builder.UseVisualTestRunner(conf => conf
- .AddConsoleResultChannel()
- .AddTestAssembly(typeof(Program).Assembly)
- .AddTestAssemblies(typeof(DeviceTestingKitApp.BlazorLibrary.XunitTests.BlazorUnitTests).Assembly)
- .AddXunit());
+// Configure the test runner
+builder.UseVisualTestRunner(conf => conf
+ .AddConsoleResultChannel()
+ .AddTestAssembly(typeof(Program).Assembly)
+ .AddTestAssemblies(typeof(DeviceTestingKitApp.BlazorLibrary.XunitTests.BlazorUnitTests).Assembly)
+ .AddXunit());
- await builder.Build().RunAsync();
- }
-}
\ No newline at end of file
+await builder.Build().RunAsync();
diff --git a/sample/test/DeviceTestingKitApp.WasmTests/Properties/launchSettings.json b/sample/test/DeviceTestingKitApp.WasmTests/Properties/launchSettings.json
new file mode 100644
index 00000000..2aeec784
--- /dev/null
+++ b/sample/test/DeviceTestingKitApp.WasmTests/Properties/launchSettings.json
@@ -0,0 +1,25 @@
+{
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "profiles": {
+ "http": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
+ "applicationUrl": "http://localhost:5296",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "https": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
+ "applicationUrl": "https://localhost:7064;http://localhost:5296",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/sample/test/DeviceTestingKitApp.WasmTests/wwwroot/css/app.css b/sample/test/DeviceTestingKitApp.WasmTests/wwwroot/css/app.css
deleted file mode 100644
index 9bbb34e0..00000000
--- a/sample/test/DeviceTestingKitApp.WasmTests/wwwroot/css/app.css
+++ /dev/null
@@ -1,64 +0,0 @@
-html, body {
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
- margin: 0;
- padding: 0;
-}
-
-#app {
- position: relative;
- display: flex;
- flex-direction: column;
- min-height: 100vh;
-}
-
-.loading-progress {
- position: relative;
- display: block;
- width: 8rem;
- height: 8rem;
- margin: 20vh auto 1rem auto;
-}
-
-.loading-progress circle {
- fill: none;
- stroke: #e0e0e0;
- stroke-width: 0.6rem;
- transform-origin: 50% 50%;
- transform: rotate(-90deg);
-}
-
-.loading-progress circle:last-child {
- stroke: #1b6ec2;
- stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
- transition: stroke-dasharray 0.05s ease-in-out;
-}
-
-.loading-progress-text {
- position: absolute;
- text-align: center;
- font-weight: bold;
- inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
-}
-
-.loading-progress-text:after {
- content: var(--blazor-load-percentage-text, "Loading");
-}
-
-#blazor-error-ui {
- background: lightyellow;
- bottom: 0;
- box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
- display: none;
- left: 0;
- padding: 0.6rem 1.25rem 0.7rem 1.25rem;
- position: fixed;
- width: 100%;
- z-index: 1000;
-}
-
-#blazor-error-ui .dismiss {
- cursor: pointer;
- position: absolute;
- right: 0.75rem;
- top: 0.5rem;
-}
\ No newline at end of file
diff --git a/sample/test/DeviceTestingKitApp.WasmTests/wwwroot/css/bootstrap/bootstrap.min.css b/sample/test/DeviceTestingKitApp.WasmTests/wwwroot/css/bootstrap/bootstrap.min.css
deleted file mode 100644
index e4729b31..00000000
--- a/sample/test/DeviceTestingKitApp.WasmTests/wwwroot/css/bootstrap/bootstrap.min.css
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Bootstrap placeholders */
-.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }
-.row { display: flex; flex-wrap: wrap; margin: 0 -15px; }
-.col, .col-auto { flex: 1; padding: 0 15px; }
-.col-auto { flex: 0 0 auto; }
-.mb-3 { margin-bottom: 1rem; }
-.mt-4 { margin-top: 1.5rem; }
-.me-2 { margin-right: 0.5rem; }
-.p-3 { padding: 1rem; }
-.px-4 { padding-left: 1.5rem; padding-right: 1.5rem; }
-.gap-3 { gap: 1rem; }
-.d-flex { display: flex; }
-.justify-content-between { justify-content: space-between; }
-.justify-content-center { justify-content: center; }
-.align-items-center { align-items: center; }
-.text-center { text-align: center; }
-.text-success { color: #28a745; }
-.text-danger { color: #dc3545; }
-.text-warning { color: #ffc107; }
-.text-muted { color: #6c757d; }
-.btn { padding: 0.375rem 0.75rem; margin: 0.125rem; border: 1px solid transparent; border-radius: 0.25rem; text-decoration: none; display: inline-block; }
-.btn-success { background-color: #28a745; border-color: #28a745; color: #fff; }
-.btn-outline-primary { border-color: #007bff; color: #007bff; }
-.btn:hover { opacity: 0.8; }
-.form-control, .form-select { width: 100%; padding: 0.375rem 0.75rem; border: 1px solid #ced4da; border-radius: 0.25rem; }
-.alert { padding: 0.75rem 1.25rem; margin-bottom: 1rem; border: 1px solid transparent; border-radius: 0.25rem; }
-.alert-info { color: #0c5460; background-color: #d1ecf1; border-color: #bee5eb; }
-.alert-warning { color: #856404; background-color: #fff3cd; border-color: #ffeaa7; }
-.alert-danger { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }
-.alert-secondary { color: #383d41; background-color: #e2e3e5; border-color: #d6d8db; }
-.list-group { display: flex; flex-direction: column; padding-left: 0; margin-bottom: 0; }
-.list-group-item { position: relative; display: block; padding: 0.75rem 1.25rem; background-color: #fff; border: 1px solid rgba(0,0,0,.125); }
-.list-group-item-action { color: #495057; text-decoration: none; }
-.list-group-item-action:hover { background-color: #f8f9fa; }
-.card { position: relative; display: flex; flex-direction: column; min-width: 0; background-color: #fff; border: 1px solid rgba(0,0,0,.125); border-radius: 0.25rem; }
-.card-header { padding: 0.75rem 1.25rem; margin-bottom: 0; background-color: rgba(0,0,0,.03); border-bottom: 1px solid rgba(0,0,0,.125); }
-.card-body { flex: 1 1 auto; padding: 1.25rem; }
-.badge { display: inline-block; padding: 0.25em 0.4em; font-size: 0.875em; font-weight: 700; line-height: 1; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: 0.25rem; }
-.bg-success { background-color: #28a745; color: #fff; }
-.bg-danger { background-color: #dc3545; color: #fff; }
-.bg-warning { background-color: #ffc107; color: #212529; }
-.bg-secondary { background-color: #6c757d; color: #fff; }
-.border { border: 1px solid #dee2e6; }
-.spinner-border { display: inline-block; width: 2rem; height: 2rem; vertical-align: text-bottom; border: 0.25em solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spinner-border .75s linear infinite; }
-@keyframes spinner-border { to { transform: rotate(360deg); } }
-.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
-.position-fixed { position: fixed; }
-.top-0 { top: 0; }
-.start-0 { left: 0; }
-.w-100 { width: 100%; }
-.h-100 { height: 100%; }
-pre { margin-bottom: 1rem; overflow: auto; }
-.breadcrumb { display: flex; flex-wrap: wrap; padding: 0.75rem 1rem; margin-bottom: 1rem; list-style: none; background-color: #e9ecef; border-radius: 0.25rem; }
-.breadcrumb-item + .breadcrumb-item::before { float: left; padding-right: 0.5rem; color: #868e96; content: "/"; }
-.breadcrumb-item a { text-decoration: none; }
-h1, h2, h3, h4, h5, h6 { margin-top: 0; margin-bottom: 0.5rem; font-weight: 500; line-height: 1.2; }
-.mb-1 { margin-bottom: 0.25rem; }
\ No newline at end of file
diff --git a/sample/test/DeviceTestingKitApp.WasmTests/wwwroot/index.html b/sample/test/DeviceTestingKitApp.WasmTests/wwwroot/index.html
index db88ab89..3f870498 100644
--- a/sample/test/DeviceTestingKitApp.WasmTests/wwwroot/index.html
+++ b/sample/test/DeviceTestingKitApp.WasmTests/wwwroot/index.html
@@ -6,12 +6,12 @@
DeviceRunners WASM Test Runner
-
-
-
-
-
-
+
+
+
+
+
+
@@ -25,11 +25,11 @@
+
-