@devant-net/playwright-reporter
v0.2.1
Published
Playwright Reporter that streams runs, results, steps, and artifacts into devq-cloud.
Maintainers
Readme
@devant-net/playwright-reporter
Playwright Reporter that streams runs, results, steps, and artifacts into Devant Cloud.
Install
npm add -D @devant-net/playwright-reporter @playwright/test
# or
bun add -D @devant-net/playwright-reporter @playwright/testConfigure
In your playwright.config.ts:
import { defineConfig } from "@playwright/test";
export default defineConfig({
use: {
trace: "on",
screenshot: "only-on-failure",
video: "retain-on-failure",
},
reporter: [
["list"],
["@devant-net/playwright-reporter"],
],
});Option A — inline options (takes precedence over env vars)
reporter: [
["@devant-net/playwright-reporter", {
apiUrl: "https://your-tenant.devant.net",
apiToken: process.env.DEVANT_CLOUD_TOKEN,
projectId: 1,
runName: `PR ${process.env.GITHUB_PR}`,
}],
],Option B — env vars (recommended for CI)
| Var | Default | Notes |
|---|---|---|
| DEVANT_CLOUD_API_URL | http://localhost:32124 | Your tenant's base URL |
| DEVANT_CLOUD_TOKEN | dev-admin-token | Bearer token — Settings → CI/CD |
| DEVANT_CLOUD_PROJECT_ID | 1 | Devant Cloud project id |
| DEVANT_CLOUD_RUN_NAME | Playwright — <ISO date> | Display name on the run |
| DEVANT_CLOUD_RUN_ID | — | Attach to an existing run; reporter skips create/complete |
Note:
DEVQ_*env vars are still accepted but deprecated. Rename them toDEVANT_CLOUD_*.
Option C — .env file (local dev)
Node.js does not auto-load .env files. Add this snippet at the top of
playwright.config.ts so the reporter picks up your .env when you run
playwright test directly:
import { readFileSync } from "node:fs";
try {
for (const line of readFileSync(".env", "utf8").split("\n")) {
const eq = line.indexOf("=");
if (eq < 1 || line.trimStart().startsWith("#")) continue;
const key = line.slice(0, eq).trim();
const val = line.slice(eq + 1).trim();
if (!(key in process.env)) process.env[key] = val;
}
} catch { /* no .env — env vars must be set externally */ }Suite grouping
The reporter derives the suite folder from Playwright's describe block chain. No extra configuration is needed.
Given:
test.describe("livechat widget E2E", () => {
test("empty email blocks send", async ({ page }) => { ... });
});Devant Cloud receives:
- Test case name:
empty email blocks send - Suite folder:
livechat widget E2E
Nested describes become a slash-joined path, e.g. login/with email.
The spec file is excluded from the suite name — only describe blocks are used.
How tests bind to test cases
The reporter resolves each Playwright test against a Devant Cloud test_case
row in this order:
@KEYtag on the test (viatest()tags or any inline@KEYin the title path) — looked up viaGET /v1/test-cases/by-key/KEY.- Exact name match in the project —
GET /v1/test-cases?search=…. - Auto-create —
POST /v1/test-cases. The reporter prints the new key:[devant] minted DEF-XYZ9 for "widget.spec.ts > livechat widget E2E > empty email blocks send" — add tag '@DEF-XYZ9' to bind it
Once you bind the tag in source, future runs reuse the same test case even if the title changes.
CI metadata
Auto-detected for GitHub Actions, GitLab CI, CircleCI, Jenkins, Azure DevOps,
plus a generic CI=true fallback. Populates the ci_* columns on the run so
the dashboard can deep-link to commits and PRs.
If you use Playwright's git-commit-info plugin, values from
config.metadata['revision.*'] override the CI env detection.
What gets sent
| Hook | Devant Cloud call |
|---|---|
| onBegin | POST /v1/runs |
| onTestEnd | resolve test case (by key / name / auto-create) → POST /v1/runs/:id/results → POST /v1/runs/:id/results/:rid/attempts/:aid/artifacts for each attachment |
| onEnd | wait for in-flight onTestEnds, then POST /v1/runs/:id/complete |
| onExit | flush the request queue (block process exit until everything settles) |
All requests use bearer auth with bounded retry: 3 attempts, exponential backoff for 5xx / 429 / network errors; 4xx errors fail fast.
