Skip to content

Improved page loading in testing#16

Merged
LeandroPata merged 8 commits into
mainfrom
testing/page-loading-improvements
Apr 16, 2026
Merged

Improved page loading in testing#16
LeandroPata merged 8 commits into
mainfrom
testing/page-loading-improvements

Conversation

@LeandroPata
Copy link
Copy Markdown
Owner

@LeandroPata LeandroPata commented Apr 11, 2026

Improved page loading in testing

Summary

Updated the test suite to use domcontentloaded instead of networkidle, when applicable, for better control over when tests execute. This ensures that tests run when the DOM is fully loaded, improving reliability and performance. Also added test fixtures to avoid tests being network dependent whenever possible.

Changes

  • Updated wait strategy in multiple tests:

    • In test/E2ETesting/gallery.spec.ts, updated the page.goto call to use { waitUntil: 'domcontentloaded' };
    • In test/E2ETesting/imageLoading.spec.ts, updated the page.goto call to use { waitUntil: 'domcontentloaded' };
    • In test/E2ETesting/languageSelect.spec.ts, updated the page.goto call to use { waitUntil: 'domcontentloaded' };
    • In test/E2ETesting/nav.spec.ts, updated the page.goto call to use { waitUntil: 'domcontentloaded' };
    • In test/E2ETesting/pageLoading.spec.ts, updated the page.goto call to use { waitUntil: 'domcontentloaded' };
    • In test/E2ETesting/themeToggle.spec.ts, updated the page.goto call to use { waitUntil: 'domcontentloaded' };
    • In test/E2ETesting/umami.spec.ts, updated the page.goto calls to use { waitUntil: 'load' };
  • Added a new fixture file (test/E2ETesting/fixtures.ts) to block all image requests from external domains;

  • Updated various test files to use this new fixture, ensuring that network requests are controlled during tests;

Notes

The new fixture provides better isolation for tests, reducing flakiness due to external CDN requests.
The Lightbox navigates to next image test in gallery.spec.ts still is still CDN dependent, because the test compares the current image to the next image to check if it actually navigated to the next image. Without it actually loading the images, it would be comparing null to null, so, until I can mock this, it will stay network dependent.

@LeandroPata LeandroPata self-assigned this Apr 11, 2026
@LeandroPata LeandroPata merged commit 609a6f1 into main Apr 16, 2026
2 checks passed
@LeandroPata LeandroPata deleted the testing/page-loading-improvements branch April 16, 2026 15:06
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.

1 participant