Skip to content

Running the editor's own pipeline ​

This page is about the pipeline of the editor repository — the application, not a website built with it. For the pipeline a cratly website needs, see the pipeline reference and the setup guide.

The editor is an npm project: package-lock.json is the lock of record, and CI installs with npm ci.

End-to-end tests ​

The Playwright suite drives the editor against a real GitLab instance and a repository kept for that purpose. Locally it reads its credentials from .env.test.local at the project root.

VariableExampleWhat it is
TEST_GITLAB_URLhttps://git.example.comInstance the tests work against
TEST_GITLAB_TOKENglpat-…Access token with api scope on the test repository
TEST_REPO_PATHsites/cratly-test-websiteNamespace and project path of that repository
TEST_REPO_ID238Numeric project ID
TEST_REPO_BRANCHmainIts default branch

In CI the same names come from the project's CI/CD variables. The token belongs to the sandbox repository alone and is deliberately unprotected, so merge-request pipelines from feature branches can run the suite too; its blast radius is that one throwaway project.

.env.test.local.example in the repository names the variables; copy it to .env.test.local and fill it in. That copy is gitignored and therefore never appears in a file listing.

A run creates a branch, a commit and a merge request in the sandbox repository per test and removes them afterwards. The default branch is never written to, so every run starts from the same state. An interrupted run leaves its branch and merge request behind:

sh
glab api -R <host>/<group>/<test-repo> "projects/:id/repository/branches?per_page=100"

Preview origin ​

The editor opens previews on a separate origin so a previewed site cannot reach the editor's storage. In CI and locally that is derived from the dev server's own port — modern Linux kernels resolve *.localhost to the loopback address, so http://preview.localhost:5174 works without configuration.

Where an environment does not resolve *.localhost, set VITE_PREVIEW_ORIGIN explicitly. See Preview → Preview origin.

Deployment ​

The editor is published to S3-compatible storage, the same way this documentation site is.

VariableWhat it is
S3_ENDPOINTService endpoint URL
S3_REGIONRegion the storage signs requests for — for Garage the s3_region in garage.toml
S3_ACCESS_KEY, S3_SECRET_KEYCredentials with write access to the bucket
S3_BUCKETBucket name, without the s3:// prefix
S3_PREFIXKey prefix for the application itself
S3_PREVIEW_PREFIXKey prefix the preview origin is served from

Both prefixes matter: the bucket holds one folder per subdomain, so syncing to its root would prune the siblings.

Running the tests locally ​

sh
cp .env.test.local.example .env.test.local   # then fill it in
npm run test:unit
npx playwright test --reporter=line

Use the line reporter unless you are watching: the configured default is the HTML reporter, which serves its report when the run ends and blocks. A run whose output never arrives is usually that.