UNPKG

@assert-equals/dappdriver

Version:

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

60 lines (59 loc) 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfirmTransaction = void 0; const html_element_1 = require("../../controls/html-element"); const page_1 = require("../../page"); /** * * * @export * @class ConfirmTransaction * @extends {PageObject} * @implements {IConfirmation} */ class ConfirmTransaction extends page_1.PageObject { nextButton = () => new html_element_1.HTMLElement('[data-testid="confirm-footer-button"]'); cancelButton = () => new html_element_1.HTMLElement('[data-testid="confirm-footer-cancel-button"]'); /** * Creates an instance of ConfirmTransaction. * @param {(string | RegExp)} [url='#confirm-transaction'] * @param {string} [title='MetaMask'] * @memberof ConfirmTransaction */ constructor(url = '#confirm-transaction', title = 'MetaMask') { super(url, title); } /** * * * @template TPage * @param {new () => TPage} [page] * @return {*} {Promise<any>} * @memberof ConfirmTransaction */ async accept(page) { if (page) { return await this.nextButton().clickAndSwitchToMainWindow(page); } else { return await this.nextButton().click(); } } /** * * * @template TPage * @param {new () => TPage} [page] * @return {*} {Promise<any>} * @memberof ConfirmTransaction */ async reject(page) { if (page) { return await this.cancelButton().clickAndSwitchToMainWindow(page); } else { return await this.cancelButton().click(); } } } exports.ConfirmTransaction = ConfirmTransaction;