Report Playwright results to Vansah so your automated checks appear with the Test Cases linked to a Jira work item. This TypeScript example reports one Quick Test result for each execution of the Playwright test.
Before you begin
Set up a working Playwright TypeScript project. See Playwright installation if you are starting a new project.
Create a Vansah API token and find your workspace’s API Connect URL.
Link an existing Test Case, such as DEMO-C46, to the Jira work item you want to report against, such as DEMO-123.
Make sure the token account can access the Jira space and execute the case. Supply any run properties required by that space.
1. Add the TypeScript binding
Copy VansahNode.ts from the Playwright sample into a vansah-binding folder at your project root. Install its runtime dependencies:
npm install axios dotenv
The example below creates a separate binding instance inside each test. This avoids sharing the binding’s current-run state between concurrent tests.
2. Configure your environment
Provide these variables through your environment or CI secret store. For local development, dotenv can load a .env file at the project root:
VANSAH_URL=https://your-vansah-api-host.example
VANSAH_TOKEN=YOUR_VANSAH_API_TOKEN
APP_URL=https://your-application.example
Replace the example host with the exact API Connect URL from your workspace, without an endpoint path. Keep .env and real tokens out of source control. The binding sends the token directly in the Authorization header.
3. Add a test that reports its outcome
Endpoint: POST /api/v2/run
Save this complete test as tests/vansah-home.spec.ts. Replace the case key, work item key, environment, and expected title with values for your test. The public binding request method lets the example use a readable result name and verify the saved run key.
import "dotenv/config";
import { test, expect } from "@playwright/test";
import VansahNode from "../vansah-binding/VansahNode";
function required(name: string): string {
const value = process.env[name];
if (!value) throw new Error(`Set ${name}.`);
return value;
}
test("home page shows the expected title", async ({ page }) => {
const vansah = new VansahNode();
vansah.setVansahUrl(required("VANSAH_URL").replace(/\/$/, ""));
vansah.setVansahToken(required("VANSAH_TOKEN"));
async function report(result: "passed" | "failed") {
const response = await vansah.connectToVansahRest("run", "POST", {
asset: { type: "issue", key: "DEMO-123" },
case: { key: "DEMO-C46" },
result: { name: result },
properties: { environment: { name: "UAT" } }
});
if (!response?.success || !response?.data?.run?.key) {
throw new Error(response?.message || "Vansah reporting was not confirmed.");
}
console.log(`Saved Vansah run: ${response.data.run.key}`);
}
try {
await page.goto(required("APP_URL"));
await expect(page).toHaveTitle(/Welcome/);
} catch (testError) {
try {
await report("failed");
} catch (reportError) {
console.error("Vansah reporting failed:", reportError);
}
throw testError;
}
await report("passed");
});
Use an existing environment name such as UAT. If environment is optional and not needed, remove the properties entry. If release or sprint is required, add it using the verified request formats in the relevant Vansah API guide.
A successful browser assertion reports passed. A browser or assertion failure attempts to report failed and then rethrows the original failure. A reporting failure after a passed assertion also fails the Playwright test so it is visible in the test output.
4. Run and verify
npx playwright test tests/vansah-home.spec.ts --workers=1 --retries=0
Select the intended browser project if your Playwright configuration defines several. Each browser execution or retry can create another Vansah run; review your configuration before enabling repeated reporting.
Open DEMO-123 in Jira, find DEMO-C46 in Vansah, and inspect the saved Test Run. Confirm the readable run key from the console, result, environment, and execution time. Check both Playwright output and Vansah before retrying an uncertain reporting request.
Add step-level evidence when needed
For a case with script steps, the sample also provides addTestRunFromJiraIssue followed by addTestLog. Map each log to an existing step number. If you supply a screenshot path, capture a new screenshot during that execution rather than reusing the sample repository’s static images.
The Quick Test example above reports an overall result. It does not automatically upload Playwright traces, videos, or screenshots.
Using Playwright with another language
For Java or C#, start with the Vansah Java binding or the C# integration guide and adapt the reporting calls to your test framework. Browser screenshot APIs differ between Selenium and Playwright; verify those integrations separately.

