Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IGondola

Set of common actions supported by gondola

Hierarchy

  • IGondola

Index

Methods

checkControlExist

  • checkControlExist(element: string | ILocator): void
  • Checks if a control exists. If the control is found, the verify point is considered: Passed; otherwise the test is: Failed.

    example
    
     // check if a control with id "elementId" exists .
    await gondola.checkControlExist("#elementId");
    
     // check if a control containing "Login" exists.
    await gondola.checkControlExist("Login");
    
     // check if control that has the attribute "name=submit" exists.
    await gondola.checkControlExist({name: "submit"});

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator.

    Returns void

checkControlNotExist

  • checkControlNotExist(element: string | ILocator): void
  • Checks if a control does not exist. If the specified control is not found, the verify point is considered: Passed; otherwise the test result is: Failed.

    example
    
    // check if a control with the id "elementId" does not exists .
    await gondola.checkControlNotExist("#elementId");
    
    // check if a control containing "Login" does not exists.
    await gondola.checkControlNotExist("Login");
    
    // check if a control that has attribute "name=submit"  does not exists.
    await gondola.checkControlNotExist({name : "submit"});

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator.

    Returns void

checkControlProperty

  • checkControlProperty(element: string | ILocator, attribute: string, value: string | boolean | number | object): void
  • Checks if the first element with given locator has an attribute whose value matches the provided one. The verify point is considered: Passed if the values match; otherwise the test result is: Failed.

    example
    
    // Compare the value of attribute "name" from a control with id "buttonId1" against an expected value.
    await gondola.checkControlProperty("#buttonId1","name","Button 1");

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator.

    • attribute: string

      Element's attribute to be retrieved.

    • value: string | boolean | number | object

      Expected value of the attribute.

    Returns void

checkEqual

  • checkEqual<T>(actual: T, expected: T, message?: undefined | string): void
  • Tests for deep equality between the actual and expected parameters. If objects are strictly equal, the verify point is considered: Passed; otherwise the test result is: Failed.

    example
    
    let value = await gondola.getText("#elementId");
    gondola.checkEqual(value, "Hello");
    gondola.checkEqual(value, "Hi", "value should be 'Hi'");

    Type parameters

    • T

    Parameters

    • actual: T

      actual value

    • expected: T

      expected value

    • Optional message: undefined | string

      (optional) message will throw if the values are not strictly equal

    Returns void

checkJSONValue

  • checkJSONValue(jsonObject: any, jsonPath: string, expected: any): void
  • Checks a JSON value using its JSON path. If they satisfy deep, strict equality, the verify point is considered: Passed; otherwise the test result is: Failed.

    example
    
    const data = [
     {
       id: 1,
       title: "This is title 1"
     },
     {
       id: 2,
       title: "This is title 2",
     }
    ];
    
    const value = await gondola.checkJSONValue(data, "[0].title", "This is title 1");

    Parameters

    • jsonObject: any
    • jsonPath: string
    • expected: any

    Returns void

checkNotEqual

  • checkNotEqual<T>(actual: T, expected: T, message?: undefined | string): void
  • Tests for deep strict inequality. If objects are not strictly equal, the verify point is considered: Passed; otherwise the test result is: Failed.

    example
    
    let value = await gondola.getText("#elementId");
    gondola.checkNotEqual(value, "Hello");
    gondola.checkNotEqual(value, "Hi", "value should not equal 'Hi'");

    Type parameters

    • T

    Parameters

    • actual: T

      actual value

    • expected: T

      expected value

    • Optional message: undefined | string

      (optional) message will throw if the values are strictly equal

    Returns void

checkText

  • checkText(element: string | ILocator, value: string): void
  • Checks if text from the located element matches a given value. The verify point is considered: Passed if the values match; otherwise the test result is: Failed.

    example
    
    // Compare the text from a control located by an xpath with an expected value.
    await gondola.checkText({"xpath":"//input[@name='button_ControlTest']"},"ButtonTest");

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator.

    • value: string

    Returns void

doesControlExist

  • doesControlExist(element: string | ILocator): Promise<boolean>
  • Returns a Boolean value to indicate whether or not the specified control is found. Returns a Boolean value of true if the control is found. Otherwise it returns false.

    example
    
    // Returns `true` if the control with id "button_ControlTest" exists.
    let variable = await gondola.doesControlExist("#button_ControlTest");

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator.

    Returns Promise<boolean>

enter

  • enter(element: string | ILocator, value: string): void
  • Fills a text field or <textarea> with the given string. If there is already text, it will be cleared first.

    example
    
    await gondola.enter({"xpath":"//input[@name='textBox_ControlTest']"},"This is example");

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator.

    • value: string

    Returns void

get

  • get(element: string | ILocator): Promise<string>
  • Retrieves a value from the located element and returns a string.

    example
    
    let value = await gondola.get("#buttonId");

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator. In case mobile, only works iOS

    Returns Promise<string>

getCapabilities

  • getCapabilities(): Promise<any>
  • Gets the current desired capabilities.

    example
    
    const capabilities = await gondola.getCapabilities();
    if (capabilities.platformName === "android"){
         // Do something
    }

    Returns Promise<any>

