static-repository-assets.spec.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. const { test, expect } = require("@playwright/test");
  2. const staticRepositoryUrl = "http://127.0.0.1:18184";
  3. const expectedAssets = [
  4. "/index-modern.html",
  5. "/settings.json",
  6. "/server-list.json",
  7. "/frontend/styling/index.css",
  8. "/frontend/javascript/index.js",
  9. "/frontend/images/logo.svg",
  10. "/frontend/images/favicon.svg",
  11. "/frontend/images/close-button.svg",
  12. "/frontend/images/chevron.svg",
  13. "/frontend/fonts/Inter-latin.woff2",
  14. "/frontend/fonts/Inter-latin-ext.woff2",
  15. "/frontend/images/background.jpeg",
  16. "/speedtest.js",
  17. "/speedtest_worker.js",
  18. "/design-switch.js",
  19. "/config.json",
  20. "/images/icon-192.png"
  21. ];
  22. test.describe("Unmodified repository static assets", () => {
  23. test("serves every modern frontend dependency and returns 404 for a missing path", async ({ request }) => {
  24. for (const path of expectedAssets) {
  25. const response = await request.get(`${staticRepositoryUrl}${path}`);
  26. expect(response.ok(), `${path} should return 2xx`).toBeTruthy();
  27. }
  28. const missing = await request.get(`${staticRepositoryUrl}/does-not-exist`);
  29. expect(missing.status()).toBe(404);
  30. });
  31. });