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