Repository navigation
feat: bootstrap AndreGoepel.Testing.E2E - #3
Merged
Merged
Conversation
…enticator helpers Extracts the genuinely shared Playwright + Aspire E2E infrastructure from marten-identity, finance-app, and app-foundation's near-identical local copies. E2EAppFixture takes a Func<string[], Task<IDistributedApplicationTestingBuilder>> instead of a generic type parameter, so E2ETestBase<TFixture> can stay constrained to one non-generic base regardless of which Projects.* type each host's AppHost generates. MailHog endpoint name defaults to the canonical "http"; the admin-provisioning button text has no default since its wording differs per app. Also fixes a real bug in the copied .gitignore: the standard "Visual Studio Trace Files" rule (*.e2e) case-insensitively matched this repo's own src/AndreGoepel.Testing.E2E/ directory and silently excluded it from tracking.
rollForward: disable required an exact 10.0.301 match, which the GitHub- hosted runner didn't have (it only had 10.0.302 preinstalled), failing CI's restore step before anything else could run. latestPatch still pins the SDK to the 10.0.3xx band but tolerates a newer patch than the floor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bootstraps the
testingrepo and shipsAndreGoepel.Testing.E2E, extracting the ~900-line, ~85-95%-duplicated Playwright + .NET Aspire E2E infrastructure thatmarten-identity,finance-app, andapp-foundationeach carried locally.Closes #1
What moved into the package (
src/AndreGoepel.Testing.E2E)E2EAppFixture— boots the Aspire app graph once per collection, launches the shared Chromium browser, exposesProvisionAdminAsync. Takes aFunc<string[], Task<IDistributedApplicationTestingBuilder>>inE2EAppFixtureOptionsinstead of a generic type parameter, soE2ETestBase<TFixture>can stay constrained to one non-generic base regardless of whichProjects.*type each host's AppHost generates.E2ETestBase<TFixture>— fresh browser context per test, the shared account flows (LoginAsync,RegisterAsync,ConfirmEmailAsync,LogoutAsync,LoginAsAdminAsync), and trace-capture-on-failure made unconditional (was opt-in / present only inmarten-identity;finance-appandapp-foundationhad no way to debug a headless CI failure until now).PageExtensions— only the verbatim-identical core:WaitForBlazorAsync,GotoAsync,FillFieldAsync,ClickButtonAsync,ClickLinkAsync,AssertOnPathAsync.MailHogClient,TestData,Totp,VirtualAuthenticator— consolidated as-is (identical or near-identical across the three source repos).MailHogClientnow implementsIDisposableand a newIEmailLinkSourceinterface (it wasn't disposing itsHttpClientbefore).IEmailLinkSource— new seam so a host can swap MailHog for something else.marten-identity's sample app captures outbound mail itself (no MailHog container) via a localCapturedEmailClient; that stays inmarten-identityand gets wired in throughE2EAppFixtureOptions.MailSourceFactory.What stayed app-specific (not moved)
finance-app'sFillFormFieldAsync/SelectDropDownAsync/UploadFileAsyncmarten-identity'sFilterUsersGridAsyncandCapturedEmailClientapp-foundation'sEnsureEmailConfiguredAsync(drives its own Email Settings admin page)These stay as local extension methods / helpers in each repo, per
AndreGoepel.Testing.E2E's ownCLAUDE.md.Design decisions (open questions for review)
"http".finance-app'sAppHost.cscurrently names the endpoint"web";app-foundation's already names it"http".E2EAppFixtureOptions.MailHogEndpointNamedefaults to"http"(documented in the package README as the canonical name — it's distinct from MailHog's separate"smtp"endpoint, unlike"web").finance-app'sAppHost.csneeds updating to rename the endpoint (or passMailHogEndpointName = "web"explicitly) when it migrates onto this package.E2EAppFixtureOptions.ProvisionAdminButtonTextisrequired; each repo supplies its own exact (or stable-prefix) text.E2EAppFixture<TEntryPoint>. Went with a factory delegate (CreateAppHostBuilder) in the options instead — avoids every consuming repo spelling outE2EAppFixtureBase<Projects.AndreGoepel_FinanceApp_AppHost>as a base-class type argument, and keepsE2ETestBase<TFixture>constrainable to a single non-generic base type.Testing
tests/AndreGoepel.Testing.E2E.Testscovers the only genuinely unit-testable logic in the package:MailHogClient's message decoding (quoted-printable, MIME parts, link extraction) andTotp's key normalization. Everything else is Playwright/Aspire orchestration with no meaningful behavior in isolation — deliberately not padded with hollow tests for it.internalmembers are exposed to the test project viaInternalsVisibleTo.dotnet build/dotnet test/dotnet csharpier check ./dotnet packall pass locally;dotnet list package --vulnerable --include-transitivereports no findings.Also fixed
The copied
.gitignore's standard "Visual Studio Trace Files" rule (*.e2e) case-insensitively matched this repo's ownsrc/AndreGoepel.Testing.E2E/directory and silently excluded the whole library from tracking. Added a scoped!/src/AndreGoepel.Testing.E2E/exception.Still needed before the first release
v1.0.0tag can publish — that's a manual step on nuget.org's side, not something this PR can do.Test plan
dotnet build -c Releasedotnet test -c Release(17/17 passing)dotnet csharpier check .dotnet pack src/AndreGoepel.Testing.E2E/AndreGoepel.Testing.E2E.csproj -c Releasedotnet list package --vulnerable --include-transitive(no findings)marten-identity/finance-app/app-foundationonto the package (follow-up PRs, out of scope here)