UNPKG

cumulocity-cypress

Version:
90 lines (89 loc) 4.17 kB
export {}; declare global { namespace Cypress { interface Chainable { /** * Sets the language in user preferences. * * @param {C8yLanguage} lang - the language to be enabled in user preferences */ setLanguage(lang: C8yLanguage): Chainable<void>; /** * Visits a given page and waits for a selector to become visible. * * Supports two signatures: * 1. Positional parameters for simple cases * 2. Options object for advanced configuration with shell and remotes support * * @example * // Simple usage with defaults * cy.visitAndWaitForSelector('/apps/cockpit'); * * // With positional parameters * cy.visitAndWaitForSelector('/', 'en', '[data-cy=myelement]', 10000); * * // With options object * cy.visitAndWaitForSelector('/apps/cockpit', { * language: 'en', * selector: '#navigator', * timeout: 30000, * shell: 'cockpit', * remotes: '{"my-plugin":["myPluginViewProviders"]}' * }); * * @param {string} url - The page to be visited * @param {C8yLanguage} language - The language to set. Defaults to 'en' * @param {string} selector - The selector to wait to become visible. Defaults to `c8y-drawer-outlet c8y-app-icon .c8y-icon, c8y-navigator-outlet c8y-app-icon` * @param {number} timeout - The timeout in milliseconds to wait for the selector to become visible. Defaults to `pageLoadTimeout` or `60000` */ visitAndWaitForSelector(url: string, language?: C8yLanguage, selector?: string, timeout?: number): Chainable<void>; /** * Visits a given page and waits for a selector to become visible (options signature). * * @param {string} url - The page to be visited * @param {C8yVisitOptions} options - Configuration options * @param {C8yLanguage} options.language - The language to set. Defaults to 'en' * @param {string} options.selector - The selector to wait to become visible * @param {number} options.timeout - The timeout in milliseconds * @param {string} options.shell - The shell application to target (overrides C8Y_SHELL_TARGET env or C8Y_SHELL_NAME env) * @param {string | C8yRemotesObject} options.remotes - Map/Object of remote plugins to load (overrides C8Y_SHELL_EXTENSION env or C8Y_SHELL_REMOTES env). Can be a JSON string or an object. Example: `{"plugin-name":["viewProvider1","viewProvider2"]}` * @param {boolean} options.forceUrlRemotes - Force to only load local remotes from the URL query string (overrides C8Y_SHELL_REMOTES_FORCE env). Defaults to false */ visitAndWaitForSelector(url: string, options: C8yVisitOptions): Chainable<void>; /** * Disables Gainsight by intercepting tenant options and configuring * `gainsightEnabled: false` for `customProperties`. * * ``` * { * customProperties: { * ... * gainsightEnabled: false, * } * } * ``` */ disableGainsight(): Chainable<void>; } } export type C8yLanguage = "de" | "en"; } export type C8yRemotesObject = { [pluginName: string]: string[]; }; /** * Options for `visitAndWaitForSelector` command. */ export type C8yVisitOptions = { language?: C8yLanguage; selector?: string; timeout?: number; shell?: string; remotes?: string | C8yRemotesObject; forceUrlRemotes?: boolean; }; /** * Default selector to wait for when visiting a page. This selector works for different * Cumulocity versions. */ export declare const C8yVisitDefaultWaitSelector = "c8y-drawer-outlet c8y-app-icon .c8y-icon, c8y-navigator-outlet c8y-app-icon";