Module: e2e/browser

Helps using some protractor browser's features.

Source:

Methods

(static) click(elementFinder, delayopt) → {Promise}

Clicks on an element.

There are many issues with click events in web drivers, the same click is sometimes performed, and sometimes not. Moving the cursor to the element then performing a click seems to be more stable. It also checks if the element is clickable before clicking on it.

Also the banner in position fix prevent the driver to click on elements behind it. To avoid this problem, scroll up to the element minus the height of the banner.

Parameters:
Name Type Attributes Description
elementFinder Object

The element to click

delay Number <optional>

The delay in milliseconds to wait before clicking on the element

Source:
Returns:

Promise resolving when element is clicked

Type
Promise

(static) deactivateAnimations()

Disables all animations.

Source:
Example
var browserAPI = require('@openveo/test').e2e.browser;
browserAPI.deactivateAnimations();

(static) getProperty(elementFinder, property) → {Promise}

Gets property of an element.

Parameters:
Name Type Description
elementFinder Object

The finder of the element to get property from

property String

The property of the element to get value from

Source:
Returns:

Promise resolving with the value of the property

Type
Promise
Example
var browserAPI = require('@openveo/test').e2e.browser;
browserAPI.getProperty(element(by.css('input[type=checkbox]')), 'checked').then(function(isChecked) {
  console.log('Checkbox is checked');
});

(static) init() → {Promise}

Sets process.protractorConf to the configuration of the actual capability.

Source:
Returns:

Promise resolving when init is done

Type
Promise
Example
var browserAPI = require('@openveo/test').e2e.browser;
browserAPI.init();

(static) isVisible(elementFinder) → {Promise}

Tests if an element is visible.

An element is considered visible when it exists, is visible and has a non zero height.

Parameters:
Name Type Description
elementFinder Object

The finder of the element to test

Source:
Returns:

Promise resolving with true if the element is visible, false otherwise

Type
Promise

(static) setSize(width, height) → {Promise}

Sets browser's size.

Parameters:
Name Type Description
width Number

The browser width in px

height Number

The browser height in px

Source:
Returns:

Promise resolving when the browser size is set

Type
Promise
Example
var browserAPI = require('@openveo/test').e2e.browser;
browserAPI.setSize(800, 600);

(static) takeScreenshot(file, fileName) → {Promise}

Takes a screenshot of the actual browser state.

Parameters:
Name Type Description
file String

The screenshot file path

fileName String

The screenshot file name without the extension

Source:
Returns:

Promise resolving when the capture is made

Type
Promise
Example
var browserAPI = require('@openveo/test').e2e.browser;
browserAPI.takeScreenshot('/tmp', 'myScreenshot');

(private, static) writeScreenShot(data, file, callback)

Writes screenshot to a file.

Parameters:
Name Type Description
data String

Screenshot data

file String

Screenshot final file path

callback callback

The function to call when done

Source: