hello world
+} diff --git a/test/development/app-dir/missing-required-html-tags-new-overlay/missing-html-tags-new-overlay.test.ts b/test/development/app-dir/missing-required-html-tags-new-overlay/missing-html-tags-new-overlay.test.ts new file mode 100644 index 0000000000000..bacf75d8ba78a --- /dev/null +++ b/test/development/app-dir/missing-required-html-tags-new-overlay/missing-html-tags-new-overlay.test.ts @@ -0,0 +1,47 @@ +import { nextTestSetup } from 'e2e-utils' +import { + assertHasRedbox, + assertNoRedbox, + getRedboxDescription, + getToastErrorCount, + hasErrorToast, + retry, +} from 'next-test-utils' +import { outdent } from 'outdent' + +// TODO: merge with test/development/app-dir/missing-required-html-tags/index.test.ts +// once new overlay is stable +describe('app-dir - missing required html tags', () => { + const { next } = nextTestSetup({ + files: __dirname, + }) + + it('should display correct error count in dev indicator', async () => { + const browser = await next.browser('/') + + retry(async () => { + expect(await hasErrorToast(browser)).toBe(true) + }) + // Dev indicator should show 1 error + expect(await getToastErrorCount(browser)).toBe(1) + + await assertHasRedbox(browser) + + await retry(async () => { + expect(await getRedboxDescription(browser)).toEqual(outdent` + The following tags are missing in the Root Layout: . + Read more at https://nextjs.org/docs/messages/missing-root-layout-tags + `) + }) + + await next.patchFile('app/layout.js', (code) => + code.replace( + 'return {children}', + 'return {children}' + ) + ) + + await assertNoRedbox(browser) + expect(await browser.elementByCss('p').text()).toBe('hello world') + }) +}) diff --git a/test/development/app-dir/missing-required-html-tags-new-overlay/next.config.js b/test/development/app-dir/missing-required-html-tags-new-overlay/next.config.js new file mode 100644 index 0000000000000..09632ad85342c --- /dev/null +++ b/test/development/app-dir/missing-required-html-tags-new-overlay/next.config.js @@ -0,0 +1,8 @@ +/** + * @type {import('next').NextConfig} + */ +module.exports = { + experimental: { + newDevOverlay: true, + }, +} diff --git a/test/development/app-dir/missing-required-html-tags/index.test.ts b/test/development/app-dir/missing-required-html-tags/index.test.ts index 98ad32b89311b..0776a5db38906 100644 --- a/test/development/app-dir/missing-required-html-tags/index.test.ts +++ b/test/development/app-dir/missing-required-html-tags/index.test.ts @@ -64,7 +64,7 @@ describe('app-dir - missing required html tags', () => { ) await openRedbox(browser) - // TODO(NDX-768): Should show "missing tags" error + expect(await getRedboxDescription(browser)).toMatchInlineSnapshot(` "In HTML,cannot be a child of <#document>. This will cause a hydration error."