Add Aspire-hosted Playwright test harness - #10954
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51555024-4670-44c9-96d2-dc67fa45e2c5
Make Admin API soft-delete tests self-contained, prevent test-only auth bypass assemblies from surviving normal builds, and harden runner cleanup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51555024-4670-44c9-96d2-dc67fa45e2c5
76bf13e to
4700854
Compare
This reverts commit 4700854. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51555024-4670-44c9-96d2-dc67fa45e2c5
bbee9d1 to
a43c436
Compare
Reuse an already trusted development certificate without requiring elevation, clean up temporary certificate files reliably, and give the destructive Admin API soft-delete test a unique package. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51555024-4670-44c9-96d2-dc67fa45e2c5
…://github.com/NuGet/NuGetGallery into users/chabiss/aspire-playwright-agent-harness
…nch by an agent as well
521fa7f to
18fd0eb
Compare
| - cron: '0 12 * * 1-5' # Weekdays at 8 AM Eastern (UTC 12:00) | ||
| workflow_dispatch: | ||
|
|
||
| permissions: |
There was a problem hiding this comment.
Is this necessary? #Resolved
| @@ -0,0 +1,82 @@ | |||
| # Plan: Integrate Aspire.Hosting.Testing for local NuGet End-to-End tests | |||
There was a problem hiding this comment.
Is this where we keep design docs? This seems like a point in time implementation plan not a long lived durable document. #Resolved
There was a problem hiding this comment.
This needs to be removed, I forgot to clean it that was the old plan
| var options = base.ContextOptions(); | ||
| if (IsAspireHarness) | ||
| { | ||
| options.IgnoreHTTPSErrors = true; |
There was a problem hiding this comment.
Why is this necessary? Don't we install the localhost dev certificate as trusted? #Resolved
| [Fact] | ||
| [Priority(0)] | ||
| [Category("P0Tests")] | ||
| [Category("ReadOnlyModeTests")] |
There was a problem hiding this comment.
Why did we remove this category? #Resolved
| namespace NuGetGallery.FunctionalTests.Playwright.BasicPages | ||
| { | ||
| [Collection(AspirePlaywrightCollection.Definition)] | ||
| [Trait("Category", "PlaywrightTests")] |
There was a problem hiding this comment.
Would [Category("PlaywrightTests")]? Seems like there are two different approaches for categorizing tests now. #Resolved
There was a problem hiding this comment.
What's wrong with having a category for for Playwrite test? We have CloudServiceTests, ReadOnlyModeTests?
There was a problem hiding this comment.
I'm wondering why Trait and not Category attribute (which we have below in the file). What's the difference?
There was a problem hiding this comment.
Ah I see, Trait is the actual xUnit feature. Category is just a commonly used Trait key ([Trait("Category", "...")]) that emulates NUnit/MSTest-style test categories.
I'll switch it to Category.
| [Fact] | ||
| [Priority(0)] | ||
| [Category("ReadOnlyModeTests")] | ||
| public async Task HomePageLoads_ContainsExpectedText() |
There was a problem hiding this comment.
Is this duplicating the test in tests/NuGetGallery.FunctionalTests/Playwright/BasicPages/HomePageValidationTest.cs? Why? #Resolved
| .\tools\Setup-DevEnvironment.ps1 | ||
| $hostPid = .\tools\Start-AspireHost.ps1 -Configuration Release -UnsafeAdminApiAuthBypassForTesting | ||
| try { | ||
| .\tools\Seed-FunctionalTestData.ps1 -Configuration Release |
There was a problem hiding this comment.
Is this needed since the test harness does it? #Resolved
There was a problem hiding this comment.
Yes, it's still used by
Q:\src\NuGetGallery\tests\Scripts\RunAspireFunctionalTests.ps1
There was a problem hiding this comment.
No, I mean does it need to be executed by the agent as part of copilot instructions, since the test harness is also doing this? Or am I missing something.
There was a problem hiding this comment.
Not sure if this block is meaningful. I ran /Init in the CLI, that why the entire MD file was re-written.
85cf4a3 to
626ec2f
Compare
…ses Aspire.Hosting.Testing
Make the existing required Aspire Functional Tests check run after Playwright and fail unless the Playwright job succeeds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51555024-4670-44c9-96d2-dc67fa45e2c5
Summary
Adds an Aspire-hosted Playwright harness that lets an agent or developer run the supported Gallery browser tests with one command. The test process now owns the AppHost lifecycle, Gallery readiness, functional-data seeding, test configuration, and teardown instead of requiring several manually coordinated scripts.
What changed
Aspire.Hosting.Testingto the existingNuGetGallery.FunctionalTestsproject and references the Gallery AppHost.gallery-httpendpoint before testing.GalleryConfiguration, and restores process state during disposal.ci-galleryprofile withCategory=PlaywrightTests.tests\Scripts\RunGalleryPlaywrightTests.ps1as the stable local and agent entry point.-TrustDevCertidempotent by reusing an already trusted certificate and reliably deleting temporary certificate/key files when import is required.Running the harness
From the repository root on Windows:
The runner defaults to the
ci-galleryprofile. Use-AppHostProfile fullonly when the Azure Search prerequisites are available.The existing non-Playwright functional-test path remains available:
Test scope and lifecycle
ConfigurationFilePathis set only afterGalleryTools.exe seedfunctionaltestswritessettings.CI.json, preventing premature initialization of the static Gallery configuration.Validation
git diff --checkpass.