accounts-frontend/tests-e2e/cypress/support/index.d.ts

47 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-12-07 16:58:52 +05:30
/// <reference types="cypress" />
type AccountAlias = 'default' | 'default2';
2019-12-29 20:14:07 +05:30
interface TAccount {
2020-05-24 04:38:24 +05:30
id: number;
username: string;
password: string;
email: string;
token: string;
refreshToken: string;
}
2019-12-07 16:58:52 +05:30
declare namespace Cypress {
2020-05-24 04:38:24 +05:30
interface Chainable {
/**
* Custom command to log in the user
*
* @example cy.login({ accounts: ['default'] })
*/
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`
*/
rawApiResp?: false;
}): Promise<{ accounts: TAccount[] }>;
login(options: { accounts: AccountAlias[]; updateState?: boolean; rawApiResp: true }): Promise<{
2020-05-24 04:38:24 +05:30
accounts: {
success: true;
access_token: string;
expires_in: number;
refresh_token: string;
}[];
}>;
2020-05-24 04:38:24 +05:30
getByTestId<S = any>(id: string, options?: Partial<Loggable & Timeoutable & Withinable>): Chainable<S>;
}
2019-12-07 16:58:52 +05:30
}