Skip to content

Latest commit

 

History

History
42 lines (28 loc) · 982 Bytes

README.md

File metadata and controls

42 lines (28 loc) · 982 Bytes

protractor-linkuisref-locator

Adds a locator to a protractor instance that finds anchor elements by their ui-sref attribute.

Installation

$ npm install protractor-linkuisref-locator

Usage

onPrepare: function () {
  // Your other stuff.
  require('protractor-linkuisref-locator')(protractor);
}

The locator will be available in your specs as by.linkUiSref(toState, [parentElement]).

toState is a String that represents a ui-router state.

parentElement represents an HTML element. It is optional and defaults to the document element.

The locator returns:

  • null if no anchor is found.
  • An anchor element if only one is found.
  • An Array of anchor elements if more than one is found.

Example Calls

by.linkUiSref('users.show({id: 42})', element(by.css('.users')));
by.linkUiSref('users.index.page({page: 2})');

Tests

$ npm run test