Checking a widget in a real Grist
create-grist-widget check runs the widget's build in a real Grist; verify-release checks a release once it is deployed.
Two commands check what tests can't: the widget in a real Grist, and a
release as people get it. The catalog's widgets go through the same two
on every change. A widget made from the template runs check on its pull
requests into main, and verify-release after each release
(Releasing a widget).
check: the widget in a real Grist
pnpm build
pnpm exec create-grist-widget checkIt starts a real Grist in Docker (a pinned image), makes a document from
the widget's declaration (its demo data from src/app/demo.ts when it has
some, sample rows otherwise), adds the widget with its columns mapped, and
opens it in Chromium. It passes when the widget renders past the SDK's
connecting, mapping and error screens, with no uncaught error. A
screenshot of each run goes to grist-check-output/.
It needs Docker, Playwright and axe-core in the widget's devDependencies
(the template has both; an older widget gets them from upgrade), and
Chromium. Run check from the widget's folder: they are found from the
current directory.
pnpm exec playwright install chromium| Option | What it adds |
|---|---|
--axe | Fails on a serious or critical accessibility violation (axe-core, WCAG 2 A and AA) |
--themes | A second screenshot with the browser in dark mode |
--strict-console | Fails on an error the widget logs to the console |
--standard | The widget at 320 px and 1,280 px without horizontal scrolling; a keyboard path through its controls; the widget unlinked (a linking alert only if it declares requiredLinking); the document read-only (the read-only alert for a widget that writes) |
--baseline <dir> | Compares the build with its last release, pixel by pixel, in each theme: reported, never failed on. <dir> is a checkout of the repository's gh-pages branch (git fetch origin gh-pages, then git worktree add ../pages FETCH_HEAD), and the newest v<version>/ in it is used |
--build | Runs vite build first |
--keep | Leaves Grist running and prints each document's URL |
Pass widget folders to check several at once; with none, it checks the current directory.
verify-release: a release as people get it
pnpm exec create-grist-widget verify-release https://<owner>.github.io/<repo>/v0.3.0/ \
--channel https://<owner>.github.io/<repo>/latest/ --version 0.3.0Once the deploy has run, it checks that:
- the version's folder answers, with every file its page references;
- each
--channelserves the very same build, and its own copies of those files; - with
--version, the release's metadata names that version.
GitHub Pages takes a while to serve a new deploy, so each check is tried
again for up to --wait seconds (300 by default). It exits with 1, and
says what isn't served, when the release still isn't right.