Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 27, 2025

Adds end-to-end smoke tests using Playwright with a real Kestrel server, following the pattern established by the CriticalCSS tool.

Changes

  • PlaywrightWebApplicationFactory: Custom factory using UseKestrel() with 25 seeded blog posts via DummyDataExtensions
  • PlaywrightSmokeTests: Four browser-based tests covering:
    • Home page rendering with blog posts
    • Blog post detail page navigation and content display
    • Pagination (page 2 navigation)
    • Blog post link click behavior
  • SequentialCollection: Prevents parallel test execution to avoid SQLite in-memory database conflicts

Implementation

public sealed class PlaywrightWebApplicationFactory : WebApplicationFactory<Program>
{
    protected override IHost CreateHost(IHostBuilder builder)
    {
        builder.ConfigureWebHost(b =>
        {
            b.ConfigureServices(services =>
            {
                services.UseDummyData(new DummyDataOptions { NumberOfBlogPosts = 25 });
            });
            b.UseKestrel();  // Real HTTP server for Playwright
        });
        // ...
    }
}

Tests use lazy initialization for Playwright/Browser instances to avoid constructor blocking and properly dispose resources via IAsyncDisposable.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdnjs.cloudflare.com
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderD (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderD _TOKEN&#34;; }; f (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderD n/Debug/net10.0/.playwright/node/linux-x64/node (dns block)
  • https://storage.googleapis.com/chrome-for-testing-public/143.0.7499.4/linux64/chrome-headless-shell-linux64.zip
    • Triggering command: /home/REDACTED/work/Blog/Blog/tools/LinkDotNet.Blog.CriticalCSS/bin/Debug/net10.0/.playwright/node/linux-x64/node /home/REDACTED/work/Blog/Blog/tools/LinkDotNet.Blog.CriticalCSS/bin/Debug/net10.0/.playwright/node/linux-x64/node /home/REDACTED/work/Blog/Blog/tools/LinkDotNet.Blog.CriticalCSS/bin/Debug/net10.0/.playwright/package/lib/server/registry/oopDownloadBrowserMain.js (http block)
  • https://storage.googleapis.com/chrome-for-testing-public/143.0.7499.4/linux64/chrome-linux64.zip
    • Triggering command: /home/REDACTED/work/Blog/Blog/tools/LinkDotNet.Blog.CriticalCSS/bin/Debug/net10.0/.playwright/node/linux-x64/node /home/REDACTED/work/Blog/Blog/tools/LinkDotNet.Blog.CriticalCSS/bin/Debug/net10.0/.playwright/node/linux-x64/node /home/REDACTED/work/Blog/Blog/tools/LinkDotNet.Blog.CriticalCSS/bin/Debug/net10.0/.playwright/package/lib/server/registry/oopDownloadBrowserMain.js (http block)
  • via.placeholder.com
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderD (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderD _TOKEN&#34;; }; f (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1200/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderD n/Debug/net10.0/.playwright/node/linux-x64/node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

I want that you create some more small smoketests inside LinkDotNet.Blog.IntegrationTests.
Especially with "UseKestrel" so we have a real server running and use Playwright and the WebApplicationFactory. The CriticalCSS Tool does something similar.
We can use "DummyDataExtensions" to have some initial blog post and navigate to a blog post. We can also check that paged navigation works.


✨ 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 changed the title [WIP] Add smoketests for blog integration with Kestrel and Playwright Add Playwright smoke tests with Kestrel server and dummy data Dec 27, 2025
Copilot AI requested a review from linkdotnet December 27, 2025 13:19
@linkdotnet linkdotnet force-pushed the copilot/add-smoketests-for-blog-integration branch from 0cff219 to 9b27830 Compare December 27, 2025 13:48
@linkdotnet linkdotnet marked this pull request as ready for review December 27, 2025 13:48
@linkdotnet linkdotnet closed this Dec 27, 2025
@linkdotnet linkdotnet deleted the copilot/add-smoketests-for-blog-integration branch December 27, 2025 14:47
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