cp-file
Quest Global Automation Framework method library
Highlights
- Abstraction layer for a protractor/selenium UI automation framework
- User-friendly interface to interact with webElements
- Send and retrieve from an ahem email server
- log method with timestamp
Install
$ npm install quest-global
Usage
import * as globalMethods from 'quest-global';
globalMethods.log("Welcome to the quest-global README");
API
clearText(element: ElementFinder, elementName: string, timeout: number): Promise
@param element — element to clear text from @param logString — element name to log to console @param timeout — max amount of time to wait for element to appear on page
Clears text from a textfield
click(element: ElementFinder, elementName: String, timeout: number): Promise
@param element — element to click @param elementName — element name for logger statement @param timeout — max amount of time to wait before clicking element
Clicks an element
closeTab(): Promise
Closes current tab
enterAndSelectFromAutoSuggest(ele: ElementFinder, item: string, timeout: number): Promise
@param element — element select value from @param item — value to select @param timeout — maximum amount of time to wait before selecting value
Selects option from dropdown
executeScriptClick(element: ElementFinder, elementName: String, timeout: number): Promise
@param element @param elementName @param timeout
Clicks element via JavaScript
executeScriptScrollIntoView(element: ElementFinder): Promise
@param element @param elementName @param timeout
Brings element into view
getAttribute(attributeName: string, entityName: string, schema: string, dataSource: string): {
attributeName: string; entityName: string; schema: string; dataSource: string;
Builds attributes object for tdm tool
getConfigBrowserSize(): any
Gets the viewport size from the processed config file
getData(domain: string, path: string, parameter: string): string
@param domain — url domain @param path — path to append to domain @param parameter — parameter to append to path and domain
Performs a Rest GET and return response text object at index 0. Used to connect to internal datamanagement endpoint
getDate(numDaysOffset: number, dateFormat: String): string
@param numDaysOffset — positive number will return # days in future, negative number will return # days in past @param dateFormat
getElementByAttribute(tagName: String, attributeName: String, attributeValue: String): ElementFinder
@param tagName — HTML Object tag (i.e. button, input, a, div, etc) @param attributeName — Custom attribute name (i.e. data-ta) @param attributeValue — Custom attribute value
function getElementByButtonText(buttonText: string): ElementFinder
Search the DOM for the text
getElementByClassName(className: string): ElementFinder
getElementByCss(css: string): ElementFinder
getElementByCssContainingText(css: string, text: string): ElementFinder
getElementById(id: string): ElementFinder
getElementById(id: string): ElementFinder
getElementById(id: string): ElementFinder
getElementByName(name: string): ElementFinder
getElementByXpath(Xpath: string): ElementFinder
procGetEmailData(url: string, mailboxName: string, jsonKey: string): Promise
@param url @param mailboxName @param jsonKey
Gets the json value for the inputted key, for the given mailbox (Ahem Email Server)
procGetSubjectline(url: string, mailboxName: string): Promise
Gets the subject line from an email on the Ahem email server
function procGetVerificationCode(url: string, mailboxName: string): Promise
@param mailboxName
Authenticates, and gets email and corresponding verification code
selectFromDropDown(ele: ElementFinder, item: string, timeout: number): Promise
@param element — element select value from @param item — value to select @param timeout — maximum amount of time to wait before selecting value
Selects option from dropdown
sendKeys(element: ElementFinder, text: string, timeout: number, clearPreviousText: boolean): Promise
@param element @param elementName @param timeout
Sends keys to an element, without first clearing text
switchTabs(tabIndex: number): Promise
@param tabIndex — index of tab to switch to
Switches to tab with inputted index
switchToFrame(xpath: string): Promise
@param xpath
Switches focus to frame, based on xpath input
textContains(text1: string, text2: string): Promise
@param text1 — first piece of text to compare @param text2 — second piece of text to compare @param presence — determines whether verification is of text equal/not equal
Returns boolean value of whether text equal/not equal to comparison text
verifyElement(element: ElementFinder, timeout: number, presence: boolean): Promise
verifyFailOnError(actual: any, expected: any, failStr: string, match: boolean): Promise
@param actual @param expected @param failStr
verifyText(text1: string, text2: string, presence: boolean): Promise
@param text1 — first piece of text to compare @param text2 — second piece of text to compare @param presence — determines whether verification is of text equal/not equal
Verifies text equal/not equal to comparison text
verifyTextContains(text1: string, text2: string, presence: boolean): Promise
@param text1 — first piece of text to compare @param text2 — second piece of text to compare @param presence — determines whether verification is of text equal/not equal
Verifies text equal/not equal to comparison text
waitForClickable(ele: ElementFinder, timeout: number): Promise
@param ele @param timeout
Waits for element to be clickable, up to specified number of seconds
function waitForElement(element: ElementFinder, presence: boolean, timeout: number): Promise
@param element @param presence @param timeout — Return Value: true/false
Waits for element presence/absence for up to timeout (parameter) Sample syntax var retVal = await waitForElement (element, presence, timeout_In_Milliseconds);
waitForElementScrollIntoView(element: ElementFinder, presence: boolean, timeout: number): Promise
waitForVisible(ele: ElementFinder, timeout: number): Promise
@param ele @param timeout
Waits for element to be visible, up to specified number of seconds
waitForVisible(ele: ElementFinder, timeout: number): Promise
Waits for element to be visible, up to specified number of seconds
@param ele @param timeout