Dismiss
Instructs the Actor to dismiss a ModalDialog.
Extends:
Examples:
<button
data-test="trigger"
onclick="alert('hello!')">Trigger Alert</button>
import { Target } from '@serenity-js/protractor';
import { by } from 'protractor';
class Widget {
static trigger = Target.the('trigger button')
.located(by.css('[data-test="trigger"]'));
}
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()),
);
See also:
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:
Name | Type | Attribute | Description |
modalDialogWindow | Question<AlertPromise> | AlertPromise | The modal dialog window to dismiss |
Tests:
- ModalDialog, when working with alert(), allows the actor to dismiss an alert
- ModalDialog, when working with alert(), allows the actor to read the message on an alert
- ModalDialog, when working with confirm(), allows the actor to dismiss a confirmation dialog
- ModalDialog, when working with prompt(), allows the actor to dismiss a prompt
Public Constructors
public constructor(modalDialogWindow: Question<AlertPromise> | AlertPromise) source
Params:
Name | Type | Attribute | Description |
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:
Name | Type | Attribute | Description |
actor | UsesAbilities & AnswersQuestions | An Actor to perform this Interaction |
Returns:
PromiseLike<void> |