protractor-tools
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

protractor-tools npm version MIT license

A typescript rewrite of sg-protractor-tools utility library

Build Status dependencies Status devDependencies Status Greenkeeper badge PRs Welcome Codacy Badge

This library provides a reusable and generic set of helper functions for the Protractor test framework. It includes functions that simplify things like browser resizing, scrolling and memory usage tracking as part of a test suite. The project bundles an example application that showcases the functionality.

While using Protractor for testing our Angular-based applications, we have found that we can simplify many of the common tasks done as part of part of our test suite. The Protractor API is fairly low-level in some cases, and we have seen that we can cut down the amount of code for some common tasks by externalizing functionality into a reusable library.

Installing / Getting started

npm install -D protractor-tools

Install the library as a development dependency using the node package manager of your choice.

Usage

Import the required util classes in your *.e2e-spec.ts files.

import { ResizeUtil } from 'protractor-tools';
 
describe('Resizing demo App', () => {
      it('should resize the browser window a little', () => {
        // ...
        resizeUtil.setWindowSize(1303, 876);
        // ...
      });
});

Features

The following utility classes are currently available

  • ConsoleUtil (retrieve console logs and convenience methods to ensure your app didn't produce console errors)
  • DomUtil (wait for dom elements to become visible or invisible)
  • MemoryUtil (execute an action multiple times and track the memory footprint of the app)
  • MouseUtil (drag and drop functionality)
  • ResizeUtil (get and set the browser window and viewport size)
  • ScrollUtil (scroll to a element, scroll to a coordinate/position or scroll by a number of pixels)

You may refer to the source code of the util classes for usage details or the forked library documentation for more information about the reason for the utility classes.

Links

Licensing

The code in this project is licensed under MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i protractor-tools

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

38.2 kB

Total Files

18

Last publish

Collaborators

  • nolanus