feat: add Astro reference site and organize book contents
Reference site / build (push) Canceled after 0s

This commit is contained in:
2026-10-09 23:40:37 +09:00
parent 6086f3c5ef
commit 01c9498e6d
39 changed files with 7772 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import { expect, test } from '@playwright/test';
test('home and book are usable without client JavaScript', async ({ page }, testInfo) => {
const failures: string[] = [];
page.on('response', (response) => { if (response.status() >= 400) failures.push(response.url()); });
await page.goto('./');
await expect(page.getByRole('heading', { level: 1 })).toContainText('探索できる世界へ');
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);
await page.screenshot({ path: testInfo.outputPath('home.png'), fullPage: true });
await page.getByRole('link', { name: 'Book', exact: true }).click();
await expect(page.getByRole('heading', { level: 1 })).toContainText('通信の約束まで');
await page.getByRole('link', { name: '第1章から読む' }).click();
await expect(page.getByRole('heading', { level: 1 })).toHaveText('1. コンセプト');
if (testInfo.project.name === 'mobile') {
await page.locator('.mobile-chapters summary').click();
await page.locator('.mobile-chapters').getByRole('link', { name: '3. Protocol', exact: true }).click();
} else {
await page.locator('.sidebar').getByRole('link', { name: '3. Protocol', exact: true }).click();
}
await expect(page.getByRole('heading', { level: 1 })).toHaveText('3. Protocol');
await page.screenshot({ path: testInfo.outputPath('book.png'), fullPage: false });
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);
// Cross-chapter Japanese fragment links must reach the matching heading.
await page.locator('article').getByRole('link', { name: '4.2. Text View' }).first().click();
await expect(page.getByRole('heading', { level: 1 })).toHaveText('4.2. Text View');
await expect(page).toHaveURL(/4\.2-text-view\/#/);
await page.goto('book/draft/filesystem-discovery/');
await expect(page.locator('.draft-notice')).toContainText('Draft');
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);
expect(failures).toEqual([]);
});