fix: Replace agent.open() with agent.act('Navigate to...') in tests

Magnitude test framework doesn't have an agent.open() method.
Navigation must be done through agent.act() with natural language.

Fixed all 10 test cases in node-publishing.mag.ts:
- Happy path tests (3)
- Unhappy path tests (6)
- Integration test (1)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-10 17:35:13 +00:00
parent 5fc02f8d9b
commit a553cc6130

View File

@@ -12,7 +12,7 @@ import { test } from 'magnitude-test';
// ============================================================================
test('User can publish a node from conversation', async (agent) => {
await agent.open('http://localhost:3000');
await agent.act('Navigate to http://localhost:3000');
// Step 1: Login with Bluesky
await agent.act('Click the "Log in with Bluesky" button');
@@ -48,7 +48,7 @@ test('User can publish a node from conversation', async (agent) => {
test('User can edit node draft before publishing', async (agent) => {
// Assumes user is already logged in from previous test
await agent.open('http://localhost:3000/chat');
await agent.act('Navigate to http://localhost:3000/chat');
// Start conversation
await agent.act('Type "Testing the edit flow" and press Enter');
@@ -71,7 +71,7 @@ test('User can edit node draft before publishing', async (agent) => {
});
test('User can cancel node draft without publishing', async (agent) => {
await agent.open('http://localhost:3000/chat');
await agent.act('Navigate to http://localhost:3000/chat');
// Start conversation
await agent.act('Type "Test cancellation" and press Enter');
@@ -93,7 +93,7 @@ test('User can cancel node draft without publishing', async (agent) => {
test('Cannot publish node without authentication', async (agent) => {
// Open edit page directly without being logged in
await agent.open('http://localhost:3000/edit');
await agent.act('Navigate to http://localhost:3000/edit');
await agent.check('Shows empty state message');
await agent.check('Message says "No Node Draft"');
@@ -101,7 +101,7 @@ test('Cannot publish node without authentication', async (agent) => {
});
test('Cannot publish node with empty title', async (agent) => {
await agent.open('http://localhost:3000/chat');
await agent.act('Navigate to http://localhost:3000/chat');
// Create draft
await agent.act('Type "Test empty title validation" and press Enter');
@@ -116,7 +116,7 @@ test('Cannot publish node with empty title', async (agent) => {
});
test('Cannot publish node with empty content', async (agent) => {
await agent.open('http://localhost:3000/chat');
await agent.act('Navigate to http://localhost:3000/chat');
// Create draft
await agent.act('Type "Test empty content validation" and press Enter');
@@ -131,7 +131,7 @@ test('Cannot publish node with empty content', async (agent) => {
});
test('Shows error notification if publish fails', async (agent) => {
await agent.open('http://localhost:3000/chat');
await agent.act('Navigate to http://localhost:3000/chat');
// Create draft
await agent.act('Type "Test error handling" and press Enter');
@@ -149,7 +149,7 @@ test('Shows error notification if publish fails', async (agent) => {
});
test('Handles long content with truncation', async (agent) => {
await agent.open('http://localhost:3000/chat');
await agent.act('Navigate to http://localhost:3000/chat');
// Create a very long message
const longMessage = 'A'.repeat(500) + ' This is a test of long content truncation for Bluesky posts.';
@@ -168,7 +168,7 @@ test('Handles long content with truncation', async (agent) => {
});
test('Shows warning when cache fails but publish succeeds', async (agent) => {
await agent.open('http://localhost:3000/chat');
await agent.act('Navigate to http://localhost:3000/chat');
await agent.act('Type "Test cache failure graceful degradation" and press Enter');
await agent.check('AI responds');
@@ -190,7 +190,7 @@ test('Shows warning when cache fails but publish succeeds', async (agent) => {
test('Complete user journey: Login → Converse → Publish → View', async (agent) => {
// Full end-to-end test
await agent.open('http://localhost:3000');
await agent.act('Navigate to http://localhost:3000');
// Login
await agent.act('Login with Bluesky')