forked from saeloun/miru-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalyze-time-tracking.spec.ts
More file actions
64 lines (50 loc) · 2.73 KB
/
Copy pathanalyze-time-tracking.spec.ts
File metadata and controls
64 lines (50 loc) · 2.73 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
import { test, expect } from '@playwright/test';
test.describe('Time Tracking Page Analysis', () => {
test('analyze weekly and monthly views', async ({ page }) => {
// Login
await page.goto('http://127.0.0.1:3000/test_login');
await page.waitForTimeout(2000);
// Navigate to time tracking
await page.goto('http://127.0.0.1:3000/time-tracking');
await page.waitForLoadState('networkidle');
console.log('=== WEEKLY VIEW ANALYSIS ===');
// Count Add Entry buttons in weekly view
const weeklyAddButtons = await page.locator('button:has-text("Add Entry"), button:has-text("Add")').all();
console.log(`Found ${weeklyAddButtons.length} Add Entry buttons in weekly view`);
for (let i = 0; i < weeklyAddButtons.length; i++) {
const button = weeklyAddButtons[i];
const isVisible = await button.isVisible();
const boundingBox = await button.boundingBox();
console.log(`Button ${i + 1}: Visible=${isVisible}, Size=${boundingBox?.width}x${boundingBox?.height}`);
}
// Take screenshot of weekly view
await page.screenshot({ path: 'weekly-view-current.png' });
// Switch to month view
console.log('\n=== MONTHLY VIEW ANALYSIS ===');
await page.click('button:has-text("Month")');
await page.waitForTimeout(2000);
// Count Add Entry buttons in monthly view
const monthlyAddButtons = await page.locator('button:has-text("Add Entry"), button:has-text("Add")').all();
console.log(`Found ${monthlyAddButtons.length} Add Entry buttons in monthly view`);
// Check if entries are visible on calendar
const calendarEntries = await page.locator('.grid button span:has-text(":")').all();
console.log(`Found ${calendarEntries.length} time entries displayed on calendar`);
// Check for entry listing below calendar
const entryListing = await page.locator('[class*="entry"], [class*="list"]').all();
console.log(`Found ${entryListing.length} entry listing elements below calendar`);
// Take screenshot of monthly view
await page.screenshot({ path: 'monthly-view-current.png' });
// Click on a day with entries
const daysWithEntries = await page.locator('button:has(span:has-text(":"))').all();
if (daysWithEntries.length > 0) {
console.log('\n=== CLICKING ON DAY WITH ENTRIES ===');
await daysWithEntries[0].click();
await page.waitForTimeout(1000);
// Check what happens after clicking
const modal = await page.locator('[role="dialog"], .modal, .popup').first();
const modalVisible = await modal.isVisible();
console.log(`Modal/popup visible after clicking day: ${modalVisible}`);
await page.screenshot({ path: 'after-day-click.png' });
}
});
});