Skip to content

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

License

Notifications You must be signed in to change notification settings

elwynelwyn/protractor-linkuisref-locator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%