import { test } from 'magnitude-test'; test('Editor page renders correctly', async (agent) => { await agent.act('Navigate to /editor/new'); await agent.check('The text "Create New Node" is visible on the screen'); await agent.check('A text input field labeled "Title" is visible'); await agent.check('A textarea labeled "Body" is visible'); await agent.check('A button labeled "Find Related" is visible'); await agent.check('A button labeled "Publish Node" is visible'); }); test('[Happy Path] User can navigate to editor from chat', async (agent) => { // Simulate pre-filled form from chat redirect await agent.act('Navigate to /editor/new?title=My%20Idea&body=This%20is%20my%20thought'); await agent.check('The "Title" input contains "My Idea"'); await agent.check('The "Body" textarea contains "This is my thought"'); }); test('[Happy Path] User can fill out and publish a new node', async (agent) => { // Navigate to the editor await agent.act('Navigate to /editor/new'); // Fill out the form await agent.act('Type "My First Published Node" into the "Title" input'); await agent.act('Type "This is the body of my first node. It contains interesting thoughts about technology and innovation." into the "Body" textarea'); // Click Publish await agent.act('Click the "Publish Node" button'); // Check: User is redirected to chat (galaxy not implemented yet) await agent.check('The page URL contains "/chat"'); }); test('[Unhappy Path] Publishing requires both title and body', async (agent) => { await agent.act('Navigate to /editor/new'); // Try to publish without filling in the form await agent.act('Click the "Publish Node" button'); // The form should prevent submission (Mantine form validation) // The URL should still be /editor/new await agent.check('The page URL contains "/editor/new"'); });