Monorepo for Aesthetic.Computer
aesthetic.computer
1#!/usr/bin/env node
2// test-prompt-interaction.mjs - Test interacting with the prompt
3
4import { withCDP } from './cdp.mjs';
5
6await withCDP(async (cdp) => {
7 console.log('🧪 Testing prompt interaction...\n');
8
9 // Get current input value
10 const currentValue = await cdp.eval(`
11 document.querySelector('input')?.value || ''
12 `);
13 console.log(`Current input value: "${currentValue}"`);
14
15 // Set new value
16 const newValue = 'hello from cdp system! 👋';
17 await cdp.eval(`
18 const input = document.querySelector('input');
19 if (input) {
20 input.value = '${newValue}';
21 input.focus();
22 input.dispatchEvent(new Event('input', { bubbles: true }));
23 }
24 `);
25
26 console.log(`✅ Set input to: "${newValue}"`);
27
28 // Verify it was set
29 const verifyValue = await cdp.eval(`
30 document.querySelector('input')?.value || ''
31 `);
32 console.log(`Verified value: "${verifyValue}"`);
33
34 // Get some info about the prompt state
35 const info = await cdp.eval(`
36 ({
37 hasInput: !!document.querySelector('input'),
38 inputPlaceholder: document.querySelector('input')?.placeholder,
39 hasBios: typeof window.bios !== 'undefined',
40 currentPiece: window.location.pathname
41 })
42 `);
43
44 console.log('\n📊 Prompt state:');
45 console.log(` Has input: ${info.hasInput}`);
46 console.log(` Placeholder: ${info.inputPlaceholder}`);
47 console.log(` Has bios: ${info.hasBios}`);
48 console.log(` Current piece: ${info.currentPiece}`);
49
50}, {
51 targetUrl: 'https://localhost:8888/prompt',
52 verbose: true
53});