import {Photographer} from '@serenity-js/protractor/lib/stage/crew/photographer'
public class | source

Photographer

The Photographer is a StageCrewMember who takes screenshots of the web browser the Actor in the spotlight is using.

Examples:

Assigning the Photographer to the Stage

const { ArtifactArchiver } = require('@serenity-js/core');
const { Photographer, TakePhotosOfFailures } = require('@serenity-js/protractor');

exports.config = {

    serenity: {
        crew: [
            ArtifactArchiver.storingArtifactsAt('./target/site/serenity'),
            Photographer.whoWill(TakePhotosOfFailures),
        ]
    },

    // ... rest of the config omitted for brevity
};
Taking photos upon failures only

const { Photographer, TakePhotosOfFailures } = require('@serenity-js/protractor');

Photographer.whoWill(TakePhotosOfFailures)
Taking photos of all the interactions

const { Photographer, TakePhotosOfInteractions } = require('@serenity-js/protractor');

Photographer.whoWill(TakePhotosOfInteractions)
Taking photos before and after all the interactions

const { Photographer, TakePhotosBeforeAndAfterInteractions } = require('@serenity-js/protractor');

Photographer.whoWill(TakePhotosBeforeAndAfterInteractions)

See also:

Static Method Summary

Static Public Methods
public static

whoWill(strategy: Function): StageCrewMember

Instantiates a new Photographer configured to take photos (screenshots) as per the specified PhotoTakingStrategy.

Constructor Summary

Public Constructor
public

constructor(photoTakingStrategy: PhotoTakingStrategy, stage: Stage)

Method Summary

Public Methods
public

Creates a new instance of this StageCrewMember and assigns it to a given Stage.

public

notifyOf(event: DomainEvent): *

Handles DomainEvent objects emitted by the Stage this StageCrewMember is assigned to.

Static Public Methods

public static whoWill(strategy: Function): StageCrewMember source

Instantiates a new Photographer configured to take photos (screenshots) as per the specified PhotoTakingStrategy.

Params:

NameTypeAttributeDescription
strategy Function

A no-arg constructor function that instantiates a PhotoTakingStrategy.

Returns:

StageCrewMember

Public Constructors

public constructor(photoTakingStrategy: PhotoTakingStrategy, stage: Stage) source

Params:

NameTypeAttributeDescription
photoTakingStrategy PhotoTakingStrategy
stage Stage

Public Methods

public assignedTo(stage: Stage): StageCrewMember source

Creates a new instance of this StageCrewMember and assigns it to a given Stage.

Params:

NameTypeAttributeDescription
stage Stage

An instance of a Stage this StageCrewMember will be assigned to

Returns:

StageCrewMember

A new instance of this StageCrewMember

public notifyOf(event: DomainEvent): * source

Handles DomainEvent objects emitted by the Stage this StageCrewMember is assigned to.

Params:

NameTypeAttributeDescription
event DomainEvent

Returns:

*

void