2025-12-03 17:16:14 +01:00
|
|
|
// wxCalendarCtrl Tests - Date selection
|
2026-07-07 10:50:24 +02:00
|
|
|
import { test, expect, waitForWxApp } from './utils/fixtures';
|
|
|
|
|
import { clickByLabel, clickCalendarDate, stableShot } from './utils/element-tracker';
|
2025-12-03 17:16:14 +01:00
|
|
|
|
|
|
|
|
test.describe('wxCalendarCtrl Tests', () => {
|
|
|
|
|
|
|
|
|
|
test('Calendar test app loads successfully', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/calendar/calendar_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:16:14 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'calendar-01-loaded.png', { fullPage: true });
|
2025-12-03 17:16:14 +01:00
|
|
|
|
|
|
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Calendar dates can be selected', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/calendar/calendar_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:16:14 +01:00
|
|
|
|
2025-12-30 14:17:51 +01:00
|
|
|
// Click on day 15 in the calendar using element registry
|
|
|
|
|
const clicked = await clickCalendarDate(page, 15);
|
|
|
|
|
expect(clicked, 'Calendar date 15 should be found and clicked').toBe(true);
|
2025-12-03 17:16:14 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'calendar-02-select-date.png', { fullPage: true });
|
2025-12-03 17:16:14 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Calendar can navigate to next month', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/calendar/calendar_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:16:14 +01:00
|
|
|
|
2025-12-30 14:17:51 +01:00
|
|
|
// Click Next Month button using element registry
|
|
|
|
|
const clicked = await clickByLabel(page, 'Next Month');
|
|
|
|
|
expect(clicked, 'Next Month button should be found').toBe(true);
|
2025-12-03 17:16:14 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'calendar-03-next-month.png', { fullPage: true });
|
2025-12-03 17:16:14 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Calendar can navigate to previous month', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/calendar/calendar_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:16:14 +01:00
|
|
|
|
2025-12-30 14:17:51 +01:00
|
|
|
// Click Previous Month button using element registry
|
|
|
|
|
const clicked = await clickByLabel(page, 'Previous Month');
|
|
|
|
|
expect(clicked, 'Previous Month button should be found').toBe(true);
|
2025-12-03 17:16:14 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'calendar-04-prev-month.png', { fullPage: true });
|
2025-12-03 17:16:14 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Calendar can navigate to today', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/calendar/calendar_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:16:14 +01:00
|
|
|
|
2025-12-30 14:17:51 +01:00
|
|
|
// First go to next month
|
|
|
|
|
const nextClicked = await clickByLabel(page, 'Next Month');
|
|
|
|
|
expect(nextClicked, 'Next Month button should be found').toBe(true);
|
|
|
|
|
|
|
|
|
|
// Click Today button using element registry
|
|
|
|
|
const todayClicked = await clickByLabel(page, 'Today');
|
|
|
|
|
expect(todayClicked, 'Today button should be found').toBe(true);
|
2025-12-03 17:16:14 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'calendar-05-today.png', { fullPage: true });
|
2025-12-03 17:16:14 +01:00
|
|
|
});
|
|
|
|
|
});
|