UNPKG

@assert-equals/dappdriver

Version:

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

58 lines (57 loc) 1.59 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 { confirmButton = () => new html_element_1.HTMLElement('xpath=//button[contains(., "Confirm")]'); cancelButton = () => new html_element_1.HTMLElement('xpath=//button[contains(., "Cancel")]'); /** * Creates an instance of ConfirmTransaction. * @memberof ConfirmTransaction */ constructor() { super('#/sendTransaction', 'Zerion · Send Transaction'); } /** * * * @template TPage * @param {new () => TPage} [page] * @return {*} {Promise<any>} * @memberof ConfirmTransaction */ async accept(page) { if (page) { return await this.confirmButton().clickAndSwitchToMainWindow(page); } else { return await this.confirmButton().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;