UNPKG

@assert-equals/dappdriver

Version:

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

69 lines (68 loc) 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Send = void 0; const dapp_driver_1 = require("../../session/dapp-driver"); /** * * * @export * @class Send * @implements {IConfirmation} */ class Send { url; title; send; constructor() { this.send = new dapp_driver_1.DappDriver.Instance.Extension.pages.Send(); this.url = this.send.url; this.title = this.send.title; } async callIfMethodExists(methodName, args = []) { return await this.send[methodName](...args); } /** * * * @template TPage * @param {new () => TPage} page * @return {*} {Promise<TPage>} * @memberof Send */ async accept(page) { return await this.callIfMethodExists('accept', [page]); } /** * * * @return {*} {Promise<any[]>} * @memberof Send */ async getAllWindowHandles() { return await this.callIfMethodExists('getAllWindowHandles'); } /** * * * @template TPage * @param {new () => TPage} page * @return {*} {Promise<TPage>} * @memberof Send */ async reject(page) { return await this.callIfMethodExists('reject', [page]); } /** * * * @template TPage * @param {*} nameOrHandle * @param {new () => TPage} page * @return {*} {Promise<TPage>} * @memberof Send */ async switchToWindow(page) { return await this.callIfMethodExists('switchToWindow', [page]); } } exports.Send = Send;