SOURCE / PINNED RELEASE
Made of little things.
Nappakura
- Release
- a75ca0f8b596…
- Author-recorded commit
- 4463126213fa…
- License
- LICENSE
- Author’s source reference
- nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-8db03001b62
Archive hash verified: b448d77b767ae754…. The source-to-build association is the author’s claim; it has not been independently rebuilt.
import assert from 'node:assert/strict';
import { readFile, realpath, mkdir } from 'node:fs/promises';
import { createRequire } from 'node:module';
const require = createRequire(
await realpath(new URL('../node_modules/@napplet/conformance-cli/package.json', import.meta.url)),
);
const { chromium } = require('playwright');
const browser = await chromium.launch({
headless: true,
...(process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE
? { executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE }
: {}),
});
const out = new URL('../.napplet-space/ui-checks/', import.meta.url);
await mkdir(out, { recursive: true });
try {
const html = await readFile(new URL('../dist/index.html', import.meta.url), 'utf8');
const page = await browser.newPage({
viewport: { width: 1000, height: 750 },
});
const errors = [];
page.on('pageerror', (e) => errors.push(e.message));
// This is only a browser test fixture, never a shipped shell or injected SDK.
await page.setContent(
'<iframe title="Missing optional domains" sandbox="allow-scripts" style="width:900px;height:600px;border:0"></iframe>',
);
await page.locator('iframe').evaluate((iframe, source) => (iframe.srcdoc = source), html);
const frame = page.frameLocator('iframe');
await frame.locator('#modelName').waitFor();
assert.equal(await frame.locator('#import').isDisabled(), true);
assert.equal(await frame.locator('#export').isDisabled(), true);
await frame.getByRole('button', { name: 'Tools', exact: true }).click();
assert.equal(await frame.locator('#draftSave').isDisabled(), true);
assert.equal(await frame.locator('#settings').isDisabled(), true);
await frame.getByRole('button', { name: 'Cut edge', exact: true }).click();
assert.match(await frame.locator('#pieceCount').innerText(), /2 pieces/);
await frame.getByRole('button', { name: 'Undo', exact: true }).click();
assert.match(await frame.locator('#pieceCount').innerText(), /1 piece/);
assert.deepEqual(errors, []);
console.log(
'PASS: absent fs/storage/config/theme retains editable example, cut and undo; unavailable actions disabled.',
);
await page.close();
if (process.env.NAPPLET_PREVIEW_URL) {
const hosted = await browser.newPage({
viewport: { width: 1440, height: 1000 },
});
await hosted.goto(process.env.NAPPLET_PREVIEW_URL);
const f = hosted.frameLocator('iframe');
await f.locator('#modelName').waitFor();
await f.getByRole('button', { name: 'Open model', exact: true }).click();
const picker = hosted.getByLabel('Choose files for napplet');
await picker.waitFor({ state: 'visible' });
await picker.setInputFiles(
new URL('../.napplet-space/geometry-test/cube.obj', import.meta.url).pathname,
);
await f.locator('#modelName').filter({ hasText: 'cube.obj' }).waitFor();
assert.equal(await f.locator('#export').isEnabled(), true);
await f.getByRole('button', { name: 'Export PDF', exact: true }).click();
await hosted.getByRole('button', { name: 'Save file', exact: true }).click();
await f.locator('#status').filter({ hasText: 'PDF ready' }).waitFor();
const download = hosted.waitForEvent('download');
await hosted.getByRole('link', { name: 'Download cube.pdf', exact: true }).click();
const target = new URL('host-cube.pdf', out).pathname;
await (await download).saveAs(target);
assert.equal((await readFile(target, 'utf8')).startsWith('%PDF-1.4'), true);
console.log('PASS: hosted OBJ import, paper-aware unfolding and PDF download.');
await hosted.close();
}
} finally {
await browser.close();
}
