import {Dismiss} from '@serenity-js/protractor/lib/screenplay/interactions'
public class | source

Dismiss

Instructs the Actor to dismiss a ModalDialog.

Extends:

Interaction → Dismiss

Examples:

Example widget
 <button
     data-test="trigger"
     onclick="alert('hello!')">Trigger Alert</button>
Lean Page Object describing the widget
 import { Target } from '@serenity-js/protractor';
 import { by } from 'protractor';

 class Widget {
     static trigger = Target.the('trigger button')
         .located(by.css('[data-test="trigger"]'));
 }
Dismissing a modal dialog window
 import { actorCalled } from '@serenity-js/core';
 import { BrowseTheWeb, Click, Dismiss, ModalDialog } from '@serenity-js/protractor';
 import { protractor } from 'protractor';

 actorCalled('Nick')
     .whoCan(BrowseTheWeb.using(protractor.browser))
     .attemptsTo(
         Click.on(Widget.trigger),
         Dismiss.the(ModalDialog.window()),
     );

Static Method Summary

Static Public Methods
public static

the(modalDialogWindow: Question<AlertPromise> | AlertPromise): Interaction

Instantiates this Interaction with a ModalDialog.window the Actor will dismiss.

Constructor Summary

Public Constructor
public

constructor(modalDialogWindow: Question<AlertPromise> | AlertPromise)

Method Summary

Public Methods
public

performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void>

Makes the provided Actor perform this Interaction.

public

toString(): string

Generates a description to be used when reporting this Activity.

Static Public Methods

public static the(modalDialogWindow: Question<AlertPromise> | AlertPromise): Interaction source

Instantiates this Interaction with a ModalDialog.window the Actor will dismiss.

Params:

NameTypeAttributeDescription
modalDialogWindow Question<AlertPromise> | AlertPromise

The modal dialog window to dismiss

Returns:

Interaction

Public Constructors

public constructor(modalDialogWindow: Question<AlertPromise> | AlertPromise) source

Params:

NameTypeAttributeDescription
modalDialogWindow Question<AlertPromise> | AlertPromise

The modal dialog window to dismiss

Public Methods

public performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void> source

Makes the provided Actor perform this Interaction.

Params:

NameTypeAttributeDescription
actor UsesAbilities & AnswersQuestions

An Actor to perform this Interaction

Returns:

PromiseLike<void>

public toString(): string source

Generates a description to be used when reporting this Activity.

Returns:

string