UNPKG

@assert-equals/dappdriver

Version:

DappDriver is an e2e testing framework designed for testing decentralized applications (dApps) using MetaMask, Rainbow or Zerion

46 lines (45 loc) 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SignMessage = void 0; const html_element_1 = require("../../controls/html-element"); const confirm_transaction_1 = require("./confirm-transaction"); /** * * * @export * @class SignMessage * @extends {ConfirmTransaction} * @implements {IConfirmation} */ class SignMessage extends confirm_transaction_1.ConfirmTransaction { nextButton = () => new html_element_1.HTMLElement('[data-testid="confirm-footer-button"]'); cancelButton = () => new html_element_1.HTMLElement('[data-testid="confirm-footer-cancel-button"]'); scrollButton = () => new html_element_1.HTMLElement('[aria-label="Scroll down"]', 8000); /** * Creates an instance of SignMessage. * @memberof SignMessage */ constructor() { super(new RegExp(/#confirm-transaction/), 'MetaMask'); } /** * * * @template TPage * @param {new () => TPage} [page] * @return {*} {Promise<any>} * @memberof SignMessage */ async accept(page) { if (await this.scrollButton().isDisplayed()) { await this.scrollButton().clickAndWait(); } if (page) { return await this.nextButton().clickAndSwitchToMainWindow(page); } else { return await this.nextButton().click(); } } } exports.SignMessage = SignMessage;