import { AnswersQuestions , Interaction , Question , UsesAbilities } from '@serenity-js/core' ; import { formatted } from '@serenity-js/core/lib/io' ; import { ElementFinder , protractor , WebElement } from 'protractor' ; import { BrowseTheWeb } from '../abilities' ; import { withAnswerOf } from '../withAnswerOf' ; desc Instructs the  {@link @serenity-js/core/lib/screenplay/actor~Actor} to
 *  perfom a right click on a given Web element.
 *
 *  This is typically used to open a [custom context menu](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event)
 *  on a given Web element, since it's not possible to interact with the standard context menu offered by your browser
 *
 *  example example example see BrowseTheWeb see Target see {@link @serenity-js/assertions~Ensure} see isVisible extends serenity-js export class RightClick extends Interaction { desc Instantiates this  {@link @serenity-js/core/lib/screenplay~Interaction} .
     *
     *  param { Question < ElementFinder > | ElementFinder } target returns { serenity-js static on ( target ) { return new RightClick ( target ) ; } param { Question < ElementFinder > | ElementFinder } target constructor ( private readonly target ) { super ( ) ; } desc Makes the provided  {@link @serenity-js/core/lib/screenplay/actor~Actor} *  perform this  {@link @serenity-js/core/lib/screenplay~Interaction} .
     *
     *  param { UsesAbilities & AnswersQuestions } actor An  {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this  {@link @serenity-js/core/lib/screenplay~Interaction} returns { PromiseLike < void > } see {@link @serenity-js/core/lib/screenplay/actor~Actor} see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities} see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions} performAs ( actor ) { return withAnswerOf ( actor , this . target , ( elf ) => BrowseTheWeb . as ( actor ) . actions ( ) . mouseMove ( elf ) . perform ( ) ) . then ( ( ) => BrowseTheWeb . as ( actor ) . actions ( ) . click ( protractor . Button . RIGHT ) . perform ( ) ) ; } desc Generates a description to be used when reporting this  {@link @serenity-js/core/lib/screenplay~Activity} .
     *
     *  returns { string } toString ( ) { return formatted `#actor right clicks on ${ this . target }` ; } }