@sap_oss/wdio-qmate-service
Version:
[](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[](http
121 lines (118 loc) • 5.93 kB
TypeScript
/**
* @class session
* @memberof ui5
*/
export declare class Session {
private vlf;
private ErrorHandler;
/**
* @function login
* @memberOf ui5.session
* @description Login with specific username and password. This function works for both fiori and sap-cloud login.
* @param {String} username - The username.
* @param {String} [password] - The password.
* @param {Boolean} [verify=false] - Specifies if the function will check the shell header after logging in.
* @param {Number} [timeout=30000] - The timeout to wait (ms).
* @example await ui5.session.login("PURCHASER");
* @example await ui5.session.login("JOHN_DOE", "abc123!", true);
*/
login(username: string, password?: string, verify?: boolean, timeout?: number): Promise<true | undefined>;
/**
* @function loginFiori
* @memberOf ui5.session
* @description Login with fioriForm and specific username and password.
* @param {String} username - The username.
* @param {String} [password] - The password.
* @param {Boolean} [verify=false] - Specifies if the function will check the shell header after logging in.
* @example await ui5.session.loginFiori("john", "abc123!");
*/
loginFiori(username: string, password?: string, verify?: boolean): Promise<void>;
/**
* @function loginSapCloud
* @memberOf ui5.session
* @description Login with sapCloud form and specific username and password.
* @param {String} username - The username.
* @param {String} [password] - The password.
* @param {Boolean} [verify=false] - Specifies if the function will check the shell header after logging in.
* @example await ui5.session.loginSapCloud("john", "abc123!");
*/
loginSapCloud(username: string, password?: string, verify?: boolean): Promise<void>;
/**
* @function loginCustom
* @memberOf ui5.session
* @description Login with custom form and specific username and password.
* @param {String} username - The username.
* @param {String} [password="super-duper-sensitive-pw"] - The password.
* @param {String} usernameFieldSelector - The CSS selector of the username field.
* @param {String} passwordFieldSelector - The CSS selector of the password field.
* @param {String} logonButtonSelector - The CSS selector of the login button.
* @param {Boolean} [verify=false] - Specifies if the function will check the shell header after logging in.
* @example await ui5.session.loginCustom("JOHN_DOE", "abc123!", "#username", #password, "#logon");
*/
loginCustom(username: string, password: string | undefined, usernameFieldSelector: string, passwordFieldSelector: string, logonButtonSelector: string, verify?: boolean): Promise<void>;
/**
* @function loginCustomViaConfig
* @memberOf ui5.session
* @description Login with specific username and password. The selectors will be taken from the config.
* @param {String} username - The username. Can be specified in spec or config. If specified in both credentials will be taken from config.
* @param {String} [password] - The password. Can be specified in spec or config. If specified in both credentials will be taken from config.
* @param {Boolean} [verify=false] - Specifies if the function will check the shell header after logging in.
* @example // config - SAMPLE 1
auth: {
formType: 'plain',
usernameFieldSelector: "#USERNAME_BLOCK input",
passwordFieldSelector: "#PASSWORD_BLOCK input",
logonButtonSelector: "#LOGIN_LINK"
},
// spec
await ui5.session.loginCustomViaConfig("JOHN_DOE", "abc123!");
// config - SAMPLE 2
auth: {
formType: "plain",
username: "PURCH_EXT",
password: "super-duper-sensitive-pw",
usernameFieldSelector: "#USERNAME_BLOCK input",
passwordFieldSelector: "#PASSWORD_BLOCK input",
logonButtonSelector: "#LOGIN_LINK"
},
// spec
await ui5.session.loginCustomViaConfig();
*/
loginCustomViaConfig(username: string, password?: string, verify?: boolean): Promise<void>;
/**
* @function logout
* @memberOf ui5.session
* @description Logs the user out.
* @param {Boolean} [verify="true"] - Specifies if the function will check the logout text after logging out.
* Set this to false if the system does not show the text after logging out.
* @example await ui5.session.logout();
*/
logout(verify?: boolean): Promise<any>;
/**
* @function switchUser
* @memberOf ui5.session
* @description switches the user according to the passed username and password.
* @param {String} username - The username.
* @param {String} [password] - The password.
* @param {Object} [authenticator] - The login form type. Set to null to use generic login.
* @param {Number} [wait=10000] - The waiting time between logout and login (ms).
* @example await ui5.session.switchUser("PURCHASER");
* @example const authenticator = ui5.authenticators.fioriForm;
* await ui5.session.switchUser("PURCHASER", "super-duper-sensitive-pw", authenticator, 30000);
*/
switchUser(username: string, password: string | undefined, authenticator: any, wait?: number): Promise<void>;
/**
* @function expectLogoutText
* @memberOf ui5.session
* @description Expects the logout text after logout to be "You have been logged off.
* This is essential for chaining scripts, so that no static browser sleep in the spec itself is required anymore.
* @example await ui5.session.expectLogoutText();
*/
expectLogoutText(): Promise<void>;
private _loginWithUsernameAndPassword;
private _clickSignOut;
private _checkForErrors;
private _getUsernameAndPassword;
}
declare const _default: Session;
export default _default;