import { TextField } from './textfield'; import { CommonKeyword } from './commonKeyword'; import { Wait } from './dewWait'; import { DewElement } from './element'; /** * DewButton class */ export class DriverManager { /** * Function open new browser and Login in ZSN. This function requires a paramter which will be used on later stage to * perform action in the respective browser. * * ```js * DriverManager.openZSNBrowser("RFI","https://zsn.com","abc@zycus.com","12345"); * ``` * * @param {string} testName identifier to be used to map browser * @param {String} url Url of Webpage * @param {String} userName User Email id * @param {String} passWord User password * */ static async openZSNBrowser(testName: string, url: string, userName: string, passWord: string) { await session(testName, async () => { await CommonKeyword.amOnPage(url); await TextField.enterTextUsingLocator(`#login-email`, userName); await TextField.enterTextUsingLocator(`#login-password`, passWord); await CommonKeyword.clickLabel(`Login`); await Wait.waitForDefaultTimeout(10); await Wait.waitUntilVisibilityOfElement(`/home`); }); } /** * Function is user to logout from zsn browser. * * ```js * DriverManager.logoutZSN("RFI"); * ``` * * @param {string} testName identifier used while creating zsn instance */ static async logoutZSN(testName: string) { await session(testName, async () => { await CommonKeyword.moveCursorTo(`#headerDisplayName`); await CommonKeyword.clickElement(`#logout`); await DewElement.verifyIfISeeText(`Login`); }); } }