npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

protractorwrap

v1.0.7

Published

It is a wrapper over protractor in-built functions, that helps to structure the ui test automation.

Downloads

19

Readme

ProtractorWrap

A Nodejs library to simplify the ui test automation for AngularJs application. It is a wrapper over protractor in-built functions, that helps to structure the ui test automation.

Installation

  npm install protractorwrap

Usage

  var pWrap = require('protractorwrap');
  1. To click an element.

    Syntax:
       pWrap.clickElement(locator_name, locate_by);
    
    1. Locate by xpath.
       Example:
          pWrap.clickElement("//a[text()='Contact']", pWrap.LOCATE_BY.XPATH);
    
    2. Locate by name.
       Example:
          pWrap.clickElement("dog_name", pWrap.LOCATE_BY.NAME);
    
    so on and so forth with other methods to locate an element and click it.
  2. To get an element.

    Syntax:
       pWrap.getElement(locator_name, locate_by);
    
    1. Locate by xpath.
       Example:
         var contactLabel = pWrap.getElement("//a[text()='Contact']", pWrap.LOCATE_BY.XPATH);
         expect(contactLabel.isDisplayed()).toBe(true);
    
    2. Locate by name.
       Example:
         var dogName = pWrap.getElement("dog_name", pWrap.LOCATE_BY.NAME);
         expect(dogName.isDisplayed()).toBe(false);
    
    so on and so forth with other methods to locate the element and get it.
  3. To input text in a textbox.

    Syntax:
      pWrap.enterInputInTextBox(locator, locateBy, inputData);
    Example:
      pWrap.enterInputInTextBox("text_box", pWrap.LOCATE_BY_NAME, "Welcome to Protractor Wrap")
  4. To navigate to a page.

    Syntax:
      pWrap.navigateToPage(url);
    Example:
      pWrap.navigateToPage("https://cimpress.com/")
  5. To get value of a key from json file.

    Syntax:
      pWrap.readFileWithKey(file, key);

    Let us assume you have a config file.

    config.json
    {
        "Profile": {
             "nickname": "name",
             "email": "[email protected]"
         }
    }

    In your test if you want to read profile object, you can do that as below:

    Example:
      var config = require('../data/Config.json');                                             
      profile = pWrap.readFileWithKey(config, "Profile");
  6. To set cookie.

    Syntax:
      pWrap.setCookieValue(key, value);
    Example:
      pWrap.setCookieValue("id_token", tokenValue);
  7. To check if element is visible and displayed.

    Syntax:
        pWrap.waitForElementVisibility(locator, locateBy);
    Example:
      pWrap.waitForElementVisibility("search.barcodeId", pWrap.LOCATE_BY.MODEL);
  8. To get cookie.

    Syntax:
      pWrap.getCookie(key);
    Example:
      pWrap.getCookie('id_token').then(function(auth0Token) {
          pWrap.navigateToPage("https://cimpress.com/");
          pWrap.verifyElementIsNotPresent("name", pWrap.LOCATE_BY.NAME);
      }
  9. To compare current url.

    Syntax:
      pWrap.compareCurrentUrl(expectedUrl);
    Example:
      Let us assume you have navigated to https://cimpress.com/ and you want to verify if the current url and expected url are same.
      pWrap.compareCurrentUrl("https://cimpress.com/");
  10. If you have use-case where in you have a browser specific authentication pop-up and you want to bypass the pop-up you can do it as below:

    Let us assume you have the config, service account credentials and application url in different json files.

      Syntax:
        pWrap.bypassBrowserSpecificAuthenticationPopup(auth0Uri, auth0ClientId, serviceAccountUsername, ServiceAccountPassword, profile, connection, appUrl);
    Config.json
    {
        "Auth0": {
            "comment": "Service to get auth0 token.",
            "uri": "auth0Uri",
            "clientId": "clientId"
        },
        "Profile": {
            "nickname": "name",
            "email": "[email protected]"
        },
        "Connection": "accountADFS"
    }
    Credentails.json
    {
        "ServiceAccountCredentials": {
            "username": "serviceAccountUserName",
            "password": "serviceAccountPassword"
        }
    }
    ApplicationUrl.json
    {
        "appUrl": "https://domain.com"
    }
    var config = require('Config.json');
    var credentials = require('Credentials.json');
    var urlFile = pWrap.getUrlFile('ApplicationUrl.json');
    profile = pWrap.readFileWithKey(config, "Profile");
    auth0 = pWrap.readFileWithKey(config, "Auth0");
    connection = pWrap.readFileWithKey(config, "Connection");
    pWrap.bypassBrowserSpecificAuthenticationPopup(auth0.uri, auth0.clientId, credentials.ServiceAccountCredentials.username, credentials.ServiceAccountCredentials.password, profile, connection, urlFile.appUrl);
    pWrap.navigateToPage(urlFile.appUrl);
    ...
    ...

    The method is specific to auth0 that is the method generates auth0 and stores the profile and auth0 token in the browser resulting in bypass of authentication pop-up.

  11. To refresh page.

    Syntax:
      pWrap.refreshPage();
    Example:
      pWrap.refreshPage();
    
    If your page takes a long time to load and you want to wait then you combine, refresh with sleep as below:
    
    pWrap.refreshPage();
    pWrap.sleep(20000);

Contributing

We appreciate contributions. Fork the repository and come up with a pull request. Thank you! We will focus on development of ProtractorWrap and make the UI test automation easy by using a proper structure under a single hood.