Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"doctor": "node bin/papilot.mjs doctor",
"service:install": "tsx scripts/service.ts install",
"service:stop": "tsx scripts/service.ts stop",
"test:ui": "npm run build && node scripts/check-ui.mjs && node scripts/check-task-model.mjs && node scripts/check-appearance.mjs && node scripts/check-updates.mjs && node scripts/check-papers.mjs && node scripts/check-imports.mjs && node scripts/check-compilation.mjs && node scripts/check-build-problems.mjs && node scripts/check-review-notes.mjs && node --import tsx scripts/check-note-groups.mjs && node scripts/check-note-selection.mjs && node scripts/check-ai-review.mjs && node --import tsx scripts/check-note-results.mjs && node --import tsx scripts/check-review-flow.mjs && node scripts/check-skills.mjs && node --import tsx scripts/check-skill-library.mjs && node scripts/check-attachments.mjs && node --import tsx scripts/check-accounts.mjs && node --import tsx scripts/check-places.mjs && node scripts/check-pdf-words.mjs",
"test:ui": "npm run build && node scripts/check-ui.mjs && node scripts/check-task-model.mjs && node scripts/check-appearance.mjs && node scripts/check-updates.mjs && node scripts/check-papers.mjs && node scripts/check-imports.mjs && node scripts/check-compilation.mjs && node scripts/check-build-problems.mjs && node scripts/check-review-notes.mjs && node --import tsx scripts/check-note-groups.mjs && node scripts/check-note-selection.mjs && node scripts/check-paper-questions.mjs && node scripts/check-ai-review.mjs && node --import tsx scripts/check-note-results.mjs && node --import tsx scripts/check-review-flow.mjs && node scripts/check-skills.mjs && node --import tsx scripts/check-skill-library.mjs && node scripts/check-attachments.mjs && node --import tsx scripts/check-accounts.mjs && node --import tsx scripts/check-places.mjs && node scripts/check-pdf-words.mjs",
"site": "node scripts/build-site.mjs",
"test:site": "npm run site && node scripts/check-site.mjs",
"prepack": "npm run build && npm run setup:review",
Expand Down
2 changes: 2 additions & 0 deletions scripts/check-ai-review.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ let releaseRestore, restoreCommitted = false;
const restoreGate = new Promise(resolve => { releaseRestore = resolve; });
const fixturePdf = fs.readFileSync('tests/fixtures/outline.pdf');
await page.route('**/api/**', async route => {
if (new URL(route.request().url()).pathname.endsWith('/question-sessions')) return route.fulfill({ json: { sessions: [{ id: 'default', title: '', createdAt: 1, updatedAt: 1 }] } });
if (new URL(route.request().url()).pathname.endsWith('/questions')) return route.fulfill({ json: { questions: [] } });
const url = new URL(route.request().url()), json = value => route.fulfill({ json: value });
if (url.pathname === '/api/state') return json(state);
if (url.pathname === '/api/updates') return json({ currentVersion: 'test', latestVersion: null, phase: 'idle', checkedAt: 1, error: null, canUpdate: false });
Expand Down
2 changes: 2 additions & 0 deletions scripts/check-appearance.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const task = { id: 'appearance-task', projectId: 'appearance-paper', name: 'p-ap
const runtime = { connected: true, authenticated: true, account: null, error: null, models: [{ id: 'model', name: 'Model', isDefault: true, efforts: ['high'], defaultEffort: 'high' }] };
const snapshot = { version: 'test', csrf: 'fixture', projects: [{ id: task.projectId, name: 'Example paper', path: '/tmp/appearance', createdAt: 1 }], tasks: [task], requests: [], runtime };
await context.route('**/api/**', route => {
if (new URL(route.request().url()).pathname.endsWith('/question-sessions')) return route.fulfill({ json: { sessions: [{ id: 'default', title: '', createdAt: 1, updatedAt: 1 }] } });
if (new URL(route.request().url()).pathname.endsWith('/questions')) return route.fulfill({ json: { questions: [] } });
const url = new URL(route.request().url());
const json = data => route.fulfill({ json: data });
if (url.pathname === '/api/state') return json(snapshot);
Expand Down
2 changes: 2 additions & 0 deletions scripts/check-attachments.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const git = { branch: 'main', upstream: null, ahead: 0, behind: 0, files: [], he
const files = new Map(), items = new Map(), creates = [], messages = [];
let failUpload = false, failCreate = false, failMessage = false;
await page.route('**/api/**', async route => {
if (new URL(route.request().url()).pathname.endsWith('/question-sessions')) return route.fulfill({ json: { sessions: [{ id: 'default', title: '', createdAt: 1, updatedAt: 1 }] } });
if (new URL(route.request().url()).pathname.endsWith('/questions')) return route.fulfill({ json: { questions: [] } });
const request = route.request(), url = new URL(request.url()), json = data => route.fulfill({ json: data });
if (url.pathname === '/api/state') return json(snapshot);
if (url.pathname === '/api/events') return route.fulfill({ contentType: 'text/event-stream', body: ': fixture\n\n' });
Expand Down
2 changes: 2 additions & 0 deletions scripts/check-build-problems.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ async function open(options, { desktop = false } = {}) {
if (desktop) await page.addInitScript(() => { window.papilotDesktop = { platform: 'darwin', minimize() {}, maximize() {}, close() {} }; });
const errors = []; page.on('pageerror', failure => errors.push(failure.message));
await page.route('**/api/**', async route => {
if (new URL(route.request().url()).pathname.endsWith('/question-sessions')) return route.fulfill({ json: { sessions: [{ id: 'default', title: '', createdAt: 1, updatedAt: 1 }] } });
if (new URL(route.request().url()).pathname.endsWith('/questions')) return route.fulfill({ json: { questions: [] } });
const url = new URL(route.request().url()), json = value => route.fulfill({ json: value });
if (url.pathname === '/api/state') return json(snapshot);
if (url.pathname === '/api/updates') return json({ phase: 'idle', currentVersion: 'test', latestVersion: 'test', canUpdate: false });
Expand Down
2 changes: 2 additions & 0 deletions scripts/check-compilation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const annotations = [];
let posts = 0, reads = 0, releaseBuild, heldBuild, failRequest = false, holdRead = false, releaseRead;
function holdNextBuild() { heldBuild = new Promise(resolve => { releaseBuild = resolve; }); }
await page.route('**/api/**', async route => {
if (new URL(route.request().url()).pathname.endsWith('/question-sessions')) return route.fulfill({ json: { sessions: [{ id: 'default', title: '', createdAt: 1, updatedAt: 1 }] } });
if (new URL(route.request().url()).pathname.endsWith('/questions')) return route.fulfill({ json: { questions: [] } });
const url = new URL(route.request().url()), json = value => route.fulfill({ json: value });
if (url.pathname === '/api/state') return json(snapshot);
if (url.pathname === '/api/updates') return json({ phase: 'idle', currentVersion: 'test', latestVersion: 'test', canUpdate: false });
Expand Down
2 changes: 2 additions & 0 deletions scripts/check-imports.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ fs.mkdirSync('test-results', { recursive: true });
try {
const context = await browser.newContext({ locale: 'en-US', viewport: { width: 1280, height: 850 } });
await context.route('**/api/**', route => {
if (new URL(route.request().url()).pathname.endsWith('/question-sessions')) return route.fulfill({ json: { sessions: [{ id: 'default', title: '', createdAt: 1, updatedAt: 1 }] } });
if (new URL(route.request().url()).pathname.endsWith('/questions')) return route.fulfill({ json: { questions: [] } });
const url = new URL(route.request().url()), method = route.request().method();
if (url.pathname.startsWith('/api/imports')) {
const body = method === 'POST' ? route.request().postDataJSON() : null; requests.push({ route: url.pathname, body });
Expand Down
2 changes: 2 additions & 0 deletions scripts/check-locales.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ try {
const page = await context.newPage();
page.on('pageerror', error => failures.push(error.message));
await page.route('**/api/**', route => {
if (new URL(route.request().url()).pathname.endsWith('/question-sessions')) return route.fulfill({ json: { sessions: [{ id: 'default', title: '', createdAt: 1, updatedAt: 1 }] } });
if (new URL(route.request().url()).pathname.endsWith('/questions')) return route.fulfill({ json: { questions: [] } });
const pathname = new URL(route.request().url()).pathname;
if (pathname === '/api/state') return route.fulfill({ json: snapshot });
if (pathname === '/api/events') return route.fulfill({ contentType: 'text/event-stream', body: ': fixture\n\n' });
Expand Down
2 changes: 2 additions & 0 deletions scripts/check-note-groups.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const git = { branch: 'main', files: [] };
let notes = [], deleted = [], serial = 0;
const requests = [], items = new Map();
const routeApi = async route => {
if (new URL(route.request().url()).pathname.endsWith('/question-sessions')) return route.fulfill({ json: { sessions: [{ id: 'default', title: '', createdAt: 1, updatedAt: 1 }] } });
if (new URL(route.request().url()).pathname.endsWith('/questions')) return route.fulfill({ json: { questions: [] } });
const url = new URL(route.request().url()), json = value => route.fulfill({ json: value });
if (url.pathname === '/api/updates') return route.fulfill({ json: { currentVersion: snapshot.version, latestVersion: null, phase: 'idle', checkedAt: 1, error: null, canUpdate: true } });
if (url.pathname === '/api/state') return json(snapshot);
Expand Down
2 changes: 2 additions & 0 deletions scripts/check-note-results.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const decisions = { 1: { c1: 'pending', c2: 'rejected' }, 2: { c1: 'pending' } }
const client = { get: async route => route.includes('/rounds/') ? rounds[Number(route.split('/').at(-1))] : { decisions: decisions[Number(new URL(route, origin).searchParams.get('round'))] } };
let failResults = true;
await page.route('**/api/**', async route => {
if (new URL(route.request().url()).pathname.endsWith('/question-sessions')) return route.fulfill({ json: { sessions: [{ id: 'default', title: '', createdAt: 1, updatedAt: 1 }] } });
if (new URL(route.request().url()).pathname.endsWith('/questions')) return route.fulfill({ json: { questions: [] } });
const url = new URL(route.request().url());
if (url.pathname.startsWith('/review/')) return route.fallback();
if (url.pathname === '/api/updates') return route.fulfill({ json: { currentVersion: snapshot.version, latestVersion: null, phase: 'idle', checkedAt: 1, error: null, canUpdate: true } });
Expand Down
4 changes: 3 additions & 1 deletion scripts/check-note-selection.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ let fail = false, hold = false, release, failEdit = false;
await page.route('**/api/**', async route => {
const url = new URL(route.request().url()), json = value => route.fulfill({ json: value });
if (url.pathname === '/api/state') return json(snapshot);
if (url.pathname.endsWith('/question-sessions')) return json({ sessions: [{ id: 'default', title: '', createdAt: 1, updatedAt: 1 }] });
if (url.pathname.endsWith('/questions')) return json({ questions: [] });
if (url.pathname === '/api/updates') return json({ currentVersion: 'test', latestVersion: null, phase: 'idle', checkedAt: 1, error: null, canUpdate: false });
if (url.pathname.endsWith('/events')) return route.fulfill({ contentType: 'text/event-stream', body: ': fixture\n\n' });
if (url.pathname.endsWith('/skills')) return json({ skills: [] });
Expand Down Expand Up @@ -278,7 +280,7 @@ try {
await setSelection(check('n2'), true); await setSelection(check('n4'), true);
await expect(instruction('Yellow')).toHaveValue('Explain the reasoning step by step.');
await expect(instruction('Purple')).toHaveValue('Shorten this wording.');
await page.getByRole('button', { name: 'Agent settings', exact: true }).click();
await page.locator('.new-task-panel').getByRole('button', { name: 'Agent settings', exact: true }).click();
await page.getByRole('option', { name: / · Claude$/ }).first().click();
await page.keyboard.press('Escape');
await expect(prompt()).toHaveValue('');
Expand Down
Loading