Registry / testing / protractor-jasmine2-screenshot-reporter

protractor-jasmine2-screenshot-reporter

JSON →
library0.5.1jsnpmunverified

This package provides a dedicated reporter for Protractor, the end-to-end testing framework, specifically designed for use with Jasmine2. It automatically captures screenshots after each executed test case, whether passing or failing, and consolidates them into a single HTML report. Key features include configurable output directories, custom report filenames, the ability to include external CSS and JavaScript for custom styling and interactivity, and options to ignore pending specs or capture screenshots only for failed tests. The current stable version is 0.5.1. Given that its primary dependency, Protractor, was officially deprecated in 2022 and this reporter has not seen updates since 2016, it is effectively an abandoned project. There is no active release cadence, and it is not recommended for new projects.

npm install protractor-jasmine2-screenshot-reporter
INSTALL
IMPORT
SIG · PROTRACTOR-JASMINE
P
protractor-jasmine2-screenshot-reporter
testingjavascriptv0.5.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HtmlScreenshotReporter
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
import { HtmlScreenshotReporter } from 'protractor-jasmine2-screenshot-reporter';
This package is CommonJS only and does not provide an ESM export. Direct ESM 'import' will fail. It's intended for use within a Protractor configuration file, which typically uses CommonJS.

This configuration snippet demonstrates how to integrate `protractor-jasmine2-screenshot-reporter` into a Protractor `conf.js` file, setting up the reporter lifecycle methods for `beforeLaunch`, `onPrepare`, and `afterLaunch` to capture screenshots and generate an HTML report.

var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter'); var reporter = new HtmlScreenshotReporter({ dest: 'target/screenshots', filename: 'my-report.html' }); exports.config = { // ... Protractor configuration ... // Setup the report before any tests start beforeLaunch: function() { return new Promise(function(resolve){ reporter.beforeLaunch(resolve); }); }, // Assign the test reporter to each running instance onPrepare: function() { jasmine.getEnv().addReporter(reporter); }, // Close the report after all tests finish afterLaunch: function(exitCode) { return new Promise(function(resolve){ reporter.afterLaunch(resolve.bind(this, exitCode)); }); } };
Debug
Known issues
breakingProtractor, the testing framework this reporter is built for, has been officially deprecated since 2022. This reporter is no longer actively maintained and is not compatible with modern Angular versions or test setups using frameworks other than Protractor.
fix
For new projects, consider modern alternatives like Cypress, Playwright, or WebdriverIO, which have built-in screenshot capabilities and active development. For existing Protractor projects, be aware that this reporter may not receive updates or bug fixes.
affects: >=0.5.1
gotchaThe `cleanDestination` option is `true` by default, meaning the output directory (`dest`) is cleared before each test run. This can lead to loss of previous reports or conflicts when running tests in parallel, where multiple instances might try to write to and clear the same directory.
fix
If running tests in parallel or needing to preserve previous reports, set `cleanDestination: false` in the reporter options. When disabling `cleanDestination`, it's also recommended to set `showSummary: false`, `showConfiguration: false`, and `reportTitle: null` to avoid cluttered reports from multiple runs.
affects: >=0.1.0
gotchaThis package is written exclusively in CommonJS and does not provide ES Module (ESM) exports. Attempting to use `import` statements directly in an ESM context will result in a `ReferenceError` or module resolution error.
fix
Ensure your Protractor configuration file (`conf.js`) uses CommonJS `require()` syntax. If you are in an ESM project, you might need to use a CommonJS wrapper or configure your build system to correctly handle CommonJS modules.
affects: >=0.1.0
gotchaThe package does not ship with TypeScript declaration files (`.d.ts`). When used in a TypeScript project, you will encounter `Cannot find module 'protractor-jasmine2-screenshot-reporter'` errors without manual type declarations.
fix
Create a declaration file (e.g., `protractor-jasmine2-screenshot-reporter.d.ts`) in your project with `declare module 'protractor-jasmine2-screenshot-reporter';` or `declare var HtmlScreenshotReporter: any;` to provide basic type information, or use `@ts-ignore` for the import line.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: reporter.beforeLaunch is not a function
The `beforeLaunch` hook in Protractor expects a promise to be returned if any asynchronous operations are performed. Calling `reporter.beforeLaunch` directly without wrapping it in a promise will cause this error.
fix
Ensure `reporter.beforeLaunch` is called within a `new Promise()` block and returns that promise, as shown in the quickstart example: `return new Promise(function(resolve){ reporter.beforeLaunch(resolve); });`
Html report is empty or no screenshots are generated.
This can be caused by an incorrect `dest` path (e.g., directory not writable), or if `captureOnlyFailedSpecs` is enabled and no tests are failing, or if there are file permission issues for the output directory.
fix
Verify that the `dest` path in the reporter options is correct and writable. Check the console for any error messages during test execution. If `captureOnlyFailedSpecs` is true, ensure there are failing tests to trigger screenshot capture. If no report file appears, check for errors during `afterLaunch` or verify the `filename` option.
ReferenceError: require is not defined
This error occurs when attempting to use the `require` function in an environment configured for ES Modules (ESM) without proper CommonJS compatibility.
fix
Ensure your Protractor configuration file (`conf.js`) is treated as a CommonJS module. If your project is ESM-first, you may need to use `.cjs` file extension for the config or ensure your `package.json`'s `type` field isn't set to `module` for the relevant directory, or configure your bundler to handle CommonJS imports.
Upgrade
Version history
0.5.1latest on npm
Audit
Dependencies
protractorrequiredThis package is a reporter specifically for the Protractor testing framework; Protractor must be installed and configured in the project.
jasmine2requiredThe reporter is designed for the Jasmine2 test framework, which Protractor typically uses. Jasmine2 must be available in the test environment.
qrequiredInternal runtime dependency for promise management, listed in its package.json dependencies.
Agent activity
2 hits · last 30 days
node
2
Resources
protractor-jasmine2-screenshot-reporter — npm install protractor-jasmine2-screenshot-reporter · libregistry