🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

protractor-jasmine-retry

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protractor-jasmine-retry

A Protractor plugin to automatically re-run failed test specs for Jasmine test framework.

1.0.2
latest
Source
npm
Version published
Weekly downloads
544
-4.06%
Maintainers
1
Weekly downloads
 
Created
Source

protractor-jasmine-retry CircleCI Build status

A Protractor plugin to automatically re-run failed test specs for Jasmine test framework.

Inspired by protractor-retry, but added some improvements.

  • Support Windows
  • Support non parallel mode, fix #62
  • Collect failed files from the stacktrace, which is more accurate
  • Converted to a Protractor plugin, which would simplify the configuration
  • Provide more APIs to make it easier to integrate with other plugins, like protractor-beautiful-reporter and protractor-screenshoter-plugin

But the bad news is it only supports Jasmine framework now.

Usage

  • Install with npm/yarn
npm install --save-dev protractor-jasmine-retry
  • Use it in the protractor config file
const ProtractorJasmineRetry = require('protractor-jasmine-retry'); 

exports.config = {
    plugins: [
        ProtractorJasmineRetry(/* { maxAttempts: 2 } */),
    ],

    afterLaunch(exitCode) {
        return ProtractorJasmineRetry.afterLaunch(exitCode);
    }
};

API

ProtractorJasmineRetry(opts)

The plugin constructor.

  • opts.maxAttempts: The max attempts before success. Default is 2
  • opts.resultPath: The folder used to save the temp result file relative to the current working directory. Default is protractorFailedSpecs

ProtractorJasmineRetry.afterLaunch(exitCode)

This function should be called with exit code of the Protractor's afterLaunch callback and return it.

ProtractorJasmineRetry.retriedTimes

Returns the retried times, it could be 0, 1, 2 if the maxAttempts is 2.

ProtractorJasmineRetry.isLastAttempt()

Returns whether current run is the last attempt.

Integrate with other plugins

The idea is that construct a run ID using the ProtractorJasmineRetry.retriedTimes and use it to distinct the configuration of other plugins.

const ProtractorJasmineRetry = require('protractor-jasmine-retry'); 
const runId = `run_${ProtractorJasmineRetry.retriedTimes + 1}`; // it could be `run_1`, `run_2`, `run_3`...

exports.config = {
    plugins: [
        {
            package: 'protractor-screenshoter-plugin',
            screenshotPath: path.join('screenshoter', runId), // The reports can be saved in different folders
            // ... ...
        }
    ]
};

License

MIT

Keywords

protractor

FAQs

Package last updated on 06 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts