-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-charmflow-v3-plugin-interaction.html
More file actions
342 lines (299 loc) · 12.8 KB
/
test-charmflow-v3-plugin-interaction.html
File metadata and controls
342 lines (299 loc) · 12.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CharmFlow v3 + PluginInteractionManager 統合テスト</title>
<style>
body {
margin: 0;
padding: 20px;
font-family: Arial, sans-serif;
background: #f0f0f0;
}
.test-header {
background: #2196F3;
color: white;
padding: 15px;
border-radius: 8px;
margin-bottom: 20px;
}
.test-controls {
background: #fff;
padding: 15px;
border-radius: 8px;
margin-bottom: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.test-controls h3 {
margin: 0 0 10px 0;
color: #333;
}
.test-controls button {
margin: 5px;
padding: 8px 15px;
border: none;
border-radius: 4px;
background: #4CAF50;
color: white;
cursor: pointer;
font-size: 14px;
}
.test-controls button:hover {
background: #45a049;
}
.test-controls button.danger {
background: #f44336;
}
.test-controls button.danger:hover {
background: #da190b;
}
.status {
background: #333;
color: white;
padding: 10px;
border-radius: 4px;
font-family: monospace;
font-size: 12px;
max-height: 200px;
overflow-y: auto;
margin-bottom: 20px;
}
.charmflow-container {
width: 100%;
height: 600px;
border: 2px solid #ddd;
border-radius: 8px;
background: white;
}
.test-results {
background: #fff;
padding: 15px;
border-radius: 8px;
margin-top: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.test-result {
margin: 5px 0;
padding: 8px;
border-radius: 4px;
}
.test-result.success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.test-result.error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.test-result.info {
background: #d1ecf1;
color: #0c5460;
border: 1px solid #bee5eb;
}
</style>
</head>
<body>
<div class="test-header">
<h1>🧪 CharmFlow v3 + PluginInteractionManager 統合テスト</h1>
<p>新しいPluginInteractionManagerがCharmFlow v3環境で正常動作することを確認</p>
</div>
<div class="test-controls">
<h3>🎛️ テスト操作</h3>
<button onclick="testPluginCreation()">📦 プラグイン作成テスト</button>
<button onclick="testPluginDragMove()">🖱️ ドラッグ移動テスト</button>
<button onclick="testPluginSelection()">🎯 選択テスト</button>
<button onclick="testUIToggle()">🔄 UI展開テスト</button>
<button onclick="testConnectionMode()">🔗 接続モードテスト</button>
<button onclick="runAllTests()">🚀 全テスト実行</button>
<button onclick="clearTestResults()" class="danger">🧹 結果クリア</button>
</div>
<div class="status" id="status">
テスト準備中...
</div>
<!-- CharmFlow v3をiframeで埋め込み -->
<div class="charmflow-container">
<iframe
id="charmflow-iframe"
src="http://192.168.0.150:10000/charmflow_v3/"
width="100%"
height="100%"
frameborder="0"
onload="onCharmFlowLoaded()">
</iframe>
</div>
<div class="test-results" id="test-results">
<h3>📊 テスト結果</h3>
<div id="results-content">
テスト未実行
</div>
</div>
<script>
let charmFlowWindow = null;
let testResults = [];
let currentTestStep = 0;
// CharmFlow v3読み込み完了時
function onCharmFlowLoaded() {
try {
const iframe = document.getElementById('charmflow-iframe');
charmFlowWindow = iframe.contentWindow;
updateStatus('✅ CharmFlow v3読み込み完了');
// 初期化待機
setTimeout(() => {
checkCharmFlowReadiness();
}, 3000);
} catch (error) {
updateStatus(`❌ CharmFlow v3アクセスエラー: ${error.message}`);
}
}
// CharmFlow v3の準備状況確認
function checkCharmFlowReadiness() {
try {
if (charmFlowWindow && charmFlowWindow.nyaCoreUI) {
updateStatus('✅ nyaCoreUI確認完了');
if (charmFlowWindow.nyaCoreUI.projectCore) {
updateStatus('✅ ProjectCore確認完了');
addTestResult('CharmFlow v3システム準備完了', 'success');
} else {
updateStatus('⚠️ ProjectCore未確認');
}
// PluginInteractionManager確認
if (charmFlowWindow.PluginInteractionManager) {
updateStatus('✅ PluginInteractionManager確認完了');
addTestResult('PluginInteractionManagerクラス利用可能', 'success');
} else {
updateStatus('⚠️ PluginInteractionManager未確認');
addTestResult('PluginInteractionManagerクラス未確認', 'error');
}
} else {
updateStatus('⚠️ nyaCoreUI未確認 - 再試行中...');
setTimeout(checkCharmFlowReadiness, 2000);
}
} catch (error) {
updateStatus(`❌ 準備確認エラー: ${error.message}`);
addTestResult(`準備確認失敗: ${error.message}`, 'error');
}
}
// プラグイン作成テスト
async function testPluginCreation() {
updateStatus('🧪 プラグイン作成テスト開始...');
try {
if (!charmFlowWindow || !charmFlowWindow.nyaCoreUI) {
throw new Error('CharmFlow v3未準備');
}
const nyaCoreUI = charmFlowWindow.nyaCoreUI;
const position = { x: 100, y: 100 };
// text-noteプラグインを作成
const pluginId = await nyaCoreUI.createUIPlugin('text-note', position);
if (pluginId) {
updateStatus(`✅ プラグイン作成成功: ${pluginId}`);
addTestResult(`プラグイン作成成功: text-note (${pluginId})`, 'success');
// 作成されたプラグインの操作可能性確認
setTimeout(() => {
checkPluginInteractivity(pluginId);
}, 1000);
} else {
throw new Error('プラグインID取得失敗');
}
} catch (error) {
updateStatus(`❌ プラグイン作成エラー: ${error.message}`);
addTestResult(`プラグイン作成失敗: ${error.message}`, 'error');
}
}
// プラグイン操作可能性確認
function checkPluginInteractivity(pluginId) {
try {
const iframe = document.getElementById('charmflow-iframe');
const pluginElement = iframe.contentDocument.getElementById(`ui-element-${pluginId}`);
if (pluginElement) {
updateStatus(`✅ プラグイン要素確認: ${pluginId}`);
addTestResult(`プラグイン要素DOM確認: ${pluginId}`, 'success');
// PluginInteractionManagerの動作確認
if (charmFlowWindow.nyaCoreUI) {
const interactionManager = charmFlowWindow.nyaCoreUI.pluginInteractionManager;
if (interactionManager) {
updateStatus('✅ PluginInteractionManager動作確認完了');
addTestResult('PluginInteractionManager動作確認完了', 'success');
}
}
} else {
updateStatus(`⚠️ プラグイン要素未確認: ${pluginId}`);
addTestResult(`プラグイン要素DOM未確認: ${pluginId}`, 'error');
}
} catch (error) {
updateStatus(`❌ 操作確認エラー: ${error.message}`);
addTestResult(`操作確認失敗: ${error.message}`, 'error');
}
}
// ドラッグ移動テスト
function testPluginDragMove() {
updateStatus('🧪 ドラッグ移動テスト開始...');
addTestResult('ドラッグ移動テスト: 手動で実際のプラグインをドラッグして確認', 'info');
}
// 選択テスト
function testPluginSelection() {
updateStatus('🧪 選択テスト開始...');
addTestResult('選択テスト: 手動でプラグインをクリックして選択確認', 'info');
}
// UI展開テスト
function testUIToggle() {
updateStatus('🧪 UI展開テスト開始...');
addTestResult('UI展開テスト: 手動でプラグインをダブルクリックして展開確認', 'info');
}
// 接続モードテスト
function testConnectionMode() {
updateStatus('🧪 接続モードテスト開始...');
addTestResult('接続モードテスト: 手動で2つのプラグインの接続確認', 'info');
}
// 全テスト実行
async function runAllTests() {
updateStatus('🚀 全テスト実行開始...');
clearTestResults();
await sleep(1000);
await testPluginCreation();
await sleep(2000);
testPluginDragMove();
await sleep(1000);
testPluginSelection();
await sleep(1000);
testUIToggle();
await sleep(1000);
testConnectionMode();
updateStatus('🎉 全テスト実行完了');
addTestResult('全テスト実行完了 - 手動操作で各機能を確認してください', 'success');
}
// ユーティリティ関数
function updateStatus(message) {
const status = document.getElementById('status');
const timestamp = new Date().toLocaleTimeString();
status.innerHTML += `[${timestamp}] ${message}\n`;
status.scrollTop = status.scrollHeight;
console.log(message);
}
function addTestResult(message, type) {
testResults.push({ message, type, timestamp: new Date() });
updateTestResults();
}
function updateTestResults() {
const resultsContent = document.getElementById('results-content');
resultsContent.innerHTML = testResults.map(result =>
`<div class="test-result ${result.type}">
[${result.timestamp.toLocaleTimeString()}] ${result.message}
</div>`
).join('');
}
function clearTestResults() {
testResults = [];
updateTestResults();
updateStatus('🧹 テスト結果クリア');
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
// 初期化
updateStatus('🔄 CharmFlow v3統合テスト初期化中...');
</script>
</body>
</html>