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 🙏

© 2024 – Pkg Stats / Ryan Hefner

protractor-retry

v2.0.1

Published

module for protractor to automatically re-run failed tests with specific number of attempts

Downloads

33,614

Readme

Build Status

Protractor-retry

  • A solution to address the flakyness of your Protractor FE automation test suites.
  • This module used protractor features to automatically re-run failed tests with a specific configurable number of attempts.
  • This module is added in our CICD pipelines where we have a zero failure policy in order to bless an environment.
  • Mocha & Jasmine are supported.
  • NEW : WINDOWS Support UPDATE : Windows as an env to launch with version 2.0.1

This module fully relies on protractor available callbacks and internal functionalities.

It is build from within protractor itself and not relying on any external dependency. All the changes that you need to add in order to integrate this module is located only in one file, the protractor configuration file, ie to summarize :

  • You don’t need to update a single line of your tests spec.js files.
  • Only few lines to add in your protractor conf file needed.

The module will create an XML file which contains the failed spec(s) filename(s). and will re-run only them, till either we don't have anymore failures or we reached the retry attempt maximum.

The process of retrying is not happening on the fly of a test failure but only after the whole testsuite is run. The failed tests are stored and only those ones are going to be rerun afterwards by creating on the fly a new "failed only" files testsuite.

Steps to Integrate

Install

npm i -g  protractor-retry

Step 1: Require the Package ( Your Protractor Config )

var retry = require('protractor-retry').retry;

Step 2: onPrepare ( Your Protractor Config )

onPrepare: function() {
  retry.onPrepare();
}

Step 3: onCleanUp ( Your Protractor Config )

onCleanUp = function(results) {
    retry.onCleanUp(results);
};

It is Mandatory to provide the results to the retry.onCleanUp function

Step 4: afterLaunch ( Your Protractor Config )

afterLaunch = function() {
   return retry.afterLaunch(NUMBER_OF_RETRIES);
}

It is Mandatory to use return here

Full Protractor Config snippet with 2 retries

exports.config = {
    // rest of your config
    onCleanUp: function (results) {
        retry.onCleanUp(results);
    },
    onPrepare: function () {
        retry.onPrepare();
    },
    afterLaunch: function() {
        return retry.afterLaunch(2);
    }
};

Examples

Those 3 examples are actually used for the functional tests coverage of this package. Please take a look at the Travis output to check out the flow of the retries.

Known Caveat

  • If you are NOT Running in Parallel mode, the package will retry the whole testsuite if any failure.
  • Windows as an environment to launch & use this package is unfortunately not yet supported.
  • WINDOWS SUPPORT UPDATE Supported from version 2.0.1