UNPKG

cypress-xray-plugin

Version:

A Cypress plugin for uploading test results to Xray (test management for Jira)

82 lines (81 loc) 3.58 kB
import FormData from "form-data"; import type { XrayEvidenceItem, 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 { TestRun } from "../../types/xray/responses/graphql/xray"; import type { ImportExecutionResponseCloud } from "../../types/xray/responses/import-execution"; import type { ImportFeatureResponse, ImportFeatureResponseCloud } from "../../types/xray/responses/import-feature"; import type { JwtCredentials } from "../authentication/credentials"; import type { AxiosRestClient } from "../https/requests"; import { AbstractXrayClient } from "./xray-client"; interface HasTestRunResults { /** * Returns a test execution by issue ID. * * @param options - the GraphQL options * @returns the test run results * @see https://us.xray.cloud.getxray.app/doc/graphql/gettestruns.doc.html */ getTestRunResults(options: { /** * The issue ids of the test execution of the test runs. */ testExecIssueIds: [string, ...string[]]; /** * The issue ids of the test of the test runs. */ testIssueIds: [string, ...string[]]; }): Promise<TestRun<{ key: string; }>[]>; } export declare class XrayClientCloud extends AbstractXrayClient<ImportFeatureResponseCloud, ImportExecutionResponseCloud> implements HasTestRunResults { /** * The version of Xray's Cloud API. API v1 would also work, but let's stick to the recent one. */ static readonly VERSION = "v2"; private static readonly GRAPHQL_LIMIT; /** * Construct a new Xray cloud client using the provided credentials. * * @param url - the base URL * @param credentials - the credentials to use during authentication * @param httpClient - the HTTP client to use for dispatching requests */ constructor(url: string, credentials: JwtCredentials, httpClient: AxiosRestClient); /** * Mutation used to add evidence to a test run. * * @param variables - the GraphQL variable values * @returns the result * * @see https://us.xray.cloud.getxray.app/doc/graphql/addevidencetotestrun.doc.html */ addEvidenceToTestRun(variables: { /** * The evidence to add to the test run. */ evidence: readonly XrayEvidenceItem[]; /** * The ID of the test run. */ id: string; }): Promise<{ /** * IDs of the added evidence. */ addedEvidence: string[]; /** * Warnings generated during the operation. */ warnings: string[]; }>; getTestRunResults(options: Parameters<HasTestRunResults["getTestRunResults"]>[0]): Promise<TestRun<{ key: string; }>[]>; 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: ImportFeatureResponseCloud): ImportFeatureResponse; protected onResponse(event: "import-execution-cucumber-multipart" | "import-execution-multipart" | "import-execution", response: ImportExecutionResponseCloud): string; } export {};