From 0a3b5191d1eba6ea70eeb91ef39638d5a6fbf1ca Mon Sep 17 00:00:00 2001 From: Daniel Almaguer Date: Thu, 30 May 2024 12:01:43 -0500 Subject: [PATCH] fix(core): custom 404 page not rendering (#957) --- .changeset/rare-bees-beg.md | 5 +++++ core/app/[locale]/(default)/[...rest]/page.tsx | 5 +++++ core/tests/ui/desktop/e2e/404.spec.ts | 7 +++++++ 3 files changed, 17 insertions(+) create mode 100644 .changeset/rare-bees-beg.md create mode 100644 core/app/[locale]/(default)/[...rest]/page.tsx create mode 100644 core/tests/ui/desktop/e2e/404.spec.ts diff --git a/.changeset/rare-bees-beg.md b/.changeset/rare-bees-beg.md new file mode 100644 index 000000000..828bb592c --- /dev/null +++ b/.changeset/rare-bees-beg.md @@ -0,0 +1,5 @@ +--- +"@bigcommerce/catalyst-core": patch +--- + +fix custom 404 page not being used diff --git a/core/app/[locale]/(default)/[...rest]/page.tsx b/core/app/[locale]/(default)/[...rest]/page.tsx new file mode 100644 index 000000000..71d405070 --- /dev/null +++ b/core/app/[locale]/(default)/[...rest]/page.tsx @@ -0,0 +1,5 @@ +import { notFound } from 'next/navigation'; + +export default function CatchAllPage() { + notFound(); +} diff --git a/core/tests/ui/desktop/e2e/404.spec.ts b/core/tests/ui/desktop/e2e/404.spec.ts new file mode 100644 index 000000000..38a46dbab --- /dev/null +++ b/core/tests/ui/desktop/e2e/404.spec.ts @@ -0,0 +1,7 @@ +import { expect, test } from '@playwright/test'; + +test('404 page', async ({ page }) => { + await page.goto('/unknown-url'); + + await expect(page.getByRole('heading', { name: "We couldn't find that page!" })).toBeVisible(); +});