Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Fix test
  • Loading branch information
JamesNK committed Jul 10, 2024
commit 3167ff36968ad8bcda79f60a43528e7c01b7daff
2 changes: 1 addition & 1 deletion tests/Aspire.Workload.Tests/StarterTemplateRunTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public StarterTemplateRunTestsBase(T fixture, ITestOutputHelper testOutput)

[Fact]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4623", typeof(PlaywrightProvider), nameof(PlaywrightProvider.DoesNotHavePlaywrightSupport))]
public async Task ResourcesShowUpOnDashboad()
public async Task ResourcesShowUpOnDashboard()
{
await using var context = await CreateNewBrowserContextAsync();
await CheckDashboardHasResourcesAsync(
Expand Down
20 changes: 9 additions & 11 deletions tests/Aspire.Workload.Tests/WorkloadTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,23 @@ protected static async Task<ResourceRow[]> CheckDashboardHasResourcesAsync(IPage
int matchingEndpoints = 0;
var expectedEndpoints = expectedRow.Endpoints;

string[] endpointsFound =
var endpointsFound =
(await rowLoc.Locator("//div[@class='fluent-overflow-item']").AllAsync())
.Select(async e => await e.InnerTextAsync())
.Select(t => t.Result.Trim(','))
.ToArray();
// FIXME: this could still return "+2"
if (endpointsFound.Length == 0)
{
var cellText = await cellLocs[5].InnerTextAsync();
endpointsFound = cellText.Trim().Split(',', StringSplitOptions.RemoveEmptyEntries);
}
if (expectedEndpoints.Length != endpointsFound.Length)
.ToList();

var firstEndpoint = await rowLoc.Locator("//div[@class='endpoint-first']").InnerTextAsync();
endpointsFound.Insert(0, firstEndpoint.Trim().Trim(','));

if (expectedEndpoints.Length != endpointsFound.Count)
{
// _testOutput.WriteLine($"For resource '{resourceName}, found ")
// _testOutput.WriteLine($"-- expected: {expectedEndpoints.Length} found: {endpointsFound.Length}, expected: {string.Join(',', expectedEndpoints)} found: {string.Join(',', endpointsFound)} for {resourceName}");
continue;
}

AssertEqual(expectedEndpoints.Length, endpointsFound.Length, $"#endpoints for {resourceName}");
AssertEqual(expectedEndpoints.Length, endpointsFound.Count, $"#endpoints for {resourceName}");

// endpointsFound: ["foo", "https://localhost:7589/weatherforecast"]
foreach (var endpointFound in endpointsFound)
Expand All @@ -142,7 +140,7 @@ protected static async Task<ResourceRow[]> CheckDashboardHasResourcesAsync(IPage
// Check 'Source' column
AssertEqual(expectedRow.Source, await cellLocs[4].InnerTextAsync(), $"Source for {resourceName}");

foundRows.Add(expectedRow with { Endpoints = endpointsFound });
foundRows.Add(expectedRow with { Endpoints = endpointsFound.ToArray() });
foundNames.Add(resourceName);
}
}
Expand Down
4 changes: 4 additions & 0 deletions tests/Shared/WorkloadTesting/BuildEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ static void CleanupTestRootPath()
}
}
}
catch (Exception ex)
{
throw new InvalidOperationException($"Error deleting '{TestRootPath}'.", ex);
}
}
}

Expand Down