JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 829
  • Score
    100M100P100Q108039F
  • License ISC

This lib contains implementation of basic actions which can be used for e2e testing in Firefox browser

Package Exports

  • protractor-firefox-support

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (protractor-firefox-support) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

protractor-firefox-support

This is custom implementation of Actions class functions for e2e testing using Protractor framework in Firefox browser. If you use it, ⭐️ it.

Installation

You can simply install it into your project using this command:

npm install protractor-firefox-support --save

Examples of usage

Here are examples of custom functions usage. Functions presented as separated modules which can be imported in test files:

dragAndDrop (complete example here)

const support = require('protractor-firefox-support');

module.exports.performDnD = ({dragElmSelector = '.btn.btn-primary', dragElmIndex,
    draggable = false} = {}) => {
    const dropPoint = {x: 100, y: 100};
    const options = {makeDraggable: draggable, dropLocation: dropPoint};

    /**
     *  You can define dragElement index if there are more than
     *  one element with specified selector.
     */

    (dragElmIndex) ? options.dragElemIndex = dragElmIndex : null;

    /**
     *  Also you can pass selector instead of null, if you want to specify
     *  drop element.
     */
    return browser.executeScript(support.dragAndDrop, dragElmSelector, null, options);
}

openContextMenu(rightMouseClick, complete example here)

const support = require('protractor-firefox-support');

module.exports.openElementContextMenu = ({selector, elemIndex} = {}) => {
    const options = {location: {x: 100, y: 100}};

    /**
     *  If there are more elements which match specified selector, add elemIndex option.
     *  Property 'location' defines screen coordinates where context menu will be opened.
     */

    (elemIndex) ? options.elemIndex = elemIndex : null;
    return browser.executeScript(support.rightMouseBtnClick, selector, options);
}

mouseUp (complete example here)

const support = require('protractor-firefox-support');

module.exports.mouseUp = (pointCoordinates = {x: 100, y: 100}) => {
    return browser.executeScript(support.mouseUp, pointCoordinates);
}

mouseMove (complete example here)

const support = require('protractor-firefox-support');

module.exports.mouseMove = (pointCoordinates = {x: 100, y: 100}) => {
    return browser.executeScript(support.mouseMove, pointCoordinates);
}

mouseDown (complete example here)

const support = require('protractor-firefox-support');

module.exports.mouseDown = ({selector, index} = {}) => {
    /**
     *  If there are more elements which match specified selector, add elementIndex option.
     */
    return browser.executeScript(support.mouseDown, {elementSelector: selector,
      elementIndex: index});
}

mouseClick (complete example here)

const support = require('protractor-firefox-support');

module.exports.mouseClick = ({elemSelector, point, tgtIndex} = {}) => {
   const options = {};
   (elemSelector) ? options.selector = elemSelector : null;
   (point) ? options.point = point : null;
   (tgtIndex) ? options.elementIndex = tgtIndex : null;
   return browser.executeScript(support.mouseClick, options);
}

changeInputText(beta, complete example here)

const support = require('protractor-firefox-support');

module.exports.changeInputText = (selector, text, {elemIndex} = {}) => {
    /**
    *  If there are more elements which match specified selector, add elemIndex option.
    */
    const options = {};
    (elemIndex) ? options.elemIndex = elemIndex : null;
    return browser.executeScript(support.changeInputText, selector, text, options);
} 

dispatchEvent(complete example here)

const support = require('protractor-firefox-support');

module.exports.dispatchEvent = ({selector, tgtIndex, eventType, isMouseEvent, eventArguments} = {}) => {
    /**
    *  If there are more elements which match specified selector, add elementIndex option.
    */
    const options = {selector, eventType, isMouseEvent, eventArguments};
    (tgtIndex) ? options.elementIndex = tgtIndex : null;
    return browser.executeScript(support.dispatchEvent, options);
} 

Run tests

First of all you need to install necessary packages using next command:

npm run install-modules-tests

Then update webdriver-manager packages, start it and run tests:

npm run webdriver-update-windows
npm run webdriver-start-windows
npm run test-windows

for Windows or

npm run webdriver-update-linux
npm run webdriver-start-linux
npm run test-linux

for Linux/MacOS.