-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_test_interactive.js
More file actions
167 lines (137 loc) · 6.1 KB
/
Copy pathdebug_test_interactive.js
File metadata and controls
167 lines (137 loc) · 6.1 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
const { chromium } = require('playwright');
(async () => {
console.log('🔍 Starting enhanced debug test...');
const browser = await chromium.launch({
headless: false,
devtools: true,
slowMo: 1000
});
const context = await browser.newContext({
viewport: { width: 1400, height: 1000 }
});
const page = await context.newPage();
// Listen to all console messages
const consoleMessages = [];
page.on('console', msg => {
const text = msg.text();
consoleMessages.push({
type: msg.type(),
text: text,
timestamp: new Date().toISOString()
});
// Print debug messages we're specifically looking for
if (text.includes('🎨') || text.includes('🖼️') || text.includes('📤') ||
text.includes('empty') || text.includes('blob') || text.includes('FormData') ||
text.includes('size:') || text.includes('file')) {
console.log(`CONSOLE [${msg.type().toUpperCase()}]: ${text}`);
}
});
// Listen to network requests
page.on('request', request => {
if (request.url().includes('/order') || request.url().includes('upload')) {
console.log(`🌐 REQUEST: ${request.method()} ${request.url()}`);
}
});
page.on('response', response => {
if (response.url().includes('/order') || response.url().includes('upload')) {
console.log(`🌐 RESPONSE: ${response.status()} ${response.url()}`);
}
});
try {
console.log('📱 Loading application at http://localhost:3029...');
await page.goto('http://localhost:3029', { waitUntil: 'networkidle' });
// Wait for app to initialize
console.log('⏳ Waiting for app initialization...');
await page.waitForTimeout(3000);
// Check if we have a canvas
const canvasExists = await page.locator('canvas').count() > 0;
console.log(`🎨 Canvas elements found: ${await page.locator('canvas').count()}`);
// Find and click the "텍스트 추가" (Add Text) button
console.log('🔍 Looking for Add Text button...');
const addTextButton = page.locator('button:has-text("텍스트 추가"), button:has-text("Add Text")');
if (await addTextButton.count() > 0) {
console.log('✅ Found Add Text button, clicking...');
await addTextButton.click();
await page.waitForTimeout(1000);
// Look for text input field
const textInput = page.locator('input[type="text"], textarea, input[placeholder*="텍스트"], input[placeholder*="text"]').first();
if (await textInput.count() > 0) {
console.log('✅ Found text input, entering "Debug Test"...');
await textInput.fill('Debug Test');
await page.waitForTimeout(500);
// Look for confirm/apply button
const confirmButton = page.locator('button:has-text("확인"), button:has-text("Apply"), button:has-text("Add"), button:has-text("추가")').first();
if (await confirmButton.count() > 0) {
console.log('✅ Found confirm button, clicking...');
await confirmButton.click();
await page.waitForTimeout(2000);
// Now look for order/submit button
console.log('🔍 Looking for order button...');
const orderButton = page.locator('button:has-text("주문"), button:has-text("Order"), button:has-text("Submit")').first();
if (await orderButton.count() > 0) {
console.log('✅ Found order button, clicking...');
await orderButton.click();
await page.waitForTimeout(3000);
// Look for form submission
const form = page.locator('form').first();
if (await form.count() > 0) {
console.log('📋 Found form, attempting to submit...');
// Check if there's a submit button in the form
const submitButton = page.locator('form button[type="submit"], form button:has-text("제출"), form button:has-text("Submit")').first();
if (await submitButton.count() > 0) {
console.log('✅ Found submit button in form, clicking...');
await submitButton.click();
// Wait for potential network requests
console.log('⏳ Waiting for form submission and network requests...');
await page.waitForTimeout(5000);
} else {
console.log('❌ No submit button found in form');
}
} else {
console.log('❌ No form found');
}
} else {
console.log('❌ No order button found');
}
} else {
console.log('❌ No confirm button found');
}
} else {
console.log('❌ No text input found');
}
} else {
console.log('❌ No Add Text button found');
}
// Take a final screenshot
await page.screenshot({ path: 'debug_test_final.png', fullPage: true });
// Print all collected console messages with debug info
console.log('\n📋 ALL CONSOLE MESSAGES:');
console.log('========================');
consoleMessages.forEach((msg, index) => {
console.log(`${index + 1}. [${msg.type}] ${msg.text}`);
});
// Filter for the specific debug messages we're looking for
console.log('\n🔍 SPECIFIC DEBUG MESSAGES:');
console.log('=============================');
const debugMessages = consoleMessages.filter(msg =>
msg.text.includes('🎨') || msg.text.includes('🖼️') || msg.text.includes('📤') ||
msg.text.includes('empty') || msg.text.includes('blob') || msg.text.includes('FormData') ||
msg.text.includes('size:') || msg.text.includes('file')
);
if (debugMessages.length > 0) {
debugMessages.forEach((msg, index) => {
console.log(`${index + 1}. [${msg.type}] ${msg.text}`);
});
} else {
console.log('❌ No specific debug messages found');
}
console.log('\n🏁 Test completed. Keeping browser open for manual inspection...');
console.log('Press Ctrl+C to close the browser and exit.');
// Keep browser open for manual inspection
await page.waitForTimeout(30000);
} catch (error) {
console.error('❌ Test failed:', error);
} finally {
await browser.close();
}
})();