Skip to content

test: add Next.js head change e2e coverage#10

Merged
exKAZUu merged 3 commits intomainfrom
enhance-next-e2e-issue-272
Apr 19, 2026
Merged

test: add Next.js head change e2e coverage#10
exKAZUu merged 3 commits intomainfrom
enhance-next-e2e-issue-272

Conversation

@exKAZUu
Copy link
Copy Markdown
Member

@exKAZUu exKAZUu commented Apr 18, 2026

Related to suren-atoyan#272

Summary

  • Added a Next.js pages-router e2e fixture that changes next/head while remounting the editor.
  • Added a regression assertion that the real Monaco vs/editor/editor.main.css stylesheet remains present across repeated head changes.
  • Updated the existing app-router e2e probe to load the real Monaco runtime instead of injecting a mocked Monaco object.

Why

  • Issue 272 described Monaco editor styles disappearing after Next.js head updates, especially favicon changes.
  • The e2e coverage now exercises the actual Monaco loader/editor path so it can catch integration regressions hidden by mocks.

Testing

  • yarn check-for-ai
  • yarn test:e2e:next

exKAZUu and others added 2 commits April 19, 2026 08:51
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the E2E test suite by extracting the Monaco mock into a shared fixture and introduces a new test case and page to verify that Monaco stylesheets are preserved during Next.js Head updates. Feedback was provided to optimize the stylesheet injection logic in the new test page by updating the global flag when a stylesheet is already present, thereby avoiding redundant DOM queries.

Comment thread e2e/next-app/pages/issue272.tsx Outdated
Comment on lines +64 to +65
if (globalThis.__issue272StylesheetInjected) return;
if (document.querySelector('link[data-name="vs/editor/editor.main"]')) return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To avoid redundant DOM queries on every render, the global flag should be updated if the stylesheet is already present in the document. This aligns with the goal of simplifying code and eliminating redundancy (Repository Style Guide, Rule 6).

Suggested change
if (globalThis.__issue272StylesheetInjected) return;
if (document.querySelector('link[data-name="vs/editor/editor.main"]')) return;
if (globalThis.__issue272StylesheetInjected || document.querySelector('link[data-name="vs/editor/editor.main"]')) {
globalThis.__issue272StylesheetInjected = true;
return;
}
References
  1. Simplify code as much as possible to eliminate redundancy. (link)

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu exKAZUu merged commit c2353f8 into main Apr 19, 2026
7 checks passed
@exKAZUu exKAZUu deleted the enhance-next-e2e-issue-272 branch April 19, 2026 00:19
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