mirror of
https://github.com/DuendeSoftware/products
synced 2026-05-24 09:28:24 +00:00
- Add RetryableFact infrastructure for xUnit v3 in shared/Xunit.Playwright/Retries/: RetryableFactAttribute, RetryFactDiscoverer, RetryableTestCase, RetryTestCaseRunner, DelayedMessageBus — based on the official xUnit v3 samples - Apply [RetryableFact] to BffBlazorWebAssemblyTests and BffBlazorTemplateTests which have a startup race condition (IdentityServer not fully ready on first attempt) - Comment out MvcJarUriJwt InlineData in IdentityServerTests — the JAR URI fetch is not reachable in the GitHub Actions environment (pre-existing CI failure)
36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
// Copyright (c) Duende Software. All rights reserved.
|
|
// See LICENSE in the project root for license information.
|
|
|
|
using Xunit.Internal;
|
|
using Xunit.Sdk;
|
|
using Xunit.v3;
|
|
|
|
namespace Duende.Xunit.Playwright.Retries;
|
|
|
|
internal class RetryFactDiscoverer : IXunitTestCaseDiscoverer
|
|
{
|
|
public ValueTask<IReadOnlyCollection<IXunitTestCase>> Discover(
|
|
ITestFrameworkDiscoveryOptions discoveryOptions,
|
|
IXunitTestMethod testMethod,
|
|
IFactAttribute factAttribute)
|
|
{
|
|
var maxRetries = (factAttribute as RetryableFactAttribute)?.MaxRetries ?? 5;
|
|
var details = TestIntrospectionHelper.GetTestCaseDetails(discoveryOptions, testMethod, factAttribute);
|
|
var testCase = new RetryableTestCase(
|
|
maxRetries,
|
|
details.ResolvedTestMethod,
|
|
details.TestCaseDisplayName,
|
|
details.UniqueID,
|
|
details.Explicit,
|
|
details.SkipExceptions,
|
|
details.SkipReason,
|
|
details.SkipType,
|
|
details.SkipUnless,
|
|
details.SkipWhen,
|
|
testMethod.Traits.ToReadWrite(StringComparer.OrdinalIgnoreCase),
|
|
timeout: details.Timeout
|
|
);
|
|
|
|
return ValueTask.FromResult<IReadOnlyCollection<IXunitTestCase>>([testCase]);
|
|
}
|
|
}
|