getControlProperty

  • getControlProperty(element: string | ILocator, property: string): Promise<any>
  • Retrieves a attribute from the first element with a specified locator.

    example
    
    let hrefValue = await gondola.getControlProperty("//a[.='Home']", "innerText");

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator.

    • property: string

      property name.

    Returns Promise<any>

getElementCount

  • getElementCount(element: string | ILocator): Promise<number>
  • Returns the number of visible elements in the control found with the supplied locator.

    example
    
    // Get visible elements in control with id "buttonId1"
    await gondola.getElementCount("#buttonId1");

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator

    Returns Promise<number>

getJSONValue

  • getJSONValue(jsonObject: any, jsonPath: string): any
  • Gets a JSON value using its JSON path.

    example
    
    const data = [
     {
       id: 1,
       title: "This is title 1"
     },
     {
       id: 2,
       title: "This is title 2",
     }
    ];
    
    const value = await gondola.getJSONValue(data, "[0].title");

    Parameters

    • jsonObject: any
    • jsonPath: string

    Returns any

    array[] of found items or empty array if jsonPath does not exist

getSelectedItems

  • getSelectedItems(selectLocator: string | ILocator): Promise<string[]>
  • Gets the selected items in list box or combo box defined by the HTML <select> tag.

    example
    
    const item = await gondola.getSelectedItems("#selectElementId");

    Parameters

    • selectLocator: string | ILocator

      located by CSS|XPath|ILocator

    Returns Promise<string[]>

    text values of selected items.

getText

  • getText(element: string | ILocator): Promise<string>
  • Retrieves text from the specified element.

    example
    
    // Get the text from control with xpath.
    await gondola.getText({"xpath":"//input[@name='button_ControlTest']"});

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator.

    Returns Promise<string>

report

  • report(description: string, imagepath?: undefined | string): void
  • Creates a report using using the the reporter set in gondola.json.

    example
    
    gondola.report("This is a report")
    experimental

    v1.3. Only works with Mochawesome.

    Parameters

    • description: string

      user-defined text or a caption of the image to put in the report.

    • Optional imagepath: undefined | string

      (optional) path to the image to put in the report.

    Returns void

saveScreenshot

  • saveScreenshot(fileName: string, fullPage?: undefined | false | true): void
  • Saves a screenshot of the current browsing context to a PNG file and put into the output folder (set in gondola.json). Be aware that, if we set the 'fullPage' value to 'true', some browser drivers take screenshots of the whole document (e.g. Geckodriver-Firefox and Safaridriver) and others only of the current viewport (e.g. Chromedriver).

    example
    
    await gondola.saveScreenshot("screenshot.png");
    await gondola.saveScreenshot("screenshotFullPage.png", true);

    Parameters

    • fileName: string

      file name to save.

    • Optional fullPage: undefined | false | true

      (optional) flag to enable fullscreen screenshot mode. Default value is false.

    Returns void

select

  • select(element: string | ILocator, items: string | string[]): void
  • Selects items in a list box or a combo box that are defined by the HTML <select> tag.

    example
    
    gondola.select("#selectElementId", ["Green", "Red"]);

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator.

    • items: string | string[]

      text value of items will be selected.

    Returns void

setErrorHandler

  • setErrorHandler(callback: (errorInfo: IErrorInfo, actor: any) => void): void
  • Callback the [callback] when an error happens.

    example
    
    gondola.setErrorHandler(async (errorInfo: IErrorInfo, actor: any) => {
         gondola.report(`Testcase: ${errorInfo.testCaseName} \
    failed at step: ${errorInfo.testStepName} with error: ${errorInfo.errorMessage}`);
    });

    Parameters

    • callback: (errorInfo: IErrorInfo, actor: any) => void

      function to be executed upon the occurrence of an error.

        • Parameters

          Returns void

    Returns void

setState

  • setState(element: string | ILocator, value: boolean): void
  • Sets the state for the specified checkbox/radio button.

    example
    
    // set State = true for the element "checkboxId"
    gondola.setState("#checkboxId", true);

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator.

    • value: boolean

      state to which to set the checkbox/radio button. Allowable values:

      • true: check the checkbox/radio
      • false: un-check the checkbox/radio

    Returns void

wait

  • wait(sec: number): void
  • Pauses execution for a number of seconds.

    example
    
    gondola.wait(5);

    Parameters

    • sec: number

      time in seconds to wait.

    Returns void

waitForDisappear

  • waitForDisappear(locator: string | ILocator, sec?: undefined | number): void
  • Waits for an element to be removed from the DOM tree of a page (the default amount is 1 second).

    example
    
    gondola.waitForDisappear("#buttonTest", 5);

    Parameters

    • locator: string | ILocator

      element located by CSS|XPath|strict locator.

    • Optional sec: undefined | number

      (optional) time in seconds to wait, 1 by default.

    Returns void

waitForElement

  • waitForElement(element: string | ILocator, sec?: undefined | number): void
  • Waits for an element to be present on the page (the default amount is 1 second).

    example
    
    // Wait 5 seconds for an element with the id "#buttonTest" to be present on the page.
    gondola.waitForElement("#buttonTest", 5);

    Parameters

    • element: string | ILocator

      located by CSS|XPath|ILocator.

    • Optional sec: undefined | number

      (optional) time in seconds to wait

    Returns void