UNPKG

omni-dashboard-playwright-reporter

Version:

Playwright client for publishing test results to Omni Dashboard - Transform Your Test Automation with AI-Powered Insights

24 lines (23 loc) 819 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.uploadTestCase = uploadTestCase; // uploadTestCase.ts const test_1 = require("@playwright/test"); async function uploadTestCase(baseUrl, projectId, buildId, apiKey, payload) { const url = `${baseUrl}/projects/${projectId}/builds/${buildId}/test-cases`; const context = await test_1.request.newContext({ baseURL: baseUrl, extraHTTPHeaders: { 'x-api-key': apiKey, 'Content-Type': 'application/json', 'Accept': 'application/json' } }); const response = await context.post(url, { data: payload }); if (!response.ok()) { const errorText = await response.text(); throw new Error(`Failed to upload test case: ${errorText}`); } }