-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd-entries-visible.js
More file actions
executable file
·273 lines (228 loc) · 10.1 KB
/
Copy pathadd-entries-visible.js
File metadata and controls
executable file
·273 lines (228 loc) · 10.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
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
#!/usr/bin/env node
/**
* HomeFlow Pro - Visible Entry Addition
* Watch as entries are added one by one
*/
import puppeteer from 'puppeteer';
const APP_URL = 'https://homeflow-pro-1760475179.web.app';
const TEST_EMAIL = 'demo@homeflowpro.com';
const TEST_PASSWORD = 'HomeFlow2025!';
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
async function addEntriesVisibly() {
console.log('\n🏠 HomeFlow Pro - Visible Entry Addition');
console.log('==========================================');
console.log('Watch the browser window as entries are added!\n');
console.log('Opening browser in 3 seconds...\n');
await sleep(3000);
const browser = await puppeteer.launch({
headless: false, // Show the browser so you can watch!
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--start-maximized'
],
defaultViewport: null
});
const page = await browser.newPage();
try {
console.log('📝 Step 1: Loading application...');
await page.goto(APP_URL, { waitUntil: 'networkidle2', timeout: 30000 });
await sleep(2000);
console.log('📝 Step 2: Loading test credentials...');
await sleep(1000);
try {
const loadButton = await page.waitForSelector('button::-p-text(Load Test Credentials)', { timeout: 5000 });
await loadButton.click();
console.log(' ✓ Test credentials loaded');
await sleep(1500);
} catch (e) {
console.log(' ℹ Manual entry mode');
await page.type('input[type="email"]', TEST_EMAIL);
await page.type('input[type="password"]', TEST_PASSWORD);
}
console.log('📝 Step 3: Signing in...');
const signInButton = await page.waitForSelector('button[type="submit"]');
await signInButton.click();
await sleep(4000);
console.log(' ✅ Logged in successfully!\n');
// === ADD TASK ===
console.log('📝 Step 4: Adding a TASK...');
const tasksButton = await page.waitForSelector('button::-p-text(Tasks)');
await tasksButton.click();
console.log(' ✓ Navigated to Tasks');
await sleep(2000);
const addTaskButton = await page.waitForSelector('button::-p-text(Add Task)');
await addTaskButton.click();
console.log(' ✓ Opened Add Task modal');
await sleep(1500);
// Type task details slowly so you can see
const taskTitle = 'Clean the garage this weekend';
console.log(` ✓ Typing: "${taskTitle}"`);
await page.type('input[type="text"]', taskTitle, { delay: 50 });
await sleep(1000);
const taskDesc = 'Organize tools and donate old items';
console.log(` ✓ Typing description: "${taskDesc}"`);
const textarea = await page.$('textarea');
if (textarea) {
await textarea.type(taskDesc, { delay: 50 });
}
await sleep(1000);
console.log(' ✓ Submitting task...');
const submitTaskButton = await page.waitForSelector('button::-p-text(Add Task)');
await submitTaskButton.click();
await sleep(3000);
console.log(' ✅ TASK CREATED! Check the UI!\n');
await sleep(2000);
// === ADD SHOPPING ITEM ===
console.log('📝 Step 5: Adding a SHOPPING ITEM...');
const shoppingButton = await page.waitForSelector('button::-p-text(Shopping)');
await shoppingButton.click();
console.log(' ✓ Navigated to Shopping Lists');
await sleep(2000);
const addItemButton = await page.waitForSelector('button::-p-text(Add Item)');
await addItemButton.click();
console.log(' ✓ Opened Add Item modal');
await sleep(1500);
const itemName = 'Fresh Strawberries';
console.log(` ✓ Typing: "${itemName}"`);
const nameInput = await page.$('input[type="text"]');
await nameInput.type(itemName, { delay: 50 });
await sleep(1000);
console.log(' ✓ Setting quantity to 2...');
const quantityInput = await page.$('input[type="number"]');
if (quantityInput) {
await quantityInput.click({ clickCount: 3 });
await quantityInput.type('2', { delay: 100 });
}
await sleep(1000);
console.log(' ✓ Submitting shopping item...');
const submitItemButton = await page.waitForSelector('button::-p-text(Add Item)');
await submitItemButton.click();
await sleep(3000);
console.log(' ✅ SHOPPING ITEM CREATED! Check the UI!\n');
await sleep(2000);
// === ADD CALENDAR EVENT ===
console.log('📝 Step 6: Adding a CALENDAR EVENT...');
const calendarButton = await page.waitForSelector('button::-p-text(Calendar)');
await calendarButton.click();
console.log(' ✓ Navigated to Calendar');
await sleep(2000);
const addEventButton = await page.waitForSelector('button::-p-text(Add Event)');
await addEventButton.click();
console.log(' ✓ Opened Add Event modal');
await sleep(1500);
const eventTitle = 'Birthday Party';
console.log(` ✓ Typing: "${eventTitle}"`);
const eventInput = await page.$('input[type="text"]');
await eventInput.type(eventTitle, { delay: 50 });
await sleep(1000);
console.log(' ✓ Submitting event...');
const submitEventButton = await page.waitForSelector('button::-p-text(Add Event)');
await submitEventButton.click();
await sleep(3000);
console.log(' ✅ EVENT CREATED! Check the UI!\n');
await sleep(2000);
// === ADD FAMILY MEMBER ===
console.log('📝 Step 7: Adding a FAMILY MEMBER...');
const familyButton = await page.waitForSelector('button::-p-text(Family)');
await familyButton.click();
console.log(' ✓ Navigated to Family Members');
await sleep(2000);
const addFamilyButton = await page.waitForSelector('button::-p-text(Add New)');
await addFamilyButton.click();
console.log(' ✓ Opened Add Family Member modal');
await sleep(1500);
const memberName = 'Grandma Betty';
console.log(` ✓ Typing: "${memberName}"`);
const memberInput = await page.$('input[type="text"]');
await memberInput.type(memberName, { delay: 50 });
await sleep(1000);
console.log(' ✓ Submitting family member...');
const submitFamilyButton = await page.waitForSelector('button::-p-text(Add)');
await submitFamilyButton.click();
await sleep(3000);
console.log(' ✅ FAMILY MEMBER CREATED! Check the UI!\n');
await sleep(2000);
// === ADD NOTE ===
console.log('📝 Step 8: Adding a NOTE...');
const notesButton = await page.waitForSelector('button::-p-text(Note)');
await notesButton.click();
console.log(' ✓ Navigated to Notes');
await sleep(2000);
const addNoteButton = await page.waitForSelector('button::-p-text(Add New)');
await addNoteButton.click();
console.log(' ✓ Opened Add Note modal');
await sleep(1500);
const noteTitle = 'Weekend Project Ideas';
console.log(` ✓ Typing title: "${noteTitle}"`);
const noteTitleInput = await page.$('input[type="text"]');
await noteTitleInput.type(noteTitle, { delay: 50 });
await sleep(1000);
const noteContent = 'Paint the fence, fix the gate, plant flowers in the garden';
console.log(` ✓ Typing content: "${noteContent}"`);
const noteTextarea = await page.$('textarea');
if (noteTextarea) {
await noteTextarea.type(noteContent, { delay: 40 });
}
await sleep(1000);
console.log(' ✓ Submitting note...');
const submitNoteButton = await page.waitForSelector('button::-p-text(Add)');
await submitNoteButton.click();
await sleep(3000);
console.log(' ✅ NOTE CREATED! Check the UI!\n');
await sleep(2000);
// === ADD GOAL ===
console.log('📝 Step 9: Adding a GOAL...');
const goalsButton = await page.waitForSelector('button::-p-text(Goal)');
await goalsButton.click();
console.log(' ✓ Navigated to Goals');
await sleep(2000);
const addGoalButton = await page.waitForSelector('button::-p-text(Add New)');
await addGoalButton.click();
console.log(' ✓ Opened Add Goal modal');
await sleep(1500);
const goalTitle = 'Learn to play guitar';
console.log(` ✓ Typing: "${goalTitle}"`);
const goalInput = await page.$('input[type="text"]');
await goalInput.type(goalTitle, { delay: 50 });
await sleep(1000);
console.log(' ✓ Submitting goal...');
const submitGoalButton = await page.waitForSelector('button::-p-text(Add)');
await submitGoalButton.click();
await sleep(3000);
console.log(' ✅ GOAL CREATED! Check the UI!\n');
await sleep(2000);
// Go back to Dashboard to see updated stats
console.log('📝 Step 10: Returning to Dashboard...');
const dashboardButton = await page.waitForSelector('button::-p-text(Dashboard)');
await dashboardButton.click();
await sleep(3000);
console.log(' ✅ Dashboard loaded with updated stats!\n');
console.log('='.repeat(60));
console.log('✅ ALL ENTRIES ADDED SUCCESSFULLY!');
console.log('='.repeat(60));
console.log('\n📊 Summary of what was created:');
console.log(' ✅ 1 Task: "Clean the garage this weekend"');
console.log(' ✅ 1 Shopping Item: "Fresh Strawberries" (Qty: 2)');
console.log(' ✅ 1 Calendar Event: "Birthday Party"');
console.log(' ✅ 1 Family Member: "Grandma Betty"');
console.log(' ✅ 1 Note: "Weekend Project Ideas"');
console.log(' ✅ 1 Goal: "Learn to play guitar"');
console.log('\n🎯 Total new entries: 6');
console.log('\n💡 You should see these entries in the app now!');
console.log(' The browser window will stay open for you to verify.\n');
console.log('🌐 App URL: https://homeflow-pro-1760475179.web.app');
console.log('\nPress Ctrl+C to close when done viewing.\n');
// Keep browser open so user can verify
await sleep(60000 * 5); // Keep open for 5 minutes
} catch (error) {
console.error('\n❌ Error:', error.message);
console.log('\n📸 Taking screenshot of error state...');
await page.screenshot({ path: 'error-state.png' });
console.log(' Saved to: error-state.png\n');
} finally {
// Don't close automatically - let user close
console.log('Browser will close automatically or press Ctrl+C to close now.');
}
}
addEntriesVisibly().catch(console.error);