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

jasmine2-protractor-utils

v1.3.0

Published

Utilities for Protractor with jasmine2 [HTML Reports, Screenshot, Browser Console log and more]

Downloads

8,725

Readme

npm npm

npm npm

jasmine2-protractor-utils

Utilities for Protractor with jasmine2 [Screenshot, Browser Console log and more]

  1. This plugin can take a screenshot for each Jasmine2 expect failure
  2. It can take screenshot for each spec failure as well
  3. It can fail your spec/test if browser console has errors
  4. It can generate beautiful readable HTML reports
  5. TODO: It can output browser console logs on failure(Done) or always(TODO) :)

Usage

How to install

npm install jasmine2-protractor-utils -g

To install a particular version: npm install jasmine2-protractor-utils@version

Add this plugin to the protractor config file:

exports.config = {
      plugins: [{
        package: 'jasmine2-protractor-utils',
        disableHTMLReport: {Boolean},
        disableScreenshot: {Boolean},
        screenshotOnExpectFailure: {Boolean}    (Default - false),
        screenshotOnSpecFailure: {Boolean}      (Default - false),
        screenshotPath: {String}                (Default - 'reports/screenshots')
        clearFoldersBeforeTest: {Boolean}       (Default - false),
        htmlReportDir:  {String}                (Default - './reports/htmlReports')
        failTestOnErrorLog: {
                    failTestOnErrorLogLevel: {Number},  (Default - 900)
                    excludeKeywords: {A JSON Array}
                }
      }]
    };

Example:

exports.config = {
      plugins: [{
        package: 'jasmine2-protractor-utils',
        disableHTMLReport: false,
        disableScreenshot: false,
        screenshotPath:'./reports/screenshots',
        screenshotOnExpectFailure:true,
        screenshotOnSpecFailure:true,
        clearFoldersBeforeTest: true,
        htmlReportDir: './reports/htmlReports',
        failTestOnErrorLog: {
                    failTestOnErrorLogLevel: 900,
                    excludeKeywords: ['keyword1', 'keyword2']
                }
      }]
    };

Please Note

If you are using failTestOnErrorLog feature, there should be an onPrepare: block in your Protractor config which returns a promise. If not present , please add the following to the config file:

 onPrepare: function () {

        // returning the promise makes protractor wait for the reporter config before executing tests
        return global.browser.getProcessedConfig().then(function (config) {

        });
        }

package

This is the plugin package name , same as of npm module name for the plugin , 'jasmine2-protractor-utils' usually and preferably

disableHTMLReport

If set to 'true', disables HTML report generation.

Valid Options: true/false

disableScreenshot

If set to 'true' , disables screenshot generation.

Valid Options: true/false

screenshotOnExpectFailure

Takes a screenshot for each Jasmine2 expect failure, is set true. Screenshot will be taken in 'png' format and file name would be: description+spec description+index.png

Default: false

screenshotOnSpecFailure

Take screenshot for each spec failure , if set to true. Screenshot will be taken in 'png' format and file name would be: description+spec description.png

Default: false

screenshotPath

Path where screenshots will be saved. If path does not exist , will be created. e.g './reports/something/savehere/' , please take care of './' and '/' at the beginning and end.

Default: 'reports/screenshots'

clearFoldersBeforeTest

If this flag set to true, screenshot and html report directories will be emptied before generating new reports and screenshots

Default: false

htmlReportDir

Path where HTML report will be saved. If path does not exist , will be created. e.g './reports/something/savehere/'

If you want to use the default location , never mention 'htmlReportDir' with the plug in configuration. Where as 'disableHTMLReport' must be set to false.

Default: 'reports/htmlReports'

failTestOnErrorLog (Chrome only)

Contains a set of configuration for console log. When browser console has errors of a certain log level (default:>900), the spec/test is marked failed along with log in the error report/stacktrace.

failTestOnErrorLogLevel

Log level, test fails of the browser console log has logs more than this specified level.

Default: 900

excludeKeywords

An array of keywords to be excluded , while searching for error logs. i.e If a log contains any of these keywords , spec/test will not be marked failed.

Please do not specify this flag , if you don't supply any such keywords.

TODO

It can output browser console logs on failure(done) or always(TODO) :)