UNPKG

cumulocity-cypress

Version:
55 lines (54 loc) 2.5 kB
import { CookieAuth, IAuthentication } from "@c8y/client"; import { C8yAuthOptions } from "../shared/auth"; import { C8yClient } from "../shared/c8yclient"; /** * Helper to normalize any given arguments and Cypress `prevSubject`. * * When chaining commands, Cypress will pass result from previous subject * (parent) as first argument. In case of optional `prevSubject` Cypress will pass * `null` as first argument if previous command did not yield a result value. * * Depending on the hierarchy of chained commands, the structure of the * `prevSubject` argument will be different. * * Supported options * 1. [<prevSubject>, arguments] * 2. {"<index>": [<prevSubject>, arguments], "<index>": arguments } * * Structure of 2) depends on the command chainer. */ export declare function normalizedArguments(args: any[] | any): any[]; /** * Get `normalizedArguments` and insert auth options from * env variables at the beginning of the arguments. */ export declare function normalizedArgumentsWithAuth(args: any[]): any[]; export declare function normalizedC8yclientArguments(args: any[]): any[]; export declare function getCookieAuthFromEnv(): CookieAuth | undefined; export declare function getXsrfToken(): any; export declare function getAuthOptionsFromEnv(): C8yAuthOptions | undefined; export declare function getAuthOptions(...args: any[]): C8yAuthOptions | undefined; export declare function userAliasFromArgs(...args: any[]): string | undefined; /** * Gets and implementation of IAuthentication from the given auth options. */ export declare function getC8yClientAuthentication(auth: C8yAuthOptions | string | IAuthentication | undefined): IAuthentication | undefined; export declare function persistAuth(auth: C8yAuthOptions): void; export declare function tenantFromBasicAuth(auth: { user: string; }): string | undefined; export declare function getSystemVersionFromEnv(): string | undefined; export declare function getShellVersionFromEnv(): string | undefined; /** * Tries to get the base URL from environment variables. The following * environment variables are checked in order: * - C8Y_BASEURL * - C8Y_BASE_URL * * @returns Base URL from environment variables. */ export declare function getBaseUrlFromEnv(): string | undefined; export declare function storeClient(client: C8yClient): void; export declare function restoreClient(): C8yClient | undefined; export declare function resetClient(): void; export declare function throwError(message: string): never;