Skip to content

Split test server infrastructure: TestServer for HttpClient, Kestrel for PuppeteerSharp - #1

Merged
kerryjiang merged 9 commits into
masterfrom
copilot/add-netinteractor-puppeteersharp
Jan 22, 2026
Merged

kerryjiang merged 9 commits into
masterfrom
copilot/add-netinteractor-puppeteersharp

Conversation

Copilot AI commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor

HttpClient tests were using Kestrel (real HTTP server with port binding) when TestServer (in-memory) is more appropriate. PuppeteerSharp requires real HTTP endpoints that browsers can access.

Changes

TestWebApplicationFactory

  • Added ServerMode enum: TestServer (in-memory) vs Kestrel (real HTTP)
  • Constructor now accepts mode parameter, defaults to TestServer
  • TestServer mode: Uses UseTestServer(), returns http://localhost placeholder
  • Kestrel mode: Uses UseKestrel() with dynamic port, returns actual URL like http://127.0.0.1:12345

WebAccessorTestData

  • Creates two factory instances instead of one
  • HttpClient tests: Use TestWebApplicationFactory(ServerMode.TestServer)
  • PuppeteerSharp tests: Use TestWebApplicationFactory(ServerMode.Kestrel)
public WebAccessorTestData()
{
    // HttpClient: in-memory, no network overhead
    _testServerFactory = new TestWebApplicationFactory(ServerMode.TestServer);
    
    // PuppeteerSharp: real HTTP endpoint for browser
    _kestrelFactory = new TestWebApplicationFactory(ServerMode.Kestrel);
}

Impact

  • HttpClient tests run faster (no TCP/IP overhead)
  • No port allocation for HttpClient tests (eliminates port conflicts)
  • PuppeteerSharp gets required real HTTP endpoint

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 21, 2026 07:58
…tion

Co-authored-by: kerryjiang <456060+kerryjiang@users.noreply.github.com>
…eanup, and exception handling

Co-authored-by: kerryjiang <456060+kerryjiang@users.noreply.github.com>
Copilot AI changed the title [WIP] Add NetInteractor.PuppeteerSharp project with IWebAccessor implementation Add PuppeteerSharp-based IWebAccessor implementation Jan 21, 2026
Copilot AI requested a review from kerryjiang January 21, 2026 08:04
@kerryjiang
kerryjiang marked this pull request as ready for review January 21, 2026 08:15
… approach

Co-authored-by: kerryjiang <456060+kerryjiang@users.noreply.github.com>
Copilot AI changed the title Add PuppeteerSharp-based IWebAccessor implementation Add parameterized unit tests for PuppeteerSharpWebAccessor Jan 21, 2026
Co-authored-by: kerryjiang <456060+kerryjiang@users.noreply.github.com>
Copilot AI changed the title Add parameterized unit tests for PuppeteerSharpWebAccessor Enable PuppeteerSharp tests with real HTTP server Jan 21, 2026
…emove WebAccessorIntegrationTests

Co-authored-by: kerryjiang <456060+kerryjiang@users.noreply.github.com>
Copilot AI changed the title Enable PuppeteerSharp tests with real HTTP server Replace URL rewriting with config parameters; consolidate test classes Jan 21, 2026
… enable PuppeteerSharp via env var

Co-authored-by: kerryjiang <456060+kerryjiang@users.noreply.github.com>
Copilot AI changed the title Replace URL rewriting with config parameters; consolidate test classes Pass web accessor instances and baseUrl as direct test parameters Jan 21, 2026
Co-authored-by: kerryjiang <456060+kerryjiang@users.noreply.github.com>
Copilot AI changed the title Pass web accessor instances and baseUrl as direct test parameters Remove unused accessorName parameter from IntegrationTests Jan 21, 2026
Co-authored-by: kerryjiang <456060+kerryjiang@users.noreply.github.com>
Copilot AI changed the title Remove unused accessorName parameter from IntegrationTests Split test server infrastructure: TestServer for HttpClient, Kestrel for PuppeteerSharp Jan 21, 2026
@kerryjiang
kerryjiang merged commit 7cfdb59 into master Jan 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants