54 lines
1.3 KiB
TypeScript
Raw Normal View History

2019-12-07 13:28:52 +02:00
/// <reference types="cypress" />
type AccountAlias = 'default' | 'default2';
2019-12-29 16:44:07 +02:00
interface TAccount {
id: number;
username: string;
password: string;
email: string;
token: string;
refreshToken: string;
}
2019-12-07 13:28:52 +02:00
declare namespace Cypress {
interface Chainable {
/**
* Custom command to log in the user
*
* @example cy.login({ accounts: ['default'] })
2019-12-07 13:28:52 +02:00
*/
login(options: {
accounts: AccountAlias[];
/**
* defaults to `true`. if `false` than only api response will
* be returned without mutating app state
* (useful for custom scenarios such as mocking of other api responses
* or checking whether account is registered)
*/
updateState?: boolean;
/**
* Whether return raw api response without any conversion. Defaults to: `false`
*/
2019-12-29 18:26:51 +02:00
rawApiResp?: false;
2019-12-29 16:44:07 +02:00
}): Promise<{ accounts: TAccount[] }>;
2019-12-29 18:26:51 +02:00
login(options: {
accounts: AccountAlias[];
updateState?: boolean;
rawApiResp: true;
}): Promise<{
accounts: {
success: true;
access_token: string;
expires_in: number;
refresh_token: string;
}[];
}>;
getByTestId<S = any>(
id: string,
options?: Partial<Loggable & Timeoutable & Withinable>,
): Chainable<S>;
2019-12-07 13:28:52 +02:00
}
}