Four user-reported items:
1. landing: remove the standalone-tool strip from the site picker.
Per user, it was awkward — links pointing at zddc.varasys.io
releases from inside a deployment is a layering confusion. The
nav.tool-strip block in landing/template.html and its CSS are
gone.
2. zddc-server: route /Project/archive/<party>/mdl[/] to the tables
app for the virtual-MDL case where the on-disk folder doesn't
exist yet. Previously fell through to 404 because the dispatcher
only routed virtual mdl/ via the IsDir branch — the IsNotExist
branch was missing the equivalent check. Now both shapes (with
and without trailing slash) hit RecognizeTableRequest's default-
MDL fallback and ServeTable serves the embedded tables.html.
3. browse: re-layout the markdown editor to mirror mdedit's layout.
Was: sidebar on right with TOC top + front-matter bottom.
Now: sidebar on LEFT with YAML front matter top + Outline bottom,
content on RIGHT with an informational header (file title +
save controls + status + source) above the Toast UI editor.
New horizontal resizer between the front-matter and outline
sections inside the sidebar (drag the row boundary; arrow keys
step by 24 px). Browse test selectors updated.
4. zddc-server reviewing aggregator: extend to depth ≥ 2 so the
user can preview files inside virtual reviewing/<tracking>/
received/ and staged/ folders. IsReviewingPath now returns a
sidePath ("received[/rest]" or "staged[/rest]"); ServeReviewing's
depth-2 branch proxies the underlying real folder's listing,
emitting folder entries with virtual reviewing/ URLs (so
navigation stays in the aggregator) and file entries with
canonical archive/ or staging/ URLs (so byte fetches resolve
directly). ACL is enforced against the real path; depth-1
received/ + staged/ URLs are now virtual too (was canonical),
so the user smoothly descends into the depth-2 listing.
Tests updated for the new IsReviewingPath signature and the depth-1
URL shape.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
108 lines
4.9 KiB
JavaScript
108 lines
4.9 KiB
JavaScript
import { test, expect } from '@playwright/test';
|
|
import { MOCK_FS_INIT_SCRIPT } from './fixtures/mock-fs-api.js';
|
|
import * as path from 'path';
|
|
|
|
const HTML_PATH = path.resolve('browse/dist/browse.html');
|
|
|
|
test.describe('Browse', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.addInitScript(MOCK_FS_INIT_SCRIPT);
|
|
});
|
|
|
|
test('loads with the empty state visible and add-directory button enabled', async ({ page }) => {
|
|
await page.goto(`file://${HTML_PATH}`, { waitUntil: 'load' });
|
|
await page.waitForSelector('#addDirectoryBtn', { timeout: 15000 });
|
|
|
|
// file:// + no auto-server-root → the empty state is shown and the
|
|
// browse table stays hidden until the user picks a directory.
|
|
await expect(page.locator('#emptyState')).toBeVisible();
|
|
await expect(page.locator('#browseRoot')).toBeHidden();
|
|
|
|
const addDirBtn = page.locator('#addDirectoryBtn');
|
|
await expect(addDirBtn).toBeVisible();
|
|
await expect(addDirBtn).not.toBeDisabled();
|
|
});
|
|
|
|
test('renders rows from a mock directory after picking', async ({ page }) => {
|
|
await page.goto(`file://${HTML_PATH}`, { waitUntil: 'load' });
|
|
await page.waitForSelector('#addDirectoryBtn', { timeout: 15000 });
|
|
|
|
await page.evaluate(() => {
|
|
window.__setMockDirectory('docs', [
|
|
{ name: 'spec.pdf', content: '%PDF-fixture', size: 1024 },
|
|
{ name: 'readme.md', content: '# Hello\n', size: 8 },
|
|
{ name: 'notes.txt', content: 'note one\nnote two\n', size: 16 },
|
|
]);
|
|
});
|
|
|
|
await page.locator('#addDirectoryBtn').click();
|
|
|
|
// Browse swaps from empty state to the two-pane layout. The
|
|
// tree pane is on the left; rows are <div class="tree-row">.
|
|
await page.waitForSelector('#browseRoot:not(.hidden)', { timeout: 10000 });
|
|
await page.waitForFunction(
|
|
() => document.querySelectorAll('#treeBody .tree-row').length >= 3,
|
|
{ timeout: 10000 }
|
|
);
|
|
|
|
const rows = await page.locator('#treeBody .tree-row').count();
|
|
expect(rows).toBeGreaterThanOrEqual(3);
|
|
|
|
// Right preview pane is present and starts in the empty state.
|
|
await expect(page.locator('#previewPane')).toBeVisible();
|
|
await expect(page.locator('#previewBody')).toContainText(/Click a file/);
|
|
});
|
|
|
|
test('clicking a file shows it in the preview pane', async ({ page }) => {
|
|
await page.goto(`file://${HTML_PATH}`, { waitUntil: 'load' });
|
|
await page.waitForSelector('#addDirectoryBtn', { timeout: 15000 });
|
|
|
|
await page.evaluate(() => {
|
|
window.__setMockDirectory('docs', [
|
|
{ name: 'notes.txt', content: 'hello world', size: 11 },
|
|
]);
|
|
});
|
|
await page.locator('#addDirectoryBtn').click();
|
|
await page.waitForSelector('#treeBody .tree-row', { timeout: 10000 });
|
|
|
|
// Click the file row.
|
|
await page.locator('#treeBody .tree-row[data-isdir="false"]').first().click();
|
|
|
|
// Preview title updates to the file name; pop-out button appears.
|
|
await expect(page.locator('#previewTitle')).toHaveText(/notes\.txt/);
|
|
await expect(page.locator('#previewPopout')).toBeVisible();
|
|
});
|
|
|
|
test('clicking a .md file mounts the markdown editor with a TOC', async ({ page }) => {
|
|
await page.goto(`file://${HTML_PATH}`, { waitUntil: 'load' });
|
|
await page.waitForSelector('#addDirectoryBtn', { timeout: 15000 });
|
|
|
|
await page.evaluate(() => {
|
|
window.__setMockDirectory('notes', [
|
|
{
|
|
name: 'readme.md',
|
|
content: '# Title\n\nIntro.\n\n## Section One\n\nText.\n\n### Subsection\n\nDeeper.',
|
|
size: 100,
|
|
},
|
|
]);
|
|
});
|
|
await page.locator('#addDirectoryBtn').click();
|
|
await page.waitForSelector('#treeBody .tree-row[data-isdir="false"]', { timeout: 10000 });
|
|
await page.locator('#treeBody .tree-row[data-isdir="false"]').first().click();
|
|
|
|
// Markdown plugin DOM mounts: shell, sidebar (front matter +
|
|
// TOC), content (info header + editor).
|
|
await expect(page.locator('.md-shell')).toBeVisible({ timeout: 15000 });
|
|
await expect(page.locator('.md-shell__sidebar')).toBeVisible();
|
|
await expect(page.locator('.md-shell__infohdr')).toBeVisible();
|
|
await expect(page.locator('.md-shell__editor')).toBeVisible();
|
|
|
|
// Outline lists the three headings.
|
|
await page.waitForSelector('.md-toc__list .md-toc__item', { timeout: 10000 });
|
|
const tocItems = await page.locator('.md-toc__list .md-toc__item').allTextContents();
|
|
expect(tocItems).toEqual(['Title', 'Section One', 'Subsection']);
|
|
|
|
// Source hint reflects local FS-API mode.
|
|
await expect(page.locator('.md-shell__source')).toHaveText(/local/i);
|
|
});
|
|
});
|