@commercetools-frontend/cypress
Version:
Cypress commands and utilities for Custom Applications
63 lines (62 loc) • 2.33 kB
TypeScript
export type LoginCredentials = {
/**
* The user email.
* Defaults to `Cypress.env('LOGIN_EMAIL') || Cypress.env('LOGIN_USER')`.
*/
email: string;
/**
* The user password.
* Defaults to `Cypress.env('LOGIN_PASSWORD')`.
*/
password: string;
};
export type CommandLoginOptions = {
/**
* The application entry point URI path. This value is used to identify
* the correct application config.
*/
entryPointUriPath: string;
/**
* Pass a list of dotfiles that must be loaded when the custom-application-config.json
* is loaded (in case you are using environment placeholder).
* By default the following dotfiles are loaded: `.env` and `.env.local`.
* You can also define the values using paths relative to the application folder.
*/
dotfiles?: string[];
/**
* Called before your page has loaded all of its resources.
* Use this as a chance to interact for example with the browser storage.
*/
onBeforeLoad?: (win: Window) => void;
/**
* If defined, visit this route after login.
*/
initialRoute?: string;
/**
* The project key to access in the user session. The session token is valid for one project key at a time.
* Defaults to `Cypress.env('PROJECT_KEY')`.
*/
projectKey?: string;
/**
* The user login credentials.
*/
login?: LoginCredentials;
/**
* Turn off caching the session across specs.
* This is only relevant for Cypress version >= `10.9.0`.
*/
disableCacheAcrossSpecs?: boolean;
};
export type LoginToMerchantCenterForCustomViewCommandLoginOptions = Omit<CommandLoginOptions, 'entryPointUriPath' | 'initialRoute'> & {
/**
* The package name as specified in the `package.json` to uniquely identify the configuration.
* This is only required for testing Custom Views.
* Defaults to `Cypress.env('PACKAGE_NAME')`
*/
packageName?: string;
};
export type CommandLoginByOidcOptions = CommandLoginOptions;
declare function loginByForm(commandOptions: CommandLoginOptions): void;
declare function loginByOidc(commandOptions: CommandLoginOptions & LoginToMerchantCenterForCustomViewCommandLoginOptions): void;
declare function isLocalhost(): boolean;
export { loginByForm, loginByOidc, isLocalhost };