diff options
| author | Leitwolf11 | 2026-11-17 15:12:16 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-17 15:12:16 +0300 |
| commit | 0036d3f1348f13dda83f97cba8a0a135abe5a7da (patch) | |
| tree | 6e29aa1a79b993b31409050b4bdff34dc12414b0 /apps/web/e2e | |
| parent | 477625cd75db2295d0f05bce206d9ea1b5b13ef2 (diff) | |
| download | progmaweb-site/not-found.tar.gz | |
Give an unknown address a page of the site, in the visitor's languagesite/not-found
progmasoft.com/example.txt showed Next's own "404: This page could not be
found" with two titles. Every host now answers such an address with the
header and the footer of the site around one sentence, "We are sorry, the
page you requested cannot be found.", and a line on why, in the language
of the visitor, with the status 404 and no index (app/not-found.tsx,
notFound messages in every locale).
On product.progmasoft.com an unknown address reaches the page of a
product and asks for the not-found page; its metadata now gives the
not-found title too, not the bare site name.
Tests: every host answers /example.txt with 404, the sentence, the header
and the footer, one title, and no sideways scroll; the page speaks German
with a German cookie. 160 layout tests pass; tsc, eslint, 42 unit tests
and the build pass.
Claude-Session: https://claude.ai/code/session_01Ji7xZMYjc4zankoc7hGBE1
Diffstat (limited to 'apps/web/e2e')
| -rw-r--r-- | apps/web/e2e/not-found.spec.ts | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/apps/web/e2e/not-found.spec.ts b/apps/web/e2e/not-found.spec.ts new file mode 100644 index 0000000..7be30f5 --- /dev/null +++ b/apps/web/e2e/not-found.spec.ts @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +// SPDX-License-Identifier: AGPL-3.0-or-later + +import { expect, test } from "@playwright/test"; + +const hosts = [ + "progmasoft.com", + "account.progmasoft.com", + "viget.progmasoft.com", + "product.progmasoft.com", +]; + +for (const host of hosts) { + test(`${host} answers an unknown address with its own page and 404`, async ({ + page, + }) => { + const response = await page.goto(`http://${host}/example.txt`); + expect(response?.status()).toBe(404); + await expect(page.locator("h1")).toHaveText( + "We are sorry, the page you requested cannot be found.", + ); + await expect(page.locator("header.site-header")).toBeVisible(); + await expect(page.locator("footer.site-footer")).toBeVisible(); + expect(await page.locator("title").count()).toBe(1); + await expect(page).toHaveTitle("Page not found · Progmasoft"); + const overflow = await page.evaluate( + () => + document.documentElement.scrollWidth - + document.documentElement.clientWidth, + ); + expect(overflow).toBe(0); + }); +} + +test("the page of an unknown address speaks the visitor's language", async ({ + page, + context, +}) => { + await context.addCookies([ + { + name: "progmasoft_locale", + value: "de-DE", + domain: ".progmasoft.com", + path: "/", + }, + ]); + await page.goto("http://viget.progmasoft.com/nope"); + await expect(page.locator("h1")).toHaveText( + "Es tut uns leid, die angeforderte Seite wurde nicht gefunden.", + ); +}); |