sync: update from private repo (2336949a)
CI / build-and-test (push) Canceled after 0s

This commit is contained in:
oss-sync
2026-09-17 11:29:31 +00:00
parent 28f74c4e37
commit 57702b4f34
2139 changed files with 321270 additions and 17494 deletions
+66 -1
View File
@@ -1,4 +1,7 @@
import { test, expect, type Page } from '@playwright/test';
import Database from 'better-sqlite3';
import { resolve } from 'node:path';
import { openSpaceTab } from './helpers/spaceTabs';
// E2E smoke for the V2 cross-space calendar (top-bar "カレンダー" tab).
//
@@ -45,6 +48,34 @@ function e2eLocalToday(): string {
return `${d.getFullYear()}-${mm}-${dd}`;
}
const ADJACENT_MONTH_CLOCK = new Date('2026-07-15T12:00:00.000Z');
const ADJACENT_MONTH_FIRST = '2026-06-28';
const ADJACENT_MONTH_LAST = '2026-08-08';
async function seedTaskDate(page: Page, spaceId: string, date: string, body: string): Promise<number> {
const created = await page.request.post('/api/local/tasks', {
data: { body, piece: 'chat', spaceId, workspaceMode: 'persistent' },
});
expect(created.ok()).toBeTruthy();
const taskId = (await created.json()).task.id as number;
const e2eTmp = process.env.E2E_TMP;
if (!e2eTmp) throw new Error('E2E_TMP must be set by playwright.config.ts');
const db = new Database(resolve(e2eTmp, 'e2e.db'));
db.pragma('busy_timeout = 8000');
db.prepare('UPDATE local_tasks SET created_at = ?, updated_at = ? WHERE id = ?')
.run(`${date}T12:00:00.000Z`, `${date}T12:00:00.000Z`, taskId);
db.close();
return taskId;
}
async function seedEvent(page: Page, spaceId: string, date: string, title: string, endDate?: string): Promise<number> {
const created = await page.request.post(`/api/local/spaces/${spaceId}/calendar/events`, {
data: { date, end_date: endDate, title },
});
expect(created.ok()).toBeTruthy();
return (await created.json()).id as number;
}
async function createAndOpenCaseSpace(page: Page, label: string) {
await page.goto('/ui');
await page.getByTestId('nav-spaces').click();
@@ -72,7 +103,7 @@ async function createAndOpenCaseSpace(page: Page, label: string) {
/** Add an event for today in the currently-open space's calendar tab. */
async function addTodayEvent(page: Page, title: string) {
await page.getByTestId('space-tab-calendar').click();
await openSpaceTab(page, 'calendar');
await expect(page.getByTestId('space-cal-grid')).toBeVisible();
const today = e2eLocalToday();
await page.getByTestId(`space-cal-day-${today}`).click();
@@ -144,3 +175,37 @@ test('cross calendar: a space with activity shows its dot + day panel groups by
expect(fatalErrors, `fatal errors:\n${fatalErrors.join('\n')}`).toEqual([]);
});
test('cross calendar: adjacent month days show badges, details, and spanning bars', async ({ page }) => {
const fatalErrors = trackFatalErrors(page);
await page.clock.setFixedTime(ADJACENT_MONTH_CLOCK);
const { caseTitle, spaceId } = await createAndOpenCaseSpace(page, 'E2E横断隣接月');
const first = ADJACENT_MONTH_FIRST;
const last = ADJACENT_MONTH_LAST;
const firstTaskId = await seedTaskDate(page, spaceId, first, `横断先頭タスク-${Date.now()}`);
const lastTaskId = await seedTaskDate(page, spaceId, last, `横断末尾タスク-${Date.now()}`);
const firstEvent = `横断先頭予定-${Date.now()}`;
const lastEvent = `横断末尾予定-${Date.now()}`;
await seedEvent(page, spaceId, first, firstEvent);
await seedEvent(page, spaceId, last, lastEvent);
const spanningEvent = `横断両境界予定-${Date.now()}`;
const spanningId = await seedEvent(page, spaceId, first, spanningEvent, last);
await page.getByTestId('nav-calendar').click();
const firstCell = page.getByTestId(`cross-cal-day-${first}`);
const lastCell = page.getByTestId(`cross-cal-day-${last}`);
await expect(firstCell.getByTestId(`cross-cal-dot-${spaceId}`)).toHaveAttribute('title', /タスク.*1.*予定.*2/);
await expect(lastCell.getByTestId(`cross-cal-dot-${spaceId}`)).toHaveAttribute('title', /タスク.*1.*予定.*2/);
await expect(page.getByTestId(`cross-cal-bar-${spanningId}`)).toHaveCount(6);
await firstCell.click();
let group = page.getByTestId(`cross-cal-space-${spaceId}`);
await expect(group.getByText(caseTitle, { exact: true })).toBeVisible();
await expect(group.getByTestId(`cross-cal-task-${firstTaskId}`)).toBeVisible();
await expect(group.getByText(firstEvent, { exact: true })).toBeVisible();
await expect(group.getByText(spanningEvent, { exact: true })).toBeVisible();
await lastCell.click();
group = page.getByTestId(`cross-cal-space-${spaceId}`);
await expect(group.getByTestId(`cross-cal-task-${lastTaskId}`)).toBeVisible();
await expect(group.getByText(lastEvent, { exact: true })).toBeVisible();
await expect(group.getByText(spanningEvent, { exact: true })).toBeVisible();
expect(fatalErrors, `fatal errors:\n${fatalErrors.join('\n')}`).toEqual([]);
});