cypress-xray-plugin
Version:
A Cypress plugin for uploading test results to Xray (test management for Jira)
79 lines (78 loc) • 3.9 kB
TypeScript
import FormData from "form-data";
import type { XrayTestExecutionResults } from "../../types/xray/import-test-execution-results";
import type { CucumberMultipartFeature } from "../../types/xray/requests/import-execution-cucumber-multipart";
import type { MultipartInfo } from "../../types/xray/requests/import-execution-multipart-info";
import type { GetTestRunResponseServer } from "../../types/xray/responses/graphql/get-test-runs";
import type { ImportExecutionResponseServer } from "../../types/xray/responses/import-execution";
import type { ImportFeatureResponse, ImportFeatureResponseServer } from "../../types/xray/responses/import-feature";
import type { XrayLicenseStatus } from "../../types/xray/responses/license";
import type { HttpCredentials } from "../authentication/credentials";
import type { AxiosRestClient } from "../https/requests";
import type { XrayClient } from "./xray-client";
import { AbstractXrayClient } from "./xray-client";
export interface XrayClientServer extends XrayClient {
/**
* Add new evidence to a test run.
*
* @param testRunId - the ID of the test run
* @param body - the evidence to add
*
* @see https://docs.getxray.app/display/XRAY/Test+Runs+-+REST#TestRunsREST-ExecutionEvidence
*/
addEvidence(testRunId: number, body: {
/**
* The Content-Type representation header is used to indicate the original media type of the
* resource.
*/
contentType?: string;
/**
* The attachment data encoded in base64.
*/
data: string;
/**
* The file name for the attachment.
*/
filename: string;
}): Promise<void>;
/**
* Returns JSON that represents the test run.
*
* @param testRun - the ID of the test run to return or a query specifying the test run
* @returns the test run results
* @see https://docs.getxray.app/display/XRAY/Test+Runs+-+REST
*/
getTestRun(testRun: {
/**
* The key of the test execution.
*/
testExecIssueKey: string;
/**
* The key of the test issue.
*/
testIssueKey: string;
} | number): Promise<GetTestRunResponseServer>;
/**
* Returns information about the Xray license, including its status and type.
*
* @returns the license status
* @see https://docs.getxray.app/display/XRAY/v2.0#/External%20Apps/get_xraylicense
*/
getXrayLicense(): Promise<XrayLicenseStatus>;
}
export declare class ServerClient extends AbstractXrayClient<ImportFeatureResponseServer, ImportExecutionResponseServer> implements XrayClientServer {
/**
* Construct a new client using the provided credentials.
*
* @param apiBaseUrl - the base URL for all HTTP requests
* @param credentials - the credentials to use during authentication
* @param httpClient - the HTTP client to use for dispatching requests
*/
constructor(apiBaseUrl: string, credentials: HttpCredentials, httpClient: AxiosRestClient);
addEvidence(...[testRunId, evidence]: Parameters<XrayClientServer["addEvidence"]>): Promise<void>;
getTestRun(...[testRun]: Parameters<XrayClientServer["getTestRun"]>): Promise<GetTestRunResponseServer>;
getXrayLicense(): Promise<XrayLicenseStatus>;
protected onRequest(event: "import-execution-cucumber-multipart", cucumberJson: CucumberMultipartFeature[], cucumberInfo: MultipartInfo): FormData;
protected onRequest(event: "import-execution-multipart", executionResults: XrayTestExecutionResults, info: MultipartInfo): FormData;
protected onResponse(event: "import-feature", response: ImportFeatureResponseServer): ImportFeatureResponse;
protected onResponse(event: "import-execution-cucumber-multipart" | "import-execution-multipart" | "import-execution", response: ImportExecutionResponseServer): string;
